|
From: | Sharath Jagannath |
Subject: | [ft] help |
Date: | Wed, 25 Jul 2007 18:37:46 +0530 |
Hi, I try to extract the bitmap of a character (single). Every
time I specify the same Height for the character entered but the bitmap
contains different height for different Character. I need them to be same since I use the
bitmap as lookup table in my program. Can anybody suggest the way to do it. I’m
very new to freetype (using freetype2). Help required Urgently. Code I use is, /*
Initialize the free type library */ error
= FT_Set_Char_Size (face, /* Handle
to face object */
width * 64, /* char_width in 1/64th of points */
height * 64, /* char_height in 1/64th of points */
72, /* horizontal device
resolution */
72); /* vertical device
resolution */
//FT_Set_Pixel_Sizes (face,width,height); /*
Get the Glyph Index */ /*
Index is used to load the glyph image from the glyph table */ index
= FT_Get_Char_Index(face, /* Handle
to the face object */
char_code); /* Character code ,
Using Single Character*/ /*
Loading the glyph image to the slot */ error
= FT_Load_Glyph
(face,
/* Handle to the face object */
index, /*
index to glyph table */
FT_LOAD_DEFAULT); /* load flag */ if
( error ) return
FONT_FAILURE; slot
= face->glyph; /*
Convert glyph image to bitmap */ error
=
FT_Render_Glyph(slot,
/* glyph slot */ FT_RENDER_MODE_NORMAL);
/* Rendering mode */ if
( error ) return
FONT_FAILURE; /*
output variables */ *bmp_width
= face->glyph->bitmap.width; *bmp_hght
= face->glyph->bitmap.rows; buf_size
= (*bmp_width) * (*bmp_hght); /*“I need the Bitmap’s Height to be constant
for all characters” */ memcpy
(bitmap,face->glyph->bitmap.buffer,buf_size); FT_Done_Face
( face ); FT_Done_FreeType(
library ); Thanks, Sharath ********************************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify address@hidden **********************************************************************
|
[Prev in Thread] | Current Thread | [Next in Thread] |