freetype-devel
[Top][All Lists]
Advanced

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

[ft-devel] Problems with horiAdvance


From: Albert Torras
Subject: [ft-devel] Problems with horiAdvance
Date: Mon, 4 Dec 2006 20:52:55 +0100

Hi,

I work with freetype 2.1.10 crosscompiled for ARM and it works quite fine.

However, I have some problems with horiAdvance... It happens that sometimes the face->glyph->metrics.width is a higher value than face->glyph->metrics.horiAdvance,
and it produces the overlapping of strings, because I increment the pen position according to the value of horiAdvance.

I can't understand why this happens.

An example of the code used is pasted below:

	// 90º clockwise rotation
	matrix.xx = (FT_Fixed) ( 0 * 0x10000L);
	matrix.xy = (FT_Fixed) ( 1 * 0x10000L);
	matrix.yx = (FT_Fixed) ( -1 * 0x10000L);
	matrix.yy = (FT_Fixed) ( 0 * 0x10000L);
	// Loop
	for (n=0; n < strlen(text); n++) {

		FT_Set_Transform(face, &matrix, &pen);
	
		/* retrieve glyph index from character code */  
		glyph_index = FT_Get_Char_Index( face, text[n] );

		/* load glyph image into the slot (erase previous one) */ 
		FT_Load_Glyph( face, glyph_index, FT_LOAD_DEFAULT );

		/* convert to an anti-aliased bitmap */ 
		FT_Render_Glyph( face->glyph, FT_RENDER_MODE_NORMAL );
		printf("\nWidth: %d     Advance: %d
\n",face->glyph->metrics.width,face->glyph->metrics.horiAdvance);

	}


And here are some of the results I get from printf...

Width: 576 Advance: 576 OK!
Width: 640 Advance: 576 Not OK
Width: 576 Advance: 512 Not OK
Width: 192 Advance: 256 OK
Width: 576 Advance: 512 Not OK


Does anybody know why??

Thanks a lot for your help.
Albert


reply via email to

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