Reduce line height in font file

Barney Carroll's picture

I've been tasked with making modifications to a Flash application which uses an embedded custom font. The font used in the first instance has since been lost: the version we have is a slight variation which displays a greater line-height, which breaks the fixed layout in many instances.

I'm using Type light 3.2 — it seems to be the most stable free font editor available for Windows (Font Forge crashes whenever I modify the font) — to try and modify the font metrics to reduce the line height. Line Gap and Typo Line Gap were set to 200, which I reduced to 0 for each (this seemed the most obvious metric to try) in an attempt to see an immediate difference, however the new font doesn't appear any different in any software I use to render it across several lines.

There are other less obvious options: I could try reducing the various ascender and descender values, or reduce the EM unit size, but these seem overly invasive and contrived ways to get around what seems fairly conceptually simple. Am I missing something?

Té Rowan's picture

You have made sure the line spacing is not hardwired in the app?

Barney Carroll's picture

Hi Té,

It isn't. The app was actually created in an old version of Flash before it supported paragraph styles, so it's not even possible to specify the line spacing (!). After a bit more experimentation, it seems that modifying the font metrics via Type light doesn't make any practical difference to the font's rendering — perhaps these values are here purely to provide visual aids for the designer in the glyph editor?

Bob H's picture

For historical reasons, Windows and Mac obtain font-based line spacing from different tables: Mac gets it from the hhea table while Windows from the OS/2 table. See the section on Baseline to Baseline Distances in Recommendations for OpenType Fonts.

I don't know what fields Type Light 3.2 is adjusting, but perhaps it is adjusting some but not all of the relevant values.

Barney Carroll's picture

Hi Bob,

The fields in question are Line Gap and Typo Line Gap. I've since found a stable release of FontForge, if anybody's more familiar with that: this also exposes a «Has Vertical Metrics» boolean which I can tick (I thought this might cause the Line Gap or Typo Line Gap to take effect, but no dice).

I'm willing to concede that I might be going about this completely the wrong way. Maybe there's a better method of reducing the default line-height without modifying the glyphs? Any suggestions welcome.

Zuhair Albazi's picture

I hope you will find this pdf quite helpful for line-height or leading adjustment
http://kltf.de/downloads/FontMetrics-kltf.pdf

jasonc's picture

There are actually three sets of values, two in the os/2 and one in the hhea. Two of these use ascent, descent and linegap settings, while the third uses only two values (WinAscent and WinDescent). It's possible that your flash app is not using linegap information and simply using ascent+descent as the line height. In that case you'd have to modify one or all of these values.

Unfortunately I don't use FontForge, so this is as far as I can go. Sorry about that.

Jason Campbell

allanm1's picture

Regarding Type light 3.2:

As long as you have "calculate automatically" unchecked in the advanced metrics dialog, you can input your own values for all of the standard font metrics and they will be saved with your font. ie:
winascent
windescent
hhea ascender
hhea ascender
hhea line gap
typo ascender
typo descender
typo line gap

Syndicate content Syndicate content