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

Missing vhea, vmtx and VORG tables #67

Closed
justvanrossum opened this issue Dec 23, 2019 · 8 comments · Fixed by #107
Closed

Missing vhea, vmtx and VORG tables #67

justvanrossum opened this issue Dec 23, 2019 · 8 comments · Fixed by #107

Comments

@justvanrossum
Copy link
Collaborator

justvanrossum commented Dec 23, 2019

When doing vertical layout using harfbuzz, I notice that the vertical advances are all the same (1000). Vertical kerning works, but the vertical spacing is too wide, and uneven for glyphs that have accents.

image

Is this to be expected?

This should be fixable by adding vhea, vmtx and VORG tables. Maybe a 2020 update would be a nice project? @davelab6? 😊

@djrrb
Copy link
Owner

djrrb commented Dec 24, 2019

Thanks for the message, @justvanrossum!

No, this is not to be expected. :-)

The vertical spacing information is included in the vpal features, which is the way I found that worked with Adobe Illustrator’s vertical type tool. Here’s the intended appearance:

Screen Shot 2019-12-23 at 10 52 25 PM

(Note that the final line in Bungee shade is set with an Opaque white Regular layer to manage the Aring overlap...the hollow counters issue in the basic Shade is kind of a separate unresolved issue)

Do you happen to know why the vpal feature would be recognized by Illustrator but not by harfbuzz?

If you believe that vhea, vmtx, and VORG tables are a better solution, do you have an implementation of these tables that you could recommend I use as an exemplar? Thanks again!

@justvanrossum
Copy link
Collaborator Author

Ahh, turning on vpal fixes it. It seems vpal is off by default in harfbuzz (as is vkrn).

But yes, I think it would be better if the vertical advances (and origins) are the right ones to begin with, instead of having them "touched up" by vpal. (The way I read the vpal description is that its main use is for CJK fonts, which by default are vertically monospaced, but can have optional proportional behavior via vpal. I don't think this should be optional for Bungee.)

UFO3 supports these settings (with http://unifiedfontobject.org/versions/ufo3/glyphs/glif/#advance and the public.verticalOrigin lib key), and I'm fairly sure fontmake will generate vhea,vmtx and VORG if they're used. Not sure about RF, but I doubt it.

How to conveniently edit them is another story, but given you have all the necessary information available in vpal, it should be possible to convert this to advance height + vertical origin info.

@justvanrossum
Copy link
Collaborator Author

(Btw. VORG is only needed for otf, for ttf vmtx is enough, where the top-sidebearing will imply the vertical origin, using the yMax value of the bounding box.)

@justvanrossum
Copy link
Collaborator Author

justvanrossum commented Dec 24, 2019

One more thing: only the otfs work correctly with harfbuzz (when turning on vpal), but not the ttfs. With ttf it seems to line up all glyphs by their bounding boxes, whereas with otf it seems to take the (typo)ascender value as the vertical reference. That seems inconsistent and arbitrary, but I don't think it's well specified what should happen in the absence of vhea and vmtx.

image

@justvanrossum
Copy link
Collaborator Author

justvanrossum commented Dec 24, 2019

I made a messy little script that takes your vpal.fea file, a source ttf or otf, and adds vhea, vmtx and VORG tables to the font.

I have attached the result of running this on Bungee-Regular.ttf from the Bungee_Basic folder. And the script itself, which contains hard-coded paths, so needs tweaking before you can run it.

The resulting ttf behaves perfectly with harfbuzz, without the need for vpal, and works identical to the (unchanged) otf version with vpal on.

image

Bungee-Regular-vmtx.ttf.zip
add_vmtx.py.zip

@justvanrossum
Copy link
Collaborator Author

I just checked the spec: VORG should only be added for CFF-based otf.

@djrrb
Copy link
Owner

djrrb commented Dec 25, 2019

Just, you are the best! 🙌

Thanks so much for putting together this script so I can see how the tables are supposed to look.

I’ll be happy to integrate the contents of this script into the build process so that the work is done by the vhea, vmtx and VORG tables (VORG for CFF only) instead of the vpal feature.

Leaving this issue open until I get around to it...

@justvanrossum
Copy link
Collaborator Author

justvanrossum commented Dec 25, 2019

No problem! Ideally your vpal data should be incorporated into the source UFOs as glyph.height and glyph.lib["public.verticalOrigin"] values. But if you wait long enough, maybe you can use unified-font-object/ufo-spec#95 :)

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

Successfully merging a pull request may close this issue.

2 participants