How to Use freetype in linux to implement text rendering and display
Source: Internet
Author: User
On the linux platform, how to use freetype to implement text rendering and display-Linux general technology-Linux technology and application information? For details, refer to the following. FT_GlyphSlot slot;
FT_Matrix matrix;/* transformation matrix */
FT_UInt glyph_index;
FT_Vector pen;/* untransformed origin */
Int n;
... Initialize library...
... Create face object...
... Set character size...
/* The pen position in 26.6 cartesian space coordinates */
/* Start at (300,200 )*/
Pen. x = 300*64;
Pen. y = (my_target_height-200) * 64;
For (n = 0; n <num_chars; n ++)
{
/* Set transformation */
FT_Set_Transform (face, & matrix, & pen );
/* Load glyph image into the slot (erase previous one )*/
Error = FT_Load_Char (face, text [n], FT_LOAD_RENDER );
If (error)
Continue;/* ignore errors */
/* Now, draw to our target surface (convert position )*/
My_draw_bitmap (& slot-> bitmap,
Slot-> bitmap_left,
My_target_height-slot-> bitmap_top );
/* Increment pen position */
Pen. x + = slot-> advance. x;
Pen. y + = slot-> advance. y;
}
I don't understand how this works.
My_draw_bitmap (& slot-> bitmap,
Slot-> bitmap_left,
My_target_height-slot-> bitmap_top );
How can I display it on the screen! Thank you! I haven't understood it for several days!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service