Giter Club home page Giter Club logo

Comments (10)

rougier avatar rougier commented on June 6, 2024

Do you know if Fira has actual kerning information ?

from freetype-py.

tayloraswift avatar tayloraswift commented on June 6, 2024

Yes, it does

from freetype-py.

rougier avatar rougier commented on June 6, 2024

Ok, I will try to investigate using same method as the bbox

from freetype-py.

rougier avatar rougier commented on June 6, 2024

From the script below, I get some flags but none for the kerning. Maybe kerning is present but freetype does not advertise it (and in this case, there is not much we can do).

import freetype
face = freetype.Face('FiraSans-Book.ttf')

print("Scalable:         ", bool(face.face_flags & freetype.FT_FACE_FLAG_SCALABLE))
print("Fixed sizes:      ", bool(face.face_flags & freetype.FT_FACE_FLAG_FIXED_SIZES))
print("Fixed width:      ", bool(face.face_flags & freetype.FT_FACE_FLAG_FIXED_WIDTH))
print("SFNT:             ", bool(face.face_flags & freetype.FT_FACE_FLAG_SFNT))
print("Horizontal:       ", bool(face.face_flags & freetype.FT_FACE_FLAG_HORIZONTAL))
print("Vertical:         ", bool(face.face_flags & freetype.FT_FACE_FLAG_VERTICAL))
print("Kerning:          ", bool(face.face_flags & freetype.FT_FACE_FLAG_KERNING))
print("Fast glyphs:      ", bool(face.face_flags & freetype.FT_FACE_FLAG_FAST_GLYPHS))
print("Multiple masters: ", bool(face.face_flags & freetype.FT_FACE_FLAG_MULTIPLE_MASTERS))
print("Glyph names:      ", bool(face.face_flags & freetype.FT_FACE_FLAG_GLYPH_NAMES))
print("External stream:  ", bool(face.face_flags & freetype.FT_FACE_FLAG_EXTERNAL_STREAM))
print("Hinter:           ", bool(face.face_flags & freetype.FT_FACE_FLAG_HINTER))
print("CID Keyed:        ", bool(face.face_flags & freetype.FT_FACE_FLAG_CID_KEYED))
print("Tricky:           ", bool(face.face_flags & freetype.FT_FACE_FLAG_TRICKY))
Scalable:          True
Fixed sizes:       False
Fixed width:       False
SFNT:              True
Horizontal:        True
Vertical:          False
Kerning:           False
Fast glyphs:       False
Multiple masters:  False
Glyph names:       True
External stream:   False
Hinter:            True
CID Keyed:         False
Tricky:            False

from freetype-py.

rougier avatar rougier commented on June 6, 2024

Also, from freetype documentation:

Not all font formats contain kerning information, and not all kerning formats are supported by FreeType; in particular, for TrueType fonts, the API can only access kerning via the ‘kern’ table. OpenType kerning via the ‘GPOS’ table is not supported! You need a higher-level library like HarfBuzz, Pango, or ICU, since GPOS kerning requires contextual string handling.

from freetype-py.

tayloraswift avatar tayloraswift commented on June 6, 2024

Fira, like the vast majority of modern fonts only has GPOS kerning and no ttf “kern” table. So that would explain it. But how can freetype lack such a thing? It sounds pretty essential

from freetype-py.

rougier avatar rougier commented on June 6, 2024

It is essential and can become pretty complex for some languages . I imagine this is the reason why freetype doesn't handle it outside the kern table. You'll have to use HarfBuzz or pango.

from freetype-py.

tayloraswift avatar tayloraswift commented on June 6, 2024

is it possible for freetype to just return the opentype kerning table itself so I can read latin kern pairs off of it?

from freetype-py.

rougier avatar rougier commented on June 6, 2024

I don't know. You should ask on the freetype mailing list.

from freetype-py.

tayloraswift avatar tayloraswift commented on June 6, 2024

ugh so the FAQ says Well, the engine already reads OpenType/CFF files perfectly. What it doesn't do is handling ‘OpenType Layout’ tables.

from freetype-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.