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...

Slot = face-> glyph;/* a small shortcut */

/* Set up matrix */
Matrix. xx = (FT_Fixed) (cos (angle) * 0x0000l );
Matrix. xy = (FT_Fixed) (-sin (angle) * 0x0000l );
Matrix. yx = (FT_Fixed) (sin (angle) * 0x0000l );
Matrix. yy = (FT_Fixed) (cos (angle) * 0x0000l );

/* 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!

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.