File tree Expand file tree Collapse file tree 2 files changed +15
-27
lines changed
Expand file tree Collapse file tree 2 files changed +15
-27
lines changed Original file line number Diff line number Diff line change @@ -10,16 +10,26 @@ import { APPLE_BROKEN_SYSTEM_FONT } from '../../utils/constants';
1010// https://github.com/facebook/react-native/blob/master/React/Views/RCTFont.mm
1111
1212const FONT_WEIGHTS = {
13- normal : 0 ,
14- bold : 0.4 ,
13+ ultralight : - 0.8 ,
1514 '100' : - 0.8 ,
15+ thin : - 0.6 ,
1616 '200' : - 0.6 ,
17+ light : - 0.4 ,
1718 '300' : - 0.4 ,
19+ normal : 0 ,
20+ regular : 0 ,
1821 '400' : 0 ,
22+ semibold : 0.23 ,
23+ demibold : 0.23 ,
1924 '500' : 0.23 ,
2025 '600' : 0.3 ,
26+ bold : 0.4 ,
2127 '700' : 0.4 ,
28+ extrabold : 0.56 ,
29+ ultrabold : 0.56 ,
30+ heavy : 0.56 ,
2231 '800' : 0.56 ,
32+ black : 0.62 ,
2333 '900' : 0.62 ,
2434} ;
2535
@@ -87,7 +97,9 @@ export const findFont = (style: TextStyle): NSFont => {
8797 const defaultFontSize = 14 ;
8898
8999 const fontSize = style . fontSize ? style . fontSize : defaultFontSize ;
90- let fontWeight = style . fontWeight ? FONT_WEIGHTS [ style . fontWeight ] : defaultFontWeight ;
100+ let fontWeight = style . fontWeight
101+ ? FONT_WEIGHTS [ style . fontWeight . toLowerCase ( ) ]
102+ : defaultFontWeight ;
91103 // Default to Helvetica if fonts are missing
92104 // Must use two equals (==) for compatibility with Cocoascript
93105 // eslint-disable-next-line eqeqeq
Original file line number Diff line number Diff line change @@ -50,30 +50,6 @@ export const FONT_STYLES = {
5050 oblique : true ,
5151} ;
5252
53- export const FONT_WEIGHTS = {
54- normal : 'Regular' ,
55- ultralight : 'UltraLight' ,
56- thin : 'Thin' ,
57- light : 'Light' ,
58- regular : 'Regular' ,
59- medium : 'Medium' ,
60- semibold : 'Semibold' ,
61- demibold : 'Semibold' ,
62- extrabold : 'Heavy' ,
63- bold : 'Bold' ,
64- heavy : 'Heavy' ,
65- black : 'Black' ,
66- '100' : 'UltraLight' ,
67- '200' : 'Thin' ,
68- '300' : 'Light' ,
69- '400' : 'Regular' ,
70- '500' : 'Medium' ,
71- '600' : 'Semibold' ,
72- '700' : 'Bold' ,
73- '800' : 'Heavy' ,
74- '900' : 'Black' ,
75- } ;
76-
7753const makeFontDescriptor = ( style : TextStyle ) : FileFormat . FontDescriptor => ( {
7854 _class : 'fontDescriptor' ,
7955 attributes : {
You can’t perform that action at this time.
0 commit comments