UNSOLVED Issue with Underline Position value



  • Hello all,

    I have an issue with a custom underline position value.

    I set underline position in the font info at -180. Otf exported with Batch extension changes this value to -40, otf exported with Export Font changes the value to -140.

    I tried in safe mode, and on another ufo but the issue remains. Any ideas on how to fix this ?

    Thank you!


  • admin



  • @frederik I have Version 3.4 (build 2004281315)


  • admin

    @RoxaneGataud what is your RoboFont version?



  • Hey @gferreira,

    Thank you for your help! I tried running the script but unfortunately I get the same result as before :

    -180
    -140
    

    What can I do ?



  • hello @RoxaneGataud,

    I’ve tried to reproduce the issue using the script below, but I’m getting the correct values. generating from the menu also works fine.

    from fontTools.ttLib import TTFont
    
    ufoPath = '/myFolder/myFont.ufo'
    otfPath = ufoPath.replace('.ufo', '_test-underline.otf')
    
    # set underline value in UFO and generate otf
    f = OpenFont(ufoPath, showInterface=False)
    f.info.postscriptUnderlinePosition = -180
    f.generate("otfcff", otfPath)
    f.close()
    
    # check underline value in otf with fontTools
    with TTFont(otfPath) as f:
        print(f["post"].underlinePosition)
        # print(f["CFF "].cff[0].rawDict['UnderlinePosition'])
    
    # double-check value by opening the otf as UFO
    f = OpenFont(otfPath, showInterface=False)
    print(f.info.postscriptUnderlinePosition)
    
    -180
    -180
    

    can you please try this script with your font, and let us know if it works?

    thanks!


Log in to reply