Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,24 @@

All notable changes for each version of this project will be documented in this file.

# 21.1.0

## New Features

### PDF Exporter
- **Custom Font Support for CJK and Arabic Scripts**: Added pre-configured font constants (licensed under SIL OFL 1.1) for easy PDF export with non-Latin character support:
- `NOTO_SANS_FONT` - Supports Latin, Cyrillic, and Greek characters
- `NOTO_SANS_CJK_FONT` - Supports Chinese, Japanese, and Korean characters (CJK)
- `NOTO_SANS_ARABIC_FONT` - Supports Arabic script and related languages

These fonts can be imported from `igniteui-angular/grids/core` and used with `IgxPdfExporterOptions.customFont`:

```typescript
import { NOTO_SANS_CJK_FONT } from 'igniteui-angular/grids/core';

const options = new IgxPdfExporterOptions('Export');
options.customFont = NOTO_SANS_CJK_FONT;

## 21.0.0

### New Features
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,10 @@ Developer support is provided as part of the commercial, paid-for license via [I

Community support for open source usage of this product is available at [StackOverflow](https://stackoverflow.com/questions/tagged/ignite-ui-angular).

## Attributions

This project uses the [Noto Sans](https://fonts.google.com/noto/specimen/Noto+Sans) font, which is licensed under the [SIL Open Font License, Version 1.1](http://scripts.sil.org/OFL).

## License
This is a commercial product, requiring a valid paid-for license for commercial use.
This product is free to use for non-commercial educational use for students in K through 12 grades or University programs, and for educators to use in a classroom setting as examples / tools in their curriculum.
Expand Down
1 change: 1 addition & 0 deletions projects/igniteui-angular/grids/core/src/public_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export * from './services/excel/excel-exporter';
export * from './services/excel/excel-exporter-options';
export * from './services/pdf/pdf-exporter';
export * from './services/pdf/pdf-exporter-options';
export * from './services/pdf/fonts/noto-fonts';

/*

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
Copyright 2015 Google Inc. All Rights Reserved.

This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL

-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------

PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.

The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.

DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.

"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).

"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).

"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.

"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.

PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:

1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.

2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.

3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.

4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.

5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.

TERMINATION
This license becomes null and void if any of the above conditions are
not met.

DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { NOTO_SANS_BASE64, NOTO_SANS_BOLD_BASE64 } from './noto-sans';
import { NOTO_SANS_ARABIC_BASE64, NOTO_SANS_ARABIC_BOLD_BASE64 } from './noto-sans-arabic';
import { NOTO_SANS_CJK_BASE64, NOTO_SANS_CJK_BOLD_BASE64 } from './noto-sans-cjk';

/**
* Pre-configured Noto Sans font for PDF exports
* Supports Latin, Cyrillic, Greek, and extended Latin characters.
* Noto Sans is licensed under the SIL Open Font License, Version 1.1.
* See OFL.txt in this directory or http://scripts.sil.org/OFL for details.
*
* @example
* ```typescript
* import { NOTO_SANS_FONT } from 'igniteui-angular/pdf-fonts';
*
* const options = new IgxPdfExporterOptions('Export');
* options.customFont = NOTO_SANS_FONT;
* ```
*
* @publicApi
*/
export const NOTO_SANS_FONT = {
data: NOTO_SANS_BASE64,
name: 'NotoSans',
bold: {
data: NOTO_SANS_BOLD_BASE64,
name: 'NotoSans-Bold'
}
};

/**
* Pre-configured Noto Sans CJK font for PDF exports
* Noto Sans is licensed under the SIL Open Font License, Version 1.1.
* See OFL.txt in this directory or http://scripts.sil.org/OFL for details.
* @publicApi
*/
export const NOTO_SANS_CJK_FONT = {
data: NOTO_SANS_CJK_BASE64,
name: 'NotoSansCJK',
bold: {
data: NOTO_SANS_CJK_BOLD_BASE64,
name: 'NotoSansCJK-Bold'
}
};

/**
* Pre-configured Noto Sans Arabic font for PDF exports
* Noto Sans is licensed under the SIL Open Font License, Version 1.1.
* See OFL.txt in this directory or http://scripts.sil.org/OFL for details.
* @publicApi
*/
export const NOTO_SANS_ARABIC_FONT = {
data: NOTO_SANS_ARABIC_BASE64,
name: 'NotoSansArabic',
bold: {
data: NOTO_SANS_ARABIC_BOLD_BASE64,
name: 'NotoSansCJK-Bold'
}
};

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import fontData from './noto-sans-arabic.json'
/**
* Base64-encoded Noto Sans Arabic font data (Regular weight).
*
* This font provides comprehensive support for Arabic script and related languages,
* including Arabic, Persian/Farsi, Urdu, Pashto, and Kurdish (Sorani).
*
* @remarks
* This constant is used with `IgxPdfExporterOptions.customFont` to enable
* Arabic and related right-to-left (RTL) scripts in exported PDF documents.
*
* The font uses the SIL Open Font License 1.1.
* Source: https://fonts.google.com/noto/specimen/Noto+Sans+Arabic
*
* @example
* ```typescript
* const options = new IgxPdfExporterOptions('MyExport');
* options.customFont = {
* name: 'Noto Sans Arabic',
* data: NOTO_SANS_ARABIC_BASE64,
* bold: { data: NOTO_SANS_ARABIC_BOLD_BASE64 }
* };
* ```
*/
export const NOTO_SANS_ARABIC_BASE64 = fontData.normal;

/**
* Base64-encoded Noto Sans Arabic Bold font data.
*
* This is the bold variant of the Noto Sans Arabic font, used for headers and emphasized text
* in PDF exports with Arabic script support.
*
* @remarks
* Pair this with `NOTO_SANS_ARABIC_BASE64` in the `IgxPdfExporterOptions.customFont.bold` property
* to ensure consistent rendering of both regular and bold Arabic text.
*
* @see NOTO_SANS_ARABIC_BASE64
*/
export const NOTO_SANS_ARABIC_BOLD_BASE64 = fontData.bold;

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import fontData from './noto-sans-cjk.json';

/**
* Base64-encoded Noto Sans CJK font data (Regular weight).
*
* This font provides comprehensive support for CJK (Chinese, Japanese, Korean) characters,
* including Hiragana, Katakana, Kanji, Hangul, and CJK Unified Ideographs, as well as
* Latin, Cyrillic, and Greek scripts.
*
* @remarks
* This is a large font file (~15-25MB when Base64-encoded). Consider loading it
* asynchronously or on-demand to avoid impacting initial application load time.
*
* The font uses the SIL Open Font License 1.1.
* Source: https://fonts.google.com/noto/specimen/Noto+Sans+JP
*
* This constant is used with `IgxPdfExporterOptions.customFont` to enable
* CJK characters in exported PDF documents.
*
* @example
* ```typescript
* const options = new IgxPdfExporterOptions('MyExport');
* options.customFont = {
* name: 'Noto Sans CJK',
* data: NOTO_SANS_CJK_BASE64,
* bold: { data: NOTO_SANS_CJK_BOLD_BASE64 }
* };
* ```
*/
export const NOTO_SANS_CJK_BASE64 = (fontData as any).normal;

/**
* Base64-encoded Noto Sans CJK Bold font data.
*
* This is the bold variant of the Noto Sans CJK font, used for headers and emphasized text
* in PDF exports with CJK character support.
*
* @remarks
* Pair this with `NOTO_SANS_CJK_BASE64` in the `IgxPdfExporterOptions.customFont.bold` property
* to ensure consistent rendering of both regular and bold CJK text.
*
* Like the regular weight, this is a large font file that may impact bundle size.
*
* @see NOTO_SANS_CJK_BASE64
*/
export const NOTO_SANS_CJK_BOLD_BASE64 = (fontData as any).bold;

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import fontData from './noto-sans.json';

/**
* Base64-encoded Noto Sans font data (Regular weight).
*
* This font provides extended Latin, Cyrillic, and Greek character support.
* For CJK (Chinese, Japanese, Korean) character support, use a CJK-specific font
* such as Noto Sans CJK or Arial Unicode MS.
*
* @remarks
* This constant is used with `IgxPdfExporterOptions.customFont` to enable
* non-Latin characters in exported PDF documents.
*
* @example
* ```typescript
* const options = new IgxPdfExporterOptions('MyExport');
* options.customFont = {
* name: 'Noto Sans',
* data: NOTO_SANS_BASE64,
* bold: { data: NOTO_SANS_BOLD_BASE64 }
* };
* ```
*/
export const NOTO_SANS_BASE64 = fontData.normal;

/**
* Base64-encoded Noto Sans Bold font data.
*
* This is the bold variant of the Noto Sans font, used for headers and emphasized text
* in PDF exports.
*
* @remarks
* Pair this with `NOTO_SANS_BASE64` in the `IgxPdfExporterOptions.customFont.bold` property
* to ensure consistent rendering of both regular and bold text.
*
* @see NOTO_SANS_BASE64
*/
export const NOTO_SANS_BOLD_BASE64 = fontData.bold;
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,41 @@ export class IgxPdfExporterOptions extends IgxExporterOptionsBase {
*/
public fontSize = 10;

/**
* Custom font data for Unicode support (optional).
* If not provided, uses Helvetica (Latin characters only).
*
* @example
* ```typescript
* import { NOTO_SANS_FONT } from './fonts';
*
* const options = new IgxPdfExporterOptions('Export');
* options.customFont = {
* data: NOTO_SANS_FONT,
* name: 'NotoSans'
* };
* ```
*/
public customFont?: PdfUnicodeFont;

constructor(fileName: string) {
super(fileName, '.pdf');
}
}

/**
* Font configuration for PDF export
*/
export interface PdfUnicodeFont {
/** Base64-encoded font data */
data: string;
/** Font family name */
name: string;
/** Bold variant of the font (optional) */
bold?: {
/** Base64-encoded bold font data */
data: string;
/** Font family name (usually same as normal) */
name: string;
};
}
Loading
Loading