[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [ft] Drawing chinese text with FreeType on OpenGL
From: |
Erik Möller |
Subject: |
RE: [ft] Drawing chinese text with FreeType on OpenGL |
Date: |
Thu, 12 Mar 2009 17:20:42 +0100 |
Hi Stanley,
I think if you want some help from this list the easiest way is to write a
minimal app that loads a font, draws a glyph and then dumps it to a TGA. You
should be able to accomplish that in less than 100 lines of code and you
might even find that you work it out yourself while doing that little
exercise... if not I'll be happy to compile it and see if I can figure out
what's going wrong... not that I'm an expert on the topic or know a single
Chinese character for that matter :)
If you're not familiar with dumping to a TGA you can copy-paste some code
from this example: http://freetype.org/freetype2/docs/tutorial/example2.cpp
Cheers,
Erik Möller,
Timetrap
http://www.timetrap.se
http://www.emberwind.se
-----Original Message-----
From: address@hidden
[mailto:address@hidden On Behalf Of googoo
Sent: den 12 mars 2009 05:22
To: address@hidden
Subject: Re: [ft] Drawing chinese text with FreeType on OpenGL
//Load the Glyph for our character.
//if(FT_Load_Glyph( face, FT_Get_Char_Index( face, ch ),
FT_LOAD_DEFAULT ))
if(FT_Load_Glyph( face, FT_Get_Char_Index( face, 49896 ),
FT_LOAD_DEFAULT
))
throw std::runtime_error("FT_Load_Glyph failed");
//Move the face's glyph into a Glyph object.
FT_Glyph glyph;
if(FT_Get_Glyph( face->glyph, &glyph ))
throw std::runtime_error("FT_Get_Glyph failed");
//Convert the glyph to a bitmap.
FT_Glyph_To_Bitmap( &glyph, ft_render_mode_normal, 0, 1 );
FT_BitmapGlyph bitmap_glyph = (FT_BitmapGlyph)glyph;
//This reference will make accessing the bitmap easier
FT_Bitmap& bitmap=bitmap_glyph->bitmap;
everything was fine with the above code, but when i draw it on opengl
screen, all i see is a square/rectangle
Werner LEMBERG wrote:
>
>
>> I am using simhei.ttf. I tried to use the unicode charmap but all i
>> see is a square on my screen.
>
> Use ftstring from the ft2demos bundle as a template -- this program
> supports UTF8 encoded input strings.
>
>
> Werner
>
>
> _______________________________________________
> Freetype mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/freetype
>
>
--
View this message in context:
http://www.nabble.com/Drawing-chinese-text-with-FreeType-on-OpenGL-tp2239601
8p22469680.html
Sent from the Freetype - User mailing list archive at Nabble.com.
_______________________________________________
Freetype mailing list
address@hidden
http://lists.nongnu.org/mailman/listinfo/freetype
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3930 (20090312) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3931 (20090312) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com