You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When used in this font, passing index 0, font doesn't look like "Regular" but thinner.
According to FreeType documentation, I could pass in font index << 16 to get to named instance and i.e. pass 0x4000 to get to the Bold variant. So I tried passing this to PDFWriter::GetFontForFile("/Library/Fonts/NewYork.ttf", 0x4000);
Which almost worked. As it seems as correct style name/postscript name gets extracted and AAAAAB+NewYork-Bold resource gets added to generated PDF. But font looks odd or thin, (looks the same as if 0 was passed for fontIndex).
I tried to look into how it gets embedded and came to the TrueTypeEmbeddedFontWriter::WriteGlyf(const UIntVector& inSubsetGlyphIDs,std::vector<unsigned long> &inLocaTable) that from what I figured simply copies from the .ttf file glyph data without actually applying variable transformations and being able to use font properly.
I'm trying but seems way over my head so far:
I see there is code in FreeTypeFaceWrapper::GetGlyphOutline that uses FT_Outline_Decompose to extract the glyph data, and from what I understand this should already have the correct axis data set based on font index passed. And my idea is to use that somehow and write glyf data instead of copying raw data from font file, and this is where I'm stuck at the moment.
I was hoping you might have better idea/solution for the problem.
The text was updated successfully, but these errors were encountered:
I'm trying to create PDF on macOS using variable font. I.e.
New York
font downloaded from https://developer.apple.com/fonts/Once installed,
otfinfo --variable /Library/Fonts/NewYork.ttf
produces following info:When used in this font, passing index 0, font doesn't look like "Regular" but thinner.
According to FreeType documentation, I could pass in font index << 16 to get to named instance and i.e. pass 0x4000 to get to the Bold variant. So I tried passing this to PDFWriter::GetFontForFile("/Library/Fonts/NewYork.ttf", 0x4000);
Which almost worked. As it seems as correct style name/postscript name gets extracted and AAAAAB+NewYork-Bold resource gets added to generated PDF. But font looks odd or thin, (looks the same as if 0 was passed for fontIndex).
I tried to look into how it gets embedded and came to the
TrueTypeEmbeddedFontWriter::WriteGlyf(const UIntVector& inSubsetGlyphIDs,std::vector<unsigned long> &inLocaTable)
that from what I figured simply copies from the .ttf file glyph data without actually applying variable transformations and being able to use font properly.I'm trying but seems way over my head so far:
I see there is code in FreeTypeFaceWrapper::GetGlyphOutline that uses FT_Outline_Decompose to extract the glyph data, and from what I understand this should already have the correct axis data set based on font index passed. And my idea is to use that somehow and write glyf data instead of copying raw data from font file, and this is where I'm stuck at the moment.
I was hoping you might have better idea/solution for the problem.
The text was updated successfully, but these errors were encountered: