UNPKG

2.63 kBTypeScriptView Raw
1import { Font as FontDefinition } from './font';
2import { ParsedFont, FontStyleType, FontWeightType, FontVariationSettingsType } from './font-interfaces';
3export declare abstract class Font implements FontDefinition {
4 readonly fontFamily: string;
5 readonly fontSize: number;
6 readonly fontVariationSettings?: Array<FontVariationSettingsType>;
7 static default: any;
8 readonly fontStyle: FontStyleType;
9 readonly fontWeight: FontWeightType;
10 readonly fontScale: number;
11 get isItalic(): boolean;
12 get isBold(): boolean;
13 protected constructor(fontFamily: string, fontSize: number, fontStyle?: FontStyleType, fontWeight?: FontWeightType, fontScale?: number, fontVariationSettings?: Array<FontVariationSettingsType>);
14 abstract getAndroidTypeface(): any;
15 abstract getUIFont(defaultFont: any): any;
16 abstract withFontFamily(family: string): Font;
17 abstract withFontStyle(style: FontStyleType): Font;
18 abstract withFontWeight(weight: FontWeightType): Font;
19 abstract withFontSize(size: number): Font;
20 abstract withFontScale(scale: number): Font;
21 abstract withFontVariationSettings(variationSettings: FontVariationSettingsType[]): Font;
22 static equals(value1: Font, value2: Font): boolean;
23}
24export declare namespace FontStyle {
25 const NORMAL = "normal";
26 const ITALIC = "italic";
27 const isValid: (value: any) => value is FontStyleType;
28 const parse: (value: any) => FontStyleType;
29}
30export declare namespace FontWeight {
31 const THIN = "100";
32 const EXTRA_LIGHT = "200";
33 const LIGHT = "300";
34 const NORMAL = "normal";
35 const MEDIUM = "500";
36 const SEMI_BOLD = "600";
37 const BOLD = "bold";
38 const EXTRA_BOLD = "800";
39 const BLACK = "900";
40 const isValid: (value: any) => value is FontWeightType;
41 const parse: (value: any) => FontWeightType;
42}
43export declare namespace FontVariationSettings {
44 function parse(fontVariationSettings: string): Array<FontVariationSettingsType> | null;
45 function toString(fontVariationSettings: FontVariationSettingsType[] | null): string | null;
46}
47export declare function parseFontFamily(value: string): Array<string>;
48export declare namespace genericFontFamilies {
49 const serif = "serif";
50 const sansSerif = "sans-serif";
51 const monospace = "monospace";
52 const system = "system";
53}
54export declare function parseFont(fontValue: string): ParsedFont;
55/**
56 * Kind of hack.
57 * Used to search font variation axis names, since iOS for some reason requires names
58 * but tags are the standards.
59 */
60export declare function fuzzySearch(query: string, dataset: string[]): string[] | null;