views:

157

answers:

1

When using a custom font via @font-face, it does render just as I think it should in Chrome. In Firefox, though, additional padding (top and bottom) is added to the font.

Here is my example page that outlines the problem.

Is there anything I can do about it?

+1  A: 

FYI, this also happens in Firefox on Linux (and not in Chromium). I tried to load your font in FontForge and immediately got a warning:

The following table(s) in the font have been ignored by FontForge
Ignoring 'LTSH' linear threshold table
Ignoring 'VDMX' vertical device metrics table
Ignoring 'hdmx' horizontal device metrics table

I think the problem is that the VDMX (Vertical Device Metrics) table is defect:

In order to avoid grid fitting the entire font to determine the correct height, the VDMX table has been defined.

This looks exactly like what happens in Firefox: somewhere the minimum and maximum height is incorrectly calculated. This is also clear when you select the text: the selection box extends to the utmost top and bottom of the line; if the h1 element really had padding, you would see a gap between the top and bottom of the line and the selection box.

Also, validation revealed that almost every glyph is “missing points at extrema”:

Both PostScript and TrueType would like you to have points at the maxima and minima (the extrema) of a path.

A quick search showed:

The only other problem I had was a rather nasty condition called "Missing Points at Extrema". With a font, there needs to be a point (or node, as they are called in Inkscape) at the extreme left, right, top and bottom of a glyph. Normally they are there anyway simply because of the way your glyph is built, but diagonal lines with rounded ends often cause problems [source, including picture (scroll down)]

Marcel Korpel
Thanks for a very good answer! I'm also using GNU/Linux. I don't know how it looks in other systems. However, how can I add this missing piece of information to the font? As Chrome actually guesses right, there should be enough information in the font making it quite easy to define. But how?
Johan
@Johan – I'm not sure. If the font's EULA permits, you can try to edit the font with FontForge yourself and see if this helps. I'm not a FontForge expert though, my answer is merely an educated guess.
Marcel Korpel
Anyway, your answer is too good to not be accepted. I tried to load and save it in fontforge and then it looks equal in FF and Chrome. Both render it like FF did from start. There are tons and tons of parameters in fontforge. I'll play with them for a while, then I will give up. :)
Johan
@Johan – Good luck. And please let me know (by posting a comment here) when you succeed.
Marcel Korpel