|
3 | 3 | import hashStyle from '../../utils/hashStyle'; |
4 | 4 | import { TextStyle } from '../../types'; |
5 | 5 | import { FONT_STYLES } from '../textLayers'; |
6 | | -import { APPLE_BROKEN_SYSTEM_FONT } from '../../utils/constants'; |
7 | 6 |
|
8 | 7 | // this borrows heavily from react-native's RCTFont class |
9 | 8 | // thanks y'all |
@@ -100,10 +99,8 @@ export const findFont = (style: TextStyle): NSFont => { |
100 | 99 | let fontWeight = style.fontWeight |
101 | 100 | ? FONT_WEIGHTS[style.fontWeight.toLowerCase()] |
102 | 101 | : defaultFontWeight; |
103 | | - // Default to Helvetica if fonts are missing |
104 | | - // Must use two equals (==) for compatibility with Cocoascript |
105 | | - // eslint-disable-next-line eqeqeq |
106 | | - let familyName = defaultFontFamily == APPLE_BROKEN_SYSTEM_FONT ? 'Helvetica' : defaultFontFamily; |
| 102 | + |
| 103 | + let familyName = defaultFontFamily; |
107 | 104 | let isItalic = false; |
108 | 105 | let isCondensed = false; |
109 | 106 |
|
@@ -156,7 +153,6 @@ export const findFont = (style: TextStyle): NSFont => { |
156 | 153 | isItalic = style.fontStyle ? isItalic : isItalicFont(font); |
157 | 154 | isCondensed = isCondensedFont(font); |
158 | 155 | } else { |
159 | | - console.log(`Unrecognized font family '${familyName}'`); |
160 | 156 | font = NSFont.systemFontOfSize_weight(fontSize, fontWeight); |
161 | 157 | } |
162 | 158 |
|
@@ -198,7 +194,7 @@ export const findFont = (style: TextStyle): NSFont => { |
198 | 194 | return font; |
199 | 195 | }; |
200 | 196 |
|
201 | | -export default function findFontName(style: TextStyle) { |
| 197 | +export default function findFontName(style: TextStyle): string { |
202 | 198 | const font = findFont(style); |
203 | 199 | return font.fontDescriptor().postscriptName(); |
204 | 200 | } |
0 commit comments