Coder Social home page Coder Social logo

kerningvalidator's Introduction

Kerning Validator

Compares kerning defined in .glyphs source with kerning defined in binary font.

It reads all kerning pairs of all masters of a Variable Font from the .glyphs source and shapes the pairs using the binary font with vharfbuzz, once with and once without kerning enabled, then compares the two values.

To catch absolutely all kerning, it gathers all unicodes associated with a kerning class and cross-checks all possible combinations. This is necessary because members of a kerning class may be part of different writing scripts and may or may not be included in the font based on their script.

The shaped kerning is lazily read from the vharfbuzz buffer through the x value of buf.glyph_positions by simply comparing the highest x value of each composition.

Invocation

From the command line:

kerningvalidator font.glyphs font.ttf

From within Python:

from kerningvalidator import missing_kerning

# Get missing kerning
missing_kerning = missing_kerning("font.glyphs", "font.ttf")

# Success means en ampty list
assert len(missing_kerning) == 0

Limitations

  1. This tool was written with Variable Fonts in mind that contain both LTR and RTL kerning pairs
  2. This tool currently only consumes .glyphs sources, no UFOs
  3. The kerning comparisons are currently limited to encoded glyphs only
  4. The vharfbuzz shaping has shown a difference of up to 1 font unit compared to the kerning defined in the .glyphs source. The tool therefore allows for 1 unit difference
  5. There are currently no unit tests for this tool
  6. It takes forever for a large font

Package

To create a new package, install twine via pip install twine, then cd to Lib/ and then:

  • python3 setup.py sdist
  • twine upload dist/*

kerningvalidator's People

Contributors

yanone avatar

Stargazers

Stefan Huber avatar Andreas Nymark avatar Christoph Koeberlin avatar

Watchers

 avatar

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.