kerningvalidator


Namekerningvalidator JSON
Version 0.1.1.post3 PyPI version JSON
download
home_pagehttps://github.com/yanone/kerningvalidator
Summary
upload_time2022-12-12 08:27:28
maintainer
docs_urlNone
authorYanone
requires_python
licenseapache-2.0
keywords fonts
VCS
bugtrack_url
requirements glyphsLib vharfbuzz
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:
```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
1. This tool currently only consumes `.glyphs` sources, no UFOs
1. The kerning comparisons are currently limited to encoded glyphs only
1. 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
1. There are currently no unit tests for this tool
1. 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/*`

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/yanone/kerningvalidator",
    "name": "kerningvalidator",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "fonts",
    "author": "Yanone",
    "author_email": "post@yanone.de",
    "download_url": "https://files.pythonhosted.org/packages/e9/1e/3ea47a6a232df710075fc33842fcaae427d8dca0d935e5076945c6a0bf6e/kerningvalidator-0.1.1.post3.tar.gz",
    "platform": null,
    "description": "# Kerning Validator\n\nCompares kerning defined in `.glyphs` source with kerning defined in binary font.\n\nIt reads all kerning pairs of all masters of a Variable Font from the `.glyphs` source\nand shapes the pairs using the binary font with `vharfbuzz`, once with and once without \nkerning enabled, then compares the two values.\n\nTo catch absolutely all kerning, it gathers all unicodes associated with a kerning class\nand cross-checks all possible combinations. This is necessary because members of a kerning class\nmay be part of different writing scripts and may or may not be included in the font based on their script.\n\nThe shaped kerning is lazily read from the `vharfbuzz` buffer through the `x` value of `buf.glyph_positions`\nby simply comparing the highest `x` value of each composition.\n\n## Invocation\n\nFrom the command line:\n\n`kerningvalidator font.glyphs font.ttf`\n\nFrom within Python:\n```python\nfrom kerningvalidator import missing_kerning\n\n# Get missing kerning\nmissing_kerning = missing_kerning(\"font.glyphs\", \"font.ttf\")\n\n# Success means en ampty list\nassert len(missing_kerning) == 0\n```\n\n## Limitations\n\n1. This tool was written with Variable Fonts in mind that contain both `LTR` and `RTL` kerning pairs\n1. This tool currently only consumes `.glyphs` sources, no UFOs\n1. The kerning comparisons are currently limited to encoded glyphs only\n1. 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\n1. There are currently no unit tests for this tool\n1. It takes forever for a large font\n\n\n## Package\n\nTo create a new package, install twine via `pip install twine`, then `cd` to `Lib/` and then:\n\n* `python3 setup.py sdist`\n* `twine upload dist/*`\n",
    "bugtrack_url": null,
    "license": "apache-2.0",
    "summary": "",
    "version": "0.1.1.post3",
    "split_keywords": [
        "fonts"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "43b43ca6dca6793fee7e2d0fb6646609",
                "sha256": "f170fcf458237f000ef003978396b192ae9bcb2e03004bed0f2a5ce769d9b99c"
            },
            "downloads": -1,
            "filename": "kerningvalidator-0.1.1.post3.tar.gz",
            "has_sig": false,
            "md5_digest": "43b43ca6dca6793fee7e2d0fb6646609",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 8715,
            "upload_time": "2022-12-12T08:27:28",
            "upload_time_iso_8601": "2022-12-12T08:27:28.391590Z",
            "url": "https://files.pythonhosted.org/packages/e9/1e/3ea47a6a232df710075fc33842fcaae427d8dca0d935e5076945c6a0bf6e/kerningvalidator-0.1.1.post3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-12-12 08:27:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "yanone",
    "github_project": "kerningvalidator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "glyphsLib",
            "specs": []
        },
        {
            "name": "vharfbuzz",
            "specs": []
        }
    ],
    "lcname": "kerningvalidator"
}
        
Elapsed time: 0.01957s