Relationship between left side bearing and contour coordinates (TTX/FontTools)
I was fiddling around with TTX/FontTools and noticed that if I adjust
the left side bearing of a glyph (just find that one number in the TTX
file and replace it with another number) and then recompile the font,
the glyph is indeed shifted to the left or right, but the stored
coordinates of all the contour points remain unchanged. For example, if a
glyph's leftmost point in the contour data is (100, 0) and I change the
LSB from 100 to 60, then in the resulting font, the glyph really is
displayed 40 units to the left of where it was in the original font. Yet
the contour data still has (100, 0) as the leftmost point, not (60, 0).
This is confirmed by looking at the TTX file which results from the
recompiled font.
My question is: If I want to programmatically shift glyphs like this,
should I be readjusting all the contour points as well, for consistency?
Or is that like painting the back of a cabinet that will be mounted
against a wall? Are there any ill effects from leaving the contour data
as-is while fiddling with the LSB (and advance width, as needed)?
Though I happen to be using TTX, I would think this question isn't limited to TTX. It's more generally about the font file (.ttf in my case). Or is TTX the only tool which allows such a state to occur?
Comments
-
The effect you found there is a fully valid usage of the LSB data.
In the OpenType ‘head’ table flags field there is a bit that should be set (bit 1) when LSB is equal to the minimum x coordinate for all glyphs. In your case if you modify only the LSB, you should unset that bit.
The existence of this bit probably means that there is a faster processing path in font rendering engines for the case that all LSB are set in this optimal way. As far as I know, all font editors will calculate the LSB and coordinates in this way. For OpenType variation fonts, it is even a requirement.0
Categories
- All Categories
- 43 Introductions
- 3.7K Typeface Design
- 798 Font Technology
- 1K Technique and Theory
- 617 Type Business
- 444 Type Design Critiques
- 541 Type Design Software
- 30 Punchcutting
- 136 Lettering and Calligraphy
- 83 Technique and Theory
- 53 Lettering Critiques
- 483 Typography
- 301 History of Typography
- 114 Education
- 68 Resources
- 498 Announcements
- 79 Events
- 105 Job Postings
- 148 Type Releases
- 165 Miscellaneous News
- 269 About TypeDrawers
- 53 TypeDrawers Announcements
- 116 Suggestions and Bug Reports