| 115 | } |
| 116 | |
| 117 | function 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 | |
| 148 | export namespace ios { |
| 149 | export function registerFont(fontFile: string) { |