freetype-devel
[Top][All Lists]
Advanced

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

how can I set exactly pixel?


From: xiaoliang.sheng
Subject: how can I set exactly pixel?
Date: Tue, 24 Dec 2019 07:34:57 +0000

Hello, developers

       I am currently working on a Thai text synthesis project which used freetype. My code is as follows( I’m using the font:“angsa.ttf” ):

           if (FT_Set_Pixel_Sizes(face, charWidth, charDotSize) !=0)

    {

        return (ERROR);

    }

   

    ascender = FT_MulFix(face->ascender, face->size->metrics.y_scale);

    descender = FT_MulFix(face->descender, face->size->metrics.y_scale);

   

    fontHeight =  (UI_16)ceil( (DOUBLE)(ascender - descender) / 64 );

 

I have some questions. Assume that I need render one character to byte array with fixed size, in correct position. Character size must be exactly size that fits in output bitmap, no clipping allowed.

I specified character width=height=100. But when I calculate the font height, it’s 117.

 

How should I set height to get exactly 100px output, not 117, for any normal font? If it isn't possible, then is there any way to calculate output character height exactly in pixels before FT_Render_Glyph.

 

Best Regards!


reply via email to

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