RE: [ft-devel] Determining the size of space character

2006-08-22 Thread Ivan Tarapov
Russel, 

I got freetype from CVS - there were some differences from the 2.2.1 version
I am using, but the problem with calculation of CBox for space character is
not fixed.

Basically the code is like this:

error = FT_Load_Glyph(face, curchar, FT_LOAD_DEFAULT);
.
error = FT_Get_Glyph(face-glyph, glyph);

the result is success for space character (curchar=3)

FT_Glyph_Transform(glyph, 0, pos);

FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_pixels, bbox);

From FT_Glyph_Get_CBox the function FT_Outline_Get_CBox( glyph-outline,
bbox ); is called

Inside this function the check is made 

if ( outline-n_points == 0 )

Naturally, the check fails for space char, because it doesn't have any
n_points as far as I recon. Maybe the routine for determining the size of
space character us different?



 -Original Message-
 From: [EMAIL PROTECTED]
 [mailto:[EMAIL PROTECTED] On Behalf
 Of Russell Shaw
 Sent: Tuesday, August 22, 2006 6:02 AM
 Cc: freetype-devel@nongnu.org
 Subject: Re: [ft-devel] Determining the size of space character
 
 Ivan Tarapov wrote:
  Hello,
 
  I am involved in a project that uses FLTK+microwindows on a linux-based
  system. We use freetype 2.2.1 for rendering of ttf fonts. I have been
  struggling for a long time to get it to determine the size in pixels of
  the passed string correctly. What I dug up is this:
 
  Microwindows ultimately calls FT_Glyph_Get_CBox to determine the CBox
  for the character and calculates its size accordingly. It doesn't work
  for space character. The CBox for space character turns out to be filled
  with zeroes, hence wrong pixelsize for the string. FT_Glyph_Get_CBox in
  its turn calls ft_outline_glyph_bbox which issues a call to
  FT_Outline_Get_CBox which does the calculations. However the
  calculations are based on the outline-n_points field, which is zero for
  the space character. This seems like a bug to me. Or maybe there is a
  workaround for this?
 
 There was a bug in 2.2.1 to do with space characters that is fixed in cvs.
 Try freetype from cvs.
 
 
 ___
 Freetype-devel mailing list
 Freetype-devel@nongnu.org
 http://lists.nongnu.org/mailman/listinfo/freetype-devel



___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


RE: [ft-devel] Determining the size of space character

2006-08-22 Thread Ivan Tarapov
I tried with different .ttf fonts - tahoma, arial, comic, bold fonts - the
result was the same. When I try to call the code that measures the string
size, FT_Outline_Get_CBox returns zeroes for space character. Hence the
width of the string is calculated incorrectly - without taking spaces into
account.

Ivan

 -Original Message-
 From: Werner LEMBERG [mailto:[EMAIL PROTECTED]
 Sent: Tuesday, August 22, 2006 8:28 AM
 To: [EMAIL PROTECTED]
 Cc: freetype-devel@nongnu.org
 Subject: Re: [ft-devel] Determining the size of space character
 
 
  I have been struggling for a long time to get it to determine the
  size in pixels of the passed string correctly.
 
  Microwindows ultimately calls FT_Glyph_Get_CBox to determine the
  CBox for the character and calculates its size accordingly. It
  doesn't work for space character. The CBox for space character turns
  out to be filled with zeroes, hence wrong pixelsize for the
  string. FT_Glyph_Get_CBox in its turn calls ft_outline_glyph_bbox
  which issues a call to FT_Outline_Get_CBox which does the
  calculations.  However the calculations are based on the
  outline-n_points field, which is zero for the space character. This
  seems like a bug to me.  Or maybe there is a workaround for this?
 
 Please give an example (say, with, verdana or tahoma) and describe
 what you expect.
 
 
  Werner



___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


Re: [ft-devel] Determining the size of space character

2006-08-22 Thread Russell Shaw

Ivan Tarapov wrote:
Russel, 


I got freetype from CVS - there were some differences from the 2.2.1 version
I am using, but the problem with calculation of CBox for space character is
not fixed.

Basically the code is like this:

error = FT_Load_Glyph(face, curchar, FT_LOAD_DEFAULT);
.
error = FT_Get_Glyph(face-glyph, glyph);

the result is success for space character (curchar=3)

FT_Glyph_Transform(glyph, 0, pos);

FT_Glyph_Get_CBox(glyph, ft_glyph_bbox_pixels, bbox);


From FT_Glyph_Get_CBox the function FT_Outline_Get_CBox( glyph-outline,

bbox ); is called

Inside this function the check is made 


if ( outline-n_points == 0 )

Naturally, the check fails for space char, because it doesn't have any
n_points as far as I recon. Maybe the routine for determining the size of
space character us different?


Hi,
The control-box probably isn't the right way to determine the glyph sizes.

I use face-size-metrics (FT_Size_Metrics) for scaleable fonts. I haven't got
around to working with bitmap fonts yet.

If you use FT_Glyph_Transform, hinting information is lost IIRC.


___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel


[ft-devel] Determining the size of space character

2006-08-21 Thread Ivan Tarapov








Hello,



I am involved in a project that uses
FLTK+microwindows on a linux-based system. We use freetype 2.2.1 for rendering
of ttf fonts. I have been struggling for a long time to get it to determine the
size in pixels of the passed string correctly. What I dug up is this:



Microwindows ultimately calls FT_Glyph_Get_CBox to
determine the CBox for the character and calculates its size accordingly. It
doesnt work for space character. The CBox for space character turns out
to be filled with zeroes, hence wrong pixelsize for the string. FT_Glyph_Get_CBox in
its turn calls ft_outline_glyph_bbox
which issues a call to FT_Outline_Get_CBox which
does the calculations. However the calculations are based on the outline-n_points field,
which is zero for the space character. This seems like a bug to me. Or maybe there
is a workaround for this?



Sincerely,

Ivan






___
Freetype-devel mailing list
Freetype-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/freetype-devel