FontLab: automatic anchors from base component

In FontLab, the Generate Glyph command creates compounds matching the anchors (top/bottom from the base, _top/_bottom from the added component). But it does not repeats any anchor in the new glyph. In other words, anchors are used to create compounds, but these compounds come without anchors.

Is there a script to automatically repeat the anchors from base component? The ideal scenario would be a script to add base anchors and let the user change its vertical position in order to enable proper diacritic stacking.

Although this is also managed by mark-to-base and mark-to-mark features, FontLab 5 does not support those. So, to adding anchors in compounds and using ccmp feature would partially workaround this limitation.

(Of course, there are Glyphs and Robofont as options, but I still do not feel comfortable with them. And FontLab VI release seems not near.)

The idea:


Comments

  • Is there a script to automatically repeat the anchors from base component? The ideal scenario would be a script to add base anchors and let the user change its vertical position in order to enable proper diacritic stacking.

    Ideally, anchors should be inherited from components, and mark components should have separate anchors. So instead of having single bottom and top anchors in the composite, as you propose, you would have the top and bottom anchors of the A component, and the top and _top anchors of the mark component. This would allow a) for intelligent stacking of arbitrary numbers of marks based on component order, and b) writing of anchors to GPOS <mark> and <mkmk> features.
  • This is how it is done in Glyphs. 
  • Vassil Kateliev
    Vassil Kateliev Posts: 56
    edited September 2016
    @Igor Freiberger here you go: 
    https://github.com/kateliev/TypeDrawers/blob/master/FetchAnchorsMM.py

    The script will do what you have proposed. Moreover:
    • it is MM capable;
    • will compensate for delta shifts (sometimes components have different placement than parents);
    • will resolve duplicate anchor names by renaming the duplicates and adding the parent's name to them
    • will shift anchors to new locations according to displacement dictionary
    • will try to stack anchors as @John Hudson suggested, but primitevely so, because i did not get his idea exactly..., but will also compensate for mark's deltas and will rename it's anchors (thus avoiding conflicts with base glyph)
    Please take a look at the customization options inside the script, or feel free to develop it further.

    Usage: Select the desired composite glyphs in the font window and run the script. It will fetch the anchors for each of the selected.
  • Igor Freiberger
    Igor Freiberger Posts: 275
    edited September 2016
    @John Hudson, I believe my English was not enough to properly report the aim. Actually, I am already doing what you described, combining anchor from base to their matching pairs in combining diacritics. What I was looking for was a way to go beyond that and also add base anchors to the result compound glyph.

    Anyway, I am grateful for your answer. As usual, kind and precise. Do you mind to share how you handle the <mark> and <mkmk> features? I mean, what tool do you use as FL5 does not support them.

    @Vassil Kateliev, thank you very much! This is exactly (and also a lot more) than I had in mind. I will take a close look at the script as you suggested so I may learn a bit of Python.