freetype
[Top][All Lists]
Advanced

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

Re: [ft] In freetype how can one set font size in pt, but keep resolutio


From: Werner LEMBERG
Subject: Re: [ft] In freetype how can one set font size in pt, but keep resolution independent?
Date: Wed, 17 May 2006 23:43:32 +0200 (CEST)

> What I was trying exactly to do (without knowing if it was actually
> possible) is given, say some fontsize in pts (points)(represented by
> a float), using UNSCALED (so freetype gives me design font units)
> and somehow scaling them (to correspond to my fontsize, but not be
> based on any particular resolution) After reading more into the
> documentation (and your reply seems to confirm what i've been
> reading) if I want fontsize independent of resolution, I basically
> have to pick one of the "design font sizes that come in a certain
> font file" and there is no explict ability to "scale" things
> upwards. (I guess picking certain bitmap strikes is all that can be
> possible if using UNSCALED and thus getting back design font units,
> or would that be a no, and I've screwed my logic somewhere?)

Well, the very problem is that neither TrueType nor PS fonts have the
concept of a `design size'.  This is something from the TeX world.

The outlines within a font are stored in font units; it is common that
1em equals to 1000 font units in PS fonts, and to 2048 in TTFs.
Similarly, the advance width values are stored in font units.  You can
actually extract this value in font units: Use the field
`linearHoriAdvance' in FT_GlyphSlot and load the glyph with
FT_LOAD_LINEAR_DESIGN.

If you use bitmap strikes, you are entering the device-dependent arena
since strikes are always defined for a given point size/dpi pair
(which is equal to using a given size in pixels).


    Werner




reply via email to

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