UNPKG

2.17 kBTypeScriptView Raw
1import { Font as FontBase } from './font-common';
2export type { FontStyleType, FontWeightType, ParsedFont, FontVariationSettingsType } from './font-interfaces';
3
4export declare class Font extends FontBase {
5 public static default: Font;
6
7 public fontFamily: string;
8 public fontStyle: FontStyleType;
9 public fontWeight: FontWeightType;
10 public fontSize: number;
11 public fontScale: number;
12 public fontVariationSettings?: FontVariationSettingsType[];
13
14 public isBold: boolean;
15 public isItalic: boolean;
16
17 constructor(family: string, size: number, style?: FontStyleType, weight?: FontWeightType, scale?: number, fontVariationSettings?: FontVariationSettings[]);
18
19 public getAndroidTypeface(): any /* android.graphics.Typeface */;
20 public getUIFont(defaultFont: any /* UIFont */): any /* UIFont */;
21
22 public withFontFamily(family: string): Font;
23 public withFontStyle(style: FontStyleType): Font;
24 public withFontWeight(weight: FontWeightType): Font;
25 public withFontSize(size: number): Font;
26 public withFontScale(scale: number): Font;
27 public withFontVariationSettings(variationSettings: FontVariationSettings[]): Font;
28
29 public static equals(value1: Font, value2: Font): boolean;
30}
31
32export namespace FontStyle {
33 export const NORMAL: 'normal';
34 export const ITALIC: 'italic';
35 export function isValid(value: any): boolean;
36 export function parse(value: string): FontStyleType;
37}
38
39export namespace FontWeight {
40 export const THIN: '100';
41 export const EXTRA_LIGHT: '200';
42 export const LIGHT: '300';
43 export const NORMAL: 'normal';
44 export const MEDIUM: '500';
45 export const SEMI_BOLD: '600';
46 export const BOLD: 'bold';
47 export const EXTRA_BOLD: '800';
48 export const BLACK: '900';
49 export function isValid(value: any): boolean;
50 export function parse(value: string): FontWeightType;
51}
52
53export namespace FontVariationSettings {
54 export function parse(fontVariationSettings: string): Array<FontVariationSettingsType> | null;
55 export function toString(fontVariationSettings: Array<FontVariationSettingsType> | null): string | null;
56}
57
58export function parseFont(fontValue: string): ParsedFont;
59
60export namespace ios {
61 export function registerFont(fontFile: string);
62}