freetype
[Top][All Lists]
Advanced

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

Re: [ft] receive "correct" glyph-metrics.


From: Lawrence D'Oliveiro
Subject: Re: [ft] receive "correct" glyph-metrics.
Date: Wed, 5 Oct 2016 09:47:38 +1300

On Tue, 4 Oct 2016 17:37:03 +0200, Marcel Schneider wrote:

> now i want to receive glyph-metrics, but the values wide different
> from that of the outline-points ...

I just tried the following simple Python script:

    import sys
    import qahirah as qah
    import freetype2
    from freetype2 import \
        FT
    ft = qah.get_ft_lib()

    face = ft.find_face("Palatino")
    sys.stderr.write("Using font %s %s from %s\n" % (face.family_name, 
face.style_name, face.filename))
    face.set_char_size(size = 32, resolution = qah.base_dpi)
    glyph_index = face.get_char_index(ord("W"))
    face.load_glyph(glyph_index, FT.LOAD_DEFAULT)
    sys.stdout.write("glyph %d metrics = %s, outline bbox = %s\n" % 
(glyph_index, face.glyph.metrics, face.glyph.outline.get_bbox()))

and got the following output on my system:

    Using font URW Palladio L Roman from 
/usr/share/fonts/type1/gsfonts/p052003l.pfb
    glyph 56 metrics = {'vertBearingX': 0.0, 'horiBearingX': 0.0, 
'horiAdvance': 32.0, 'height': 22.0, 'horiBearingY': 22.0, 'vertAdvance': 0.0, 
'vertBearingY': 0.0, 'width': 31.0}, outline bbox = BBox(0.250, 0.000, 30.859, 
22.000)

As you can see, the numbers seem consistent. What numbers are you
getting?



reply via email to

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