freetype
[Top][All Lists]
Advanced

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

[ft] Problem rendering V and Y less than 12 pixel text


From: Antonio Bigi
Subject: [ft] Problem rendering V and Y less than 12 pixel text
Date: Wed, 18 Jan 2012 16:33:56 +0100

Hi all,
I'm using freetype2 on an embedded device. When I run my application on device with 7-inch display all the glyphos are rendered fine (as shown in the image above).

test-on-7-inch.png

https://docs.google.com/open?id=0B49ffoLIUA2YODVjNjFmZDItZjg2Yy00ODZkLTg2MTQtNWFhOTVhZDY2Yjkw



If I run the same application on a device with 9-inch or 12-inch display some glyphos (V, v, Y and y) are not rendered correctly. As shown in the image above.

text-with-problem.png

https://docs.google.com/open?id=0B49ffoLIUA2YZDkwMTAzNmEtYTEyMy00MDVjLThmNTgtMzY4ZTRiYTJhMGEw 


7-inch and 9-inch display has 135 DPI, while 12-inch display has 96 DPI.
The size of the text is set using FT_Set_Pixel_Sizes(fHandler->face, 0, fontH);

In the image above I colored in red the whole canvas and in yellow the bitmap glyph area.


text-with-problem-boundary.png
https://docs.google.com/open?id=0B49ffoLIUA2YNzU0NTBiNjktNDAzMC00OWUzLThlZDYtN2E5NTRhZTUxZjBl

I get the bitmap using the following code:

error = FT_Load_Char(fHandler->face, c, loadFlag);
if (error)
return -1;

FT_GlyphSlot bitmapGlyph = fHandler->face->glyph;
FT_Bitmap& bitmap = bitmapGlyph->bitmap;


Do you have any suggestions on how to resolve this problem?


I approach a dirty solution forcing autohint during load of V and Y characters

if (fontH<12 && strlen(text)==1 && (text[0]=='V'||text[0]=='v' || text[0]=='y'||text[0]=='Y')){
loadFlag |= FT_LOAD_FORCE_AUTOHINT;
}

v-j-autohint.png

https://docs.google.com/open?id=0B49ffoLIUA2YZGY0MDU4NWEtZDZmMC00MGI0LThlNDQtNzQxYTBiZjdkM2Rh

It works on 12-inch display but I think this solution is too specific and dirty to avoid that other problems appear in the future on other display models.
Using always autohint flag the quality of rendering became poor.

Thanks,
Antonio




reply via email to

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