MCPcopy Index your code
hub / github.com/NativeScript/NativeScript / getNativeFontWeight

Function getNativeFontWeight

packages/core/ui/styling/font.ios.ts:117–146  ·  view source on GitHub ↗
(fontWeight: FontWeightType)

Source from the content-addressed store, hash-verified

115}
116
117function getNativeFontWeight(fontWeight: FontWeightType): number {
118 const value = typeof fontWeight === 'number' ? fontWeight + '' : fontWeight;
119
120 switch (value) {
121 case FontWeight.THIN:
122 return UIFontWeightUltraLight;
123 case FontWeight.EXTRA_LIGHT:
124 return UIFontWeightThin;
125 case FontWeight.LIGHT:
126 return UIFontWeightLight;
127 case FontWeight.NORMAL:
128 case '400':
129 case undefined:
130 case null:
131 return UIFontWeightRegular;
132 case FontWeight.MEDIUM:
133 return UIFontWeightMedium;
134 case FontWeight.SEMI_BOLD:
135 return UIFontWeightSemibold;
136 case FontWeight.BOLD:
137 case '700':
138 return UIFontWeightBold;
139 case FontWeight.EXTRA_BOLD:
140 return UIFontWeightHeavy;
141 case FontWeight.BLACK:
142 return UIFontWeightBlack;
143 default:
144 console.log(`Invalid font weight: "${fontWeight}"`);
145 }
146}
147
148export namespace ios {
149 export function registerFont(fontFile: string) {

Callers 1

getUIFontMethod · 0.85

Calls 1

logMethod · 0.45

Tested by

no test coverage detected