Skip to content

Commit

Permalink
Fix text rendering error when font-family has punctuation. (#353)
Browse files Browse the repository at this point in the history
* Fix text rendering error when font-family has punctuation.

* Update build_web.yml
  • Loading branch information
zenoslin committed Jun 2, 2022
1 parent d2fe29c commit 16e815a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
path: |
third_party
vendor_tools
web/node_node_modules
key: third_party-web-${{ hashFiles('DEPS') }}-${{ hashFiles('vendor.json') }}
restore-keys: third_party-web-

Expand All @@ -78,4 +79,4 @@ jobs:
run: |
cd web/script
chmod +x build.sh
./build.sh debug
./build.sh
10 changes: 5 additions & 5 deletions web/src/utils/font-family.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ export const getFontFamilies = (name: string, style = ''): string[] => {
}
const fontFamilies = names.reduce((pre: string[], cur: string) => {
if (!style) {
pre.push(`${cur}`);
pre.push(`"${cur}"`);
} else {
pre.push(`${cur} ${style}`);
pre.push(`${cur}-${style}`);
pre.push(`"${cur} ${style}"`);
pre.push(`"${cur}-${style}"`);
}
return pre;
}, []);
// Fallback font when style is not found.
if (style !== '') {
fontFamilies.push(name);
}
fontFamilies.push(`"${name}"`);
}
return fontFamilies;
};

0 comments on commit 16e815a

Please sign in to comment.