[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Freetype] A question about rotated glyph metrics
From: |
Alexander Gelfenbain |
Subject: |
[Freetype] A question about rotated glyph metrics |
Date: |
Wed, 29 Aug 2001 19:23:37 -0700 |
User-agent: |
Mutt/1.2.5i |
A couple of questions:
I am using FreeType 1 with some software that specifies font transformation
as a 2x2 affine transform matrix [xx xy yx yy].
My code analyzes the matrix and it goes like that:
if matrix is a simple scale [n 0 0 n]
TT_Set_Instance_CharSize(n) (1)
else if matrix is an x-y scale [n 0 0 m]
TT_Set_Instance_CharSizes(n, m) (2)
TT_Set_Instance_Transform_Flags(0, 1)
else if matrix is a full affine transform
TT_Set_Instance_CharSizes(0, 0) (3)
TT_Set_Instance_Transform_Flags(1, 1)
endif
When I generate bitmap in cases (1) and (2) it is as simple
as
TT_Load_Glyph()
TT_Get_Glyph_Big_Metrics()
TT_Get_Glyph_Bitmap()
In case (3) however I do a different sequence of calls
TT_Load_Glyph()
TT_Get_Glyph_Outline()
TT_Transform_Outline()
TT_Get_Outline_BBox()
TT_Translate_Outline()
TT_Get_Outline_Bitmap()
I understand that I am most likely losing hints here. Is this correct?
Question: What are the correct load flags in case (3) ? Should I specify
TTLOAD_SCALE_GLYPH and TTLOAD_HINT_GLYPH? Or are these flags irrelevant?
Question: what is the proper way to calculate glyph metrics for a transformed
glyph? If the transformed glyph is unhinted, my guess would be to load
an unscaled glyph, convert FUnits to floating point coordinates and apply the
affine
transform to them in my code. Or should I scale the untransformed glyph with
TT_Set_Instance_CharSize(1<<6), get its metrics and apply my affine transform
to it?
I understand that TT_Get_Glyph_Big_Metrics() will only return a metrics
(sidebearings,
advance widths and height, etc.) along an untranslated vertical or horisontal
baseline. In my application a baseline is generally speaking not a vertical
or horisontal line.
Thanks!
AG
--
Alexander Gelfenbain, Sun Microsystems, Inc.
+1 (408) 635-0612
- [Freetype] A question about rotated glyph metrics,
Alexander Gelfenbain <=