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: Olivier Couet
Subject: Re: [Freetype] Y advance when a glyp is rotated.
Date: Tue, 10 Sep 2002 12:05:06 +0200 (CEST)

 Hi David,

 Thanks for the info.       

 Olivier


On Mon, 9 Sep 2002, David Turner wrote:

> 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)
> 
> 
> 
> 
> _______________________________________________
> Freetype mailing list
> address@hidden
> http://www.freetype.org/mailman/listinfo/freetype
> 




reply via email to

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