When using FT_LOAD_TARGET_LCD, the size of the rendered bitmap doesn't seem
to match the size in the metrics. It's usually off by 1~2 units - is this
normal?

Example:

#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_LCD_FILTER_H

int main()
{
    FT_Library _library;
    FT_Init_FreeType(&_library);
    FT_Library_SetLcdFilter(_library, FT_LCD_FILTER_DEFAULT);

    FT_Face face;
    FT_New_Face(_library, "arial.ttf", 0, &face);
    FT_Set_Pixel_Sizes(face, 0, 14);

    FT_Int32 flags = 0;
    flags |= FT_LOAD_TARGET_LCD;
    flags |= FT_LOAD_RENDER;

    string sample =
"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

    for(char c : sample)
    {
        FT_Load_Char(face, (int)c, flags);
        cout << (face->glyph->bitmap.width / 3) << " ==? ";
        cout << (face->glyph->metrics.width >> 6) << endl;
    }

    FT_Done_Face(face);
    return 0;
}

Any help with this would be appreciated

   Nick
_______________________________________________
Freetype-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to