Copy to composites

RoboFont Forums Features Copy to composites

This topic contains 5 replies, has 2 voices, and was last updated by  javburg 2 years, 8 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #5962

    javburg
    Member

    Hi Frederik,

    I’m not sure if this must go here or in the bugs section, so please move it if you think it would be better there.

    One of the things in Fontlab that I found very useful was the “Copy to composites” option in the metrics window. The nice thing was that the metrics was not only brought over to the composites but it also automatically adjusted if the accent was wider than the base glyph (like ï) and it was helpful when the base glyphs metrics changed.

    I’ve been working on imported files for the last month without needing to change the metrics, but yesterday I had to make some changes and I ran into problems.

    I’ve made a test file to show what is wrong and I’m attaching screenshots to better illustrate the issue. Ok, so I made a dotless i and dieresis. When I change the metrics of the dotless i the components in the idieresis file shifts so I have to fix that. The same happens if the metrics of the dieressis is changed.

    So is there a function similar to the copy to composites of Fontlab (this would help to refresh the components and automatically adjust the metrics of the shifted components that had to be fixed) and what would fix the shifting of the components?

    Thanks!
    Jaco

    Attachments:
    You must be logged in to view attached files.
    #5969

    frederik
    Keymaster

    there is no such thing as copy to composites but it is easy to write a script that has such a behaviour

    an example:

    font = CurrentFont()
    
    # grap all the components and there references
    componentMap = font.getReverseComponentMapping()
    
    # take half of the x height
    measurePoint = font.info.xHeight * .5
    
    # loop over it
    for baseGlyphName, referenceGlyphNames in componentMap.items():
        # get the base glyph
        baseGlyph = font[baseGlyphName]
        
        # get the left and right margin based on a specific height
        left = baseGlyph.getRayLeftMargin(measurePoint)
        right = baseGlyph.getRayRightMargin(measurePoint)
        # if there is a left or right margin   
        if left and right:
            # loop over all the reference glyphs
            for name in referenceGlyphNames:
                # get the glyph
                glyph = font[name]
                # set the margins based on the same specific height
                glyph.setRayLeftMargin(measurePoint, left)
                glyph.setRayRightMargin(measurePoint, right)
    

    good luck!

    #5970

    javburg
    Member

    Thanks!

    The script works for the base glyph but it does not solve the shifting (mainly not moving in relation to each other) of components.

    I made more screenshots and numbered them to help to explain what is going wrong.
    1. This is the idieresis with measurements added. So currently the dotlessi’s metrics is 30 left and 30 right.
    2. When I change the dotlessi’s metrics to 40 left and 40 right the metrics of the idieresis does some weird things. It changes the left metric but instead of adding 10 on the right, it subtracts 10. I’ve tried this with other glyphs and the same happens. The dieresis on top stays the same as before the change in metrics.
    3. I then run the script and it fixes the metrics of the dotlessi but, now the dieresis has shifted as seen in the measurements.
    4. I’ve used an Adieresis as sample
    5. Same behaviour as in 2, left gets added, right gets subtracted.
    6. Base glyph’s metrics gets fixed, but dieresis does not change in relation to the base glyph.

    I’ve removed all my extensions to test wether one of them is at fault, but the issue is still there.

    Attachments:
    You must be logged in to view attached files.
    #5975

    javburg
    Member

    More images…

    Attachments:
    You must be logged in to view attached files.
    #6009

    javburg
    Member

    Hi Frederik,
    I’ve tested this in Robofont 1.6 and it’s still behaving the same way.
    Can you recreate this, or is it only doing this on my machine?
    Thanks,
    Jaco

    #6018

    javburg
    Member

    Hi Frederik,
    Any thoughts on how this could be corrected?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.