Skip to content
New issue

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

Merge chars font with last-resort font #1573

Closed
dy opened this issue Nov 1, 2022 · 2 comments
Closed

Merge chars font with last-resort font #1573

dy opened this issue Nov 1, 2022 · 2 comments

Comments

@dy
Copy link
Contributor

dy commented Nov 1, 2022

I'm trying to merge wavefont over AdobeBlank2 to make wavefont last-resort font, mapping any chars out of range to blank.

mergefonts wavefont.full.otf wavefont.otf AdobeBlank2VF.otf
mergefonts: (cfw) unhinted <.notdef>
mergefonts: (cfw) glyph skipped - same name, different charstring as glyph in font <.notdef>

But the resutling font is seemingly corrupted:
image

I wonder if that use-case is something the program is capable of?
Do I have to specify glyph map maybe?

If that's impossible with mergefonts - I'd like to ask for advice what would be the good way to make such filling all chars with blanks?
I tried reproducing method from Adobe Blank - patching the tables, but I don't understand where the binary chunks for cmap/gsub are coming from and how to properly modify them / regenerate for wavefont with changed subranges.
That doesn't seem to be possible via feature-file, does it?

Thanks for any help...

@punchcutter
Copy link
Contributor

punchcutter commented Nov 6, 2022

I don't think mergefonts is the right tool for this at the moment. It sounds like it should do what you want, but it could use some updates for variable fonts for sure. There are other tools like fontTools merge which are more up to date with this kind of merging, but I tried that and it also failed. AdobeBlank is an unusual font in the first place so that's probably part of the issue. However, it's really a simple font. The binary GSUB and cmap don't really matter. There's nothing in the GSUB and the cmap is just scripted to point every codepoint to the single glyph. I did a quick test that I think does what you want.

ttx -t cmap wavefont.otf
ttx -t cmap AdobeBlank2VF.otf

The AdobeBlank cmap will point to uni0000 for everything, but you want to use what's in wavefont already so replace all uni0000 with _0 . Then copy the entries from the wavefont cmap format 4 and paste them at the very end of the AdobeBlank cmap format 13.

Then run

ttx -m wavefont.otf updated-cmap.ttx and you should have a format 13 where everything points to _0 except for what you want mapped to the wavefont glyphs.

@dy
Copy link
Contributor Author

dy commented Dec 1, 2022

Implemented that method in wavefont by just generating cmap format13 table from scratch and replacing it during the build.
Works perfectly.

That was helpful, many thanks!

@dy dy closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants