Skip to content

Line spacing is wider on Windows than on Linux #7

@sgtatham

Description

@sgtatham

Using the release archive AnnotationMono_v0.2.zip, file dist/ttf/Regular.ttf in that archive, if I install the font on a Windows machine I see a much wider line spacing than I do if I install it on Linux.

I've had this problem with a font of my own recently, so I know something about why it happens (although not how it got that way in the first place). Running ttfdump Regular.ttf and paging through the output, you can see three pairs of ascent/descent metrics in the font. The Linux and Windows font rendering stacks make different choices about which of those metrics to trust, so if they disagree with each other, you get inconsistent behaviour.

One pair of vertical metrics is in the hhea table:

         yAscender:              800
         yDescender:             -200

The other two pairs are both in the OS/2 table:

         sTypoAscender:          800
         sTypoDescender:         -200
         usWinAscent:            1150
         usWinDescent:           250

That last pair of metrics, usWinAscent and usWinDescent, are the ones that Windows uses, and you can see that in this font they don't agree with the previous two. If those metrics were set to 800 and 200, the line spacing would look the same on Windows as everywhere else. (In fact I confirmed that by hex-editing the font file and trying again.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions