freetype
[Top][All Lists]
Advanced

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

Re: [ft] font size confusion (NOMINAL & REAL_DIM)


From: milky jing
Subject: Re: [ft] font size confusion (NOMINAL & REAL_DIM)
Date: Sun, 4 Mar 2012 19:10:14 +0800

Thanks Werner :-)

Your algorithm works fine.

I also have some other issues about font size, but I think I'd better try to solve them first util I really need help. :-P

p.s. Sorry to reply late.

Regards,
Albert


On Fri, Mar 2, 2012 at 5:10 PM, Werner LEMBERG <address@hidden> wrote:

As the documentation describes, the scaling value of `nominal' is the
units per EM, and the scaling value of `real dim' is the sum of the
ascender and the descender (since descender has negative values if
below the baseline, it's actually a subtraction):

 scaling_nominal = face->units_per_EM
 scaling_realdim = face->ascender - face->descender

Remember, these values are *scaling values*.  Consequently, to
transform from one scaling framework to another, simply compute the
quotient and use it as a factor.

Using arial (version 5.06), I get

 face->ascender  = 1854
 face->descender = -434
 units per EM    = 2048

This gives

      1854 + 434
 f = ------------ = 1.11719...
        2048

In your example, the `real dim' font size is 40, thus the `nominal'
font size is

 40 / 1.11719 = 35.804...

which rounds to 36, as you've deduced by experimentation.

It would be great if you could provide a patch to enhance the
documentation in case you consider it as necessary.


   Werner


reply via email to

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