In a nut shell, I swapping the name attribute in TTGlyph with another random character. Then update the HTML to reflect this change.
Example (actual use case via a random number generator):
V = "at"
A = "c.sups"
NOTE: White space characters, ligature glyphs, and compound glyphs (made up of only components) are not swapped. I also ensure any swapped glyphs are referenced in all of the cmap format tables.
Original Values:
<TTGlyph name="V" xMin="14" yMin="-10" xMax="663" yMax="669">
<mtx name="V" width="673" lsb="14"/>
<TTGlyph name="at" xMin="35" yMin="-157" xMax="805" yMax="648">
<mtx name="at" width="840" lsb="35"/>
<TTGlyph name="A" xMin="5" yMin="0" xMax="654" yMax="669">
<mtx name="A" width="664" lsb="5"/>
<TTGlyph name="c.sups" xMin="30" yMin="415" xMax="316" yMax="749">
<mtx name="c.sups" width="333" lsb="30"/>
Update Values:
<TTGlyph name="V" xMin="35" yMin="-157" xMax="805" yMax="648">
<mtx name="V" width="840" lsb="35" />
<TTGlyph name="at" xMin="14" yMin="-10" xMax="663" yMax="669">
<mtx name="at" width="673" lsb="14" />
<TTGlyph name="A" xMin="30" yMin="415" xMax="316" yMax="749">
<mtx name="A" width="333" lsb="30" />
<TTGlyph name="c.sups" xMin="5" yMin="0" xMax="654" yMax="669">
<mtx name="c.sups" width="664" lsb="5" />
NOTE: TTGlyph components and Ligature components are updated to reflect these changes.
In the HTML file:
If you wanted to display a "V", you would type "@"
If you wanted to display an "A", you would type "ᶜ"
If you combine the two: "ᶜ@", you'll notice the spacing isn't correct.
I tried updating the references in GPOS but it's not correcting the space issue.
If there any other tables which could be manipulating the character spacing?
If so, please forgive my ignorance; fonts are not my forte.
If what I'm trying to accomplish is not feasible, then by all means, please let me know. I appreciate constructive criticism and I don't bite; seriously.
No hand-holding is necessary. I just want a quick run-down on what I'm missing or should be doing.
--
You received this message because you are subscribed to the Google Groups "fonttools" group.
To unsubscribe from this group and stop receiving emails from it, send an email to fonttools+...@googlegroups.com.
To post to this group, send email to font...@googlegroups.com.
Visit this group at https://groups.google.com/group/fonttools.
For more options, visit https://groups.google.com/d/optout.
On Monday, April 22, 2019 at 8:04:36 PM UTC-4, behdad wrote:
> It feels to me like you just need to shuffle the cmap table...
>
>
That gets me 90% there for TTF font files. I still run into spacing issues. Some of the characters are displayed too close or completely overlap.
For instance, using the ttf font referenced above, replace "uni030C" (COMBINING CARON 0x30c) with "s" (LATIN SMALL LETTER S 0x73) in the cmap tables.
Now, if you type "̌ a", you would expect to see "sa". However, the "s" completely overlaps the "a"
If I also also swap the "width" and "lsb" attributes in the htmx table, the spacing gets a little better, but there's still some overlapping.
Here's the kicker. If I convert the ttf font to an otf, and then repeat the exact same steps, the the spacing is perfect!