We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
this line of code override previous value (say 377 for a specific case) to NaN
377
NaN
Skip if it is NaN and give previous value default value
Write NaN anyway
Maybe sth like this?
if (!Number.isNaN(width)) { glyph.advanceWidth = width } if (Number.isNaN(glyph.advanceWidth)) { glyph.advanceWidth = fonts.unitsPerEm }
export function makeSubFont(font: opentype.Font, content: string) { return new opentype.Font({ familyName: font.names.fontFamily.en, styleName: font.names.fontSubfamily.en, unitsPerEm: font.unitsPerEm, ascender: font.ascender, descender: font.descender, glyphs: font.stringToGlyphs(Array.from(new Set(content.split(''))).join('')), }) }
advanceWidth
glyph
getPath
FYI: An example of the content used in step 2 is 上与乡互他伊作全公制前包单司客工布带开括旅晓朗机村棒游环球的相着离程管糖网罕联至蕾视足踏迹遍频颗高︐︒﹁﹂
content
上与乡互他伊作全公制前包单司客工布带开括旅晓朗机村棒游环球的相着离程管糖网罕联至蕾视足踏迹遍频颗高︐︒﹁﹂
SourceHanSans-Regular.otf.zip
The text was updated successfully, but these errors were encountered:
It seems to be lack of 0 glyph. I changed the makeSubFont function to this, and the problem disappears.
0
makeSubFont
export function makeSubFont(font: opentype.Font, content: string) { const glyphs = font.stringToGlyphs(Array.from(new Set(content.split(''))).join('')) glyphs.unshift(font.glyphs.get(0)) return new opentype.Font({ familyName: font.names.fontFamily.en, styleName: font.names.fontSubfamily.en, unitsPerEm: font.unitsPerEm, ascender: font.ascender, descender: font.descender, glyphs, }) }
Sorry, something went wrong.
Connum
No branches or pull requests
this line of code override previous value (say
377
for a specific case) toNaN
Expected Behavior
Skip if it is NaN and give previous value default value
Current Behavior
Write
NaN
anywayPossible Solution
Maybe sth like this?
Steps to Reproduce (for bugs)
advanceWidth
fromglyph
at this stage, it is correct.getPath
andadvanceWidth
becomesNaN
FYI:
An example of the
content
used in step 2 is上与乡互他伊作全公制前包单司客工布带开括旅晓朗机村棒游环球的相着离程管糖网罕联至蕾视足踏迹遍频颗高︐︒﹁﹂
Context
Your Environment
SourceHanSans-Regular.otf.zip
The text was updated successfully, but these errors were encountered: