Hi,

I can't find in FreeType's docs on how to calculate the line gap,
currently we are using:

    FT_Size_Metrics metrics = face->size->metrics;
    leading = (metrics.height - metrics.ascender + metrics.descender) >> 64;

but sometimes I get -1 as the leading (Lucida Grande from Mac OS X, Ubuntu
fonts, Inconsolata, DejaVu Sans). Is it fine to have negative leading? or
is there anything wrong with my code? Thanks.

Attached my code to test.

- Jiang
#include <ft2build.h>
#include FT_FREETYPE_H

int main(int argc, char *argv[])
{
    FT_Library library;
    FT_Face face;
    FT_Init_FreeType(&library);
    FT_New_Face(library, argv[1], 0, &face);
    FT_Set_Char_Size(face, 0, 12 * 64, 72, 72);
    FT_Size_Metrics metrics = face->size->metrics;

    printf("%ld, %ld - %ld + %ld\n", 
            (metrics.height - metrics.ascender + metrics.descender) >> 6, 
            metrics.height >> 6, metrics.ascender >> 6, metrics.descender >> 6);
    return 0;
}
_______________________________________________
Freetype-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/freetype-devel

Reply via email to