[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Devel] Bug in ah_hinter_load_glyph
From: |
Maarten Breddels |
Subject: |
[Devel] Bug in ah_hinter_load_glyph |
Date: |
Sat, 27 Mar 2004 16:04:17 +0100 |
Hi, I believe I've found a bug in freetype (in 2.1.7 and current cvs
version).
It happens when loading some characters, with a transform matrix
(1,0,0,-1).
I don't know the exact reason, but it's around line 1813 in ahhint.c,
FT_Pos fitted = FT_PIX_ROUND( scaled );
Sometimes, fitted becomes 0, making y_scale, on line 1820
y_scale = FT_MulDiv( y_scale, fitted, scaled );
Also 0.
Which means the character metrics, outlines etc are all height 0.
The code below demonstrates the bug. Also, when loading the glyph again,
with another matrix, the bug is still there, I guess it's caused by
caching.
----begin------
#include <ft2build.h>
#include FT_FREETYPE_H
int main()
{
FT_Library ft_library;
FT_Face face;
FT_Matrix mat;
FT_Init_FreeType (&ft_library);
FT_New_Face (ft_library, "e:\\windows\\fonts\\arial.ttf", 0, &face);
if(face == NULL)
{
printf("font file not found\n");
}
mat.xx = 1<<16;
mat.xy = 0;
mat.yx = 0;
mat.yy = (FT_Fixed)(-1.0 * 65536.0);
FT_Set_Char_Size(face, 40<<6, 40<<6, 0, 0);
FT_Set_Transform(face, &mat, NULL);
FT_Load_Glyph (face, FT_Get_Char_Index (face, 'C'),
FT_LOAD_DEFAULT);
printf("height = %i units\n", face->glyph->metrics.height);
mat.xx = 1<<16;
mat.xy = 0;
mat.yx = 0;
mat.yy = (FT_Fixed)(1.0 * 65536.0);
FT_Set_Char_Size(face, 40<<6, 40<<6, 0, 0);
FT_Set_Transform(face, &mat, NULL);
FT_Load_Glyph (face, FT_Get_Char_Index (face, 'C'),
FT_LOAD_DEFAULT);
printf("height = %i units\n", face->glyph->metrics.height);
return 0;
}
-----end-------
Output:
height = 0 units
height = 0 units
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Devel] Bug in ah_hinter_load_glyph,
Maarten Breddels <=