freetype-devel
[Top][All Lists]
Advanced

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

Re: [Devel] A beginners question


From: Callum Prentice
Subject: Re: [Devel] A beginners question
Date: Mon, 30 Sep 2002 23:50:52 -0000 (GMT)

firstly, thank you very much vincent for taking the time to go through all of 
that -
your notes / examples helped enormously.

i now have a chunk of code which seems to work and is significantly simpler 
than before:

---------- snip ----------
FT_Library library;
FT_Init_FreeType ( &library );

FT_Face face;
FT_New_Face ( library, "c:/windows/fonts/arial.ttf", 0, &face );

FT_Set_Pixel_Sizes ( face, 64, 0 );

FT_Load_Char ( face, L'A', FT_LOAD_RENDER );

FT_GlyphSlot slot = face->glyph;

FT_Bitmap bitmap = slot->bitmap;

FT_Int rows = bitmap.rows;
FT_Int width = bitmap.width;
FT_Int pitch = bitmap.pitch;

std::wcout << L"rows = " << rows << std::endl;
std::wcout << L"width = " << width << std::endl;
std::wcout << L"pitch = " << pitch << std::endl;
---------- snip ----------

my whole reason for delving into this is to add unicode font support - 
specifically
support for japanese / chinese characters - into our application so i'll 
probably be
using solely outline fonts.  my challenges now are to:

1/ get this working with japanese / chinese characters - i've copied character 
pairs
from chinese web pages and used them in the FT_Load_Char ( face, L'¥_', 
FT_LOAD_RENDER )
call along with a chinese character font (simhei.ttf) but have had no luck.  
using an
integer value instead of a wide character - e.g. 32563 - works perfectly so i 
think i'm
missing a call - perhaps something to specifiy to encoding scheme.

2/ speed - potentially there will be a lot of text being drawn along with some 
real time
input in text entry fields for example - i'm hoping this method will be fast 
enough for
that.

many thanks again for your input.

callum.





reply via email to

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