freetype
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ft] Drawing underline and strikethrough


From: Werner LEMBERG
Subject: Re: [ft] Drawing underline and strikethrough
Date: Thu, 15 Feb 2018 23:28:48 +0100 (CET)

> I've been working with freetype recently and tried using the metrics
> on the font face to get information about underline position and
> thickness.  Using those I've run into an odd issue. No matter how
> big the font, the thickness and position is always the same.

Are you talking about the fields `underline_position' and
`underline_thickness' in `FT_Face'?  The documentation clearly states
that those values are in *font units*.  This means that you have to
scale them manually to the desired size (in pixels).

> I've also noticed that there is no fixed underline position in the
> metrics.  Reusing the underline thickness for strikethrough should
> be fine, but I'm not aware of any method to get strikethrough
> position.  Is there a standardized way to calculate strikethrough
> position?

Only TTFs and OTFs offer this value in the `OS/2' table, cf. fields
`yStrikeoutSize' and `yStrikeoutPosition' in struct `TT_OS2'.  Again,
you have to manually scale those values to the desired font size.  For
other font formats you have to compute those values by yourself.


    Werner



reply via email to

[Prev in Thread] Current Thread [Next in Thread]