freetype
[Top][All Lists]
Advanced

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

Re: [ft] FT_Set_Char_Size vs. FT_Set_Pixel_Sizes


From: Olumide
Subject: Re: [ft] FT_Set_Char_Size vs. FT_Set_Pixel_Sizes
Date: Tue, 22 Nov 2016 16:58:18 +0000
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.5.0

On 22/11/2016 16:28, Werner LEMBERG wrote:

I assumed the pipe symbol was the tallest glyph in the font.

In many cases it is, but you have to check of course :-)

I guess the only way to determine the tallest or widest glyph (or
the FT_Size_RequestRec parameters) is, as you said, by trial and
error.

Well, the global bounding box that includes all glyphs is
`face->bbox'.

As shown below, I've now specified the FT_Size_RequestRec based on 1/64th of pixels, as follows and I'm now getting meaningful bitmap dimensions, no larger than 32 by 32. I'm yet to look at the glyph metrics though.

FT_Size_RequestRec req = { FT_SIZE_REQUEST_TYPE_BBOX , 0 , 32 * 64 , 0 , 0 };
CHECK_STATUS( error , "Request size rec" )

FT_Request_Size( face , &req );
CHECK_STATUS( error , "Request size" )

for( BYTE i = 33; i < 127; ++i )     // Printable ASCII chars
{
        error = FT_Load_Char( face, i , FT_LOAD_RENDER | FT_LOAD_MONOCHROME );
        CHECK_STATUS( error , "Load char" )

        slot = face->glyph;
std::cout << "[Char: " << char(i) << "] Num rows: " << slot->bitmap.rows << " Width: " << slot->bitmap.width << std::endl;
}

- Olumde



reply via email to

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