Skip to content

Commit c7771d6

Browse files
committed
Default to the system font if none provided
1 parent 723e44d commit c7771d6

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/jsonUtils/sketchImpl/findFontName.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,8 @@ export const findFont = (style: TextStyle): NSFont => {
100100
let fontWeight = style.fontWeight
101101
? FONT_WEIGHTS[style.fontWeight.toLowerCase()]
102102
: 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;
103+
104+
let familyName = defaultFontFamily;
107105
let isItalic = false;
108106
let isCondensed = false;
109107

@@ -156,7 +154,6 @@ export const findFont = (style: TextStyle): NSFont => {
156154
isItalic = style.fontStyle ? isItalic : isItalicFont(font);
157155
isCondensed = isCondensedFont(font);
158156
} else {
159-
console.log(`Unrecognized font family '${familyName}'`);
160157
font = NSFont.systemFontOfSize_weight(fontSize, fontWeight);
161158
}
162159

@@ -198,7 +195,7 @@ export const findFont = (style: TextStyle): NSFont => {
198195
return font;
199196
};
200197

201-
export default function findFontName(style: TextStyle) {
198+
export default function findFontName(style: TextStyle): string {
202199
const font = findFont(style);
203200
return font.fontDescriptor().postscriptName();
204201
}

0 commit comments

Comments
 (0)