@enact/ui
Version:
A collection of simplified unstyled cross-platform UI components for Enact
54 lines (53 loc) • 1.71 kB
TypeScript
/**
* Generates locale-specific font rules allowing any locale to have its own custom font. Each
locale-font from the configuration block (defined in this file) is generated at run-time. If the
locale you're currently in is in the locale-font list an additional `@font-face` rule will be
generated that will override the standard font.
*
* In addition to the standard override-font being generated, named region-specific fonts are also
generated. This lets you incorporate language specific fonts when you're outside of one of those
regions; useful in a language list context where you want the name of each language to be
represented by that language's designated font.
*
* Below is example genarated-output of the Urdu ("ur") locale-font.
* ```
@font-face {
font-family: 'Custom Font ur';
font-weight: 500;
src: local('CustomFont_Urdu');
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
}
@font-face {
font-family: 'Custom Font ur Bold';
font-weight: 700;
src: local('CustomFont_Urdu');
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
}
@font-face {
font-family: 'Custom Font ur Light';
font-weight: 300;
src: local('CustomFont_Urdu');
unicode-range: U+0600-U+06FF, U+FE70-U+FEFE, U+FB50-U+FDFF;
}
```
*/
function generateFontRules(locale: string): string;
/**
* Adds a localed font to the font map
* ```
addLocalizedFont('My Theme Font', {
'ur': {
regular: 'My Theme Urdu',
unicodeRange:
'U+600-6FF,' +
'U+FE70-FEFE,' +
'U+FB50-FDFF'
}
})
```
*/
function addLocalizedFont(name: string, fonts: object): void;
/**
* Removes a localized font from the font map
*/
function removeLocalizedFont(name: string): void;