freetype
[Top][All Lists]
Advanced

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

Re: [Freetype] Y advance when a glyp is rotated.


From: David Turner
Subject: Re: [Freetype] Y advance when a glyp is rotated.
Date: Mon, 09 Sep 2002 23:33:19 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.0.0) Gecko/20020530

Hello Olivier,

Olivier Couet wrote:
 Hi All,

 I am rotating a glyph with something like:

   FT_Glyph aglyph;
   FT_GlyphSlot slot = face->glyph;
   FT_Get_Glyph ( slot, &aglyph );
   FT_Glyph_Transform( aglyph, RotMatrix, NULL );
   FT_Glyph_To_Bitmap( &aglyph, ft_render_mode_normal, 0, 1);

 It seems not to bad, each glyph is rotated. Now to draw the characters
one after each other I need the x and y advance. I have no problem for the
x advance I get it via, int(slot->metrics.horiAdvance>>6) or int(slot->advance.x>>6) both seems equivalent. But I have problems to get a proper y advance. I thought that int(slot->advance.y>>6) is what I need but it is always equal to 0 ...

 I noticed that there is also "advance" values in: aglyph->advance.x and
aglyph->advance.y. The rotation seems to have some action on these 2
values. If I have no rotation the y value is zero, and it changes when I
rotate. But the values in aglyph->advance are really weird. For instance
on the x axis the aglyph->advance.x is very different from
int(slot->advance.x >> 6 ) ... I also tried to modify aglyph->advance.x
with the >> operator but I had no success until now.

Some body have an idea about that ?


When you create a glyph with FT_Get_Glyph, its advance vector
is copied in glyph->advance as a 16.16 fixed-point vector. Each
subsequent call to FT_Glyph_Transform also transforms the advance
vector; you thus should be able to use it.

The reason why 16.16 coordinates are used is to keep a reasonable
precision even in the case of transforms like rotations, indeed.


Regards,

- David Turner
- The FreeType Project  (www.freetype.org)






reply via email to

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