freetype
[Top][All Lists]
Advanced

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

[ft] how to put the character into a rect instead of the baseline corrdi


From: 宋江山
Subject: [ft] how to put the character into a rect instead of the baseline corrdinate?
Date: Thu, 15 Mar 2012 14:12:18 +0800

I have done something like that:

// set size
FT_Set_Pixel_Sizes(face, 24, 24);

// generate bitmap
 FT_Load_Char( face, 0x30, FT_LOAD_RENDER|FT_LOAD_MONOCHROME );

//draw the bitmap
RECT my_rect;
my_rect.left=100;
my_rect.top=100;
my_rect.right=100+240;
my_rect.bottom=100+24;

I have two problems:


1. how to put the text in between my_rect.top and my_rect.bottom,
meanwhile all the letters are aligned?
I find that face->glyph->bitmap_top is in baseline corrdinate.
If I use my_rect.top + 24 - face->glyph->bitmap_top as the bitmap base
y point, all the letters are aligned, but the 'g' letter will out of
my_rect.

2. what is the difference between the value of FT_Set_Pixel_Sizes
setted and face->glyph->bitmap.width and rows ?
I know face->glyph->bitmap could no be larger than FT_Set_Pixel_Sizes
setted value;
But is there any letter that face->glyph->bitmap size is equal with
the setted size?

In my situation, I use a 24x240 textout box, the pixel size is set to
24x24, but why the face->glyph->bitmap.width and rows I got is always
smaller than 20?


-- 
Best wishes,
Jiangshan

Attachment: g.bmp
Description: Windows bitmap


reply via email to

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