Skip to main content

Work out how far apart things should be (very quickly)

Project description

Kern determiner

Work out how far apart things should be (very quickly)

kerndeterminer is a Rust-based library for determining a kern value between two glyphs of a font source file.

(Don't use it for Latin kerning; it won't work. But it works fine for many other scripts)

Given a font, two glyphs, and a target distance (and a few other parameters), kerndeterminer will return the kern value which places the contours of the two glyphs the given distance apart at their closest point. The graphic below explains the main parameters and the effect of kerndeterminer:

parameters.png

How to use

First, create a KernDeterminer object. This loads the font, since you'll probably be making quite a few calls to determine_kern and won't want to load the font each time:

from kerndeterminer import KernDeterminer

kerner = KernDeterminer("MyFont.glyphs")

The font source can be any source loadable by the Rust version of Babelfont (currently Glyphs version 3 files, UFO, and Designspace files).

Next, call the determine_kern method on that object:

kern = kerner.determine_kern(
    "JIMi10",  # Left glyph
    "REu1",    # Right glyph
    "Regular", # Master name
    120,       # Target distance
    200,       # Height
    0.8,       # Max tuck
)

This will return the optimal kerning value for that pair at the given parameters. Note:

  • The height parameter is used to translate the left glyph vertically befor kerning. This is used in Arabic fonts with cursive attachment.
  • The max_tuck parameter is a ratio of the left glyph's width which forms an upper limit on the kerning value. For example, if max_tuck is 0.5, the leftmost point on the right glyph can only be placed so that it is 50% of the way underneath the left glyph:

maxtuck.png

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kerndeterminer-0.0.1.tar.gz (199.2 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kerndeterminer-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

kerndeterminer-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

kerndeterminer-0.0.1-cp310-cp310-macosx_11_0_arm64.whl (1.2 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

kerndeterminer-0.0.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.9 MB view details)

Uploaded CPython 3.10macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

kerndeterminer-0.0.1-cp310-cp310-macosx_10_7_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 10.7+ x86-64

kerndeterminer-0.0.1-cp39-none-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.9Windows x86-64

kerndeterminer-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

kerndeterminer-0.0.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.9 MB view details)

Uploaded CPython 3.9macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

kerndeterminer-0.0.1-cp39-cp39-macosx_10_7_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9macOS 10.7+ x86-64

kerndeterminer-0.0.1-cp38-none-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.8Windows x86-64

kerndeterminer-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.17+ x86-64

kerndeterminer-0.0.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl (2.9 MB view details)

Uploaded CPython 3.8macOS 10.9+ universal2 (ARM64, x86-64)macOS 10.9+ x86-64macOS 11.0+ ARM64

kerndeterminer-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8macOS 10.7+ x86-64

kerndeterminer-0.0.1-cp37-none-win_amd64.whl (1.3 MB view details)

Uploaded CPython 3.7Windows x86-64

kerndeterminer-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.17+ x86-64

kerndeterminer-0.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (2.5 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.17+ x86-64

File details

Details for the file kerndeterminer-0.0.1.tar.gz.

File metadata

  • Download URL: kerndeterminer-0.0.1.tar.gz
  • Upload date:
  • Size: 199.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/0.13.5

File hashes

Hashes for kerndeterminer-0.0.1.tar.gz
Algorithm Hash digest
SHA256 acafd1a95331720d969a02dfc8778d8d8b52258e391fdb5c35121a7d4bdb21f9
MD5 d0334d80a24a12efe094eded64d7eead
BLAKE2b-256 33d1be01d922be4f393c0a9415858dae9d1589d9fdf120d1d9999a028b899ae7

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 4d3009b7b6f56a8a53eb344649dcab0729ff8293ea66fe0d94c7d3374f4a29d2
MD5 64c043aa8deb813cec485dcb20b95175
BLAKE2b-256 7a05a78e55be11c0a1eaf09157be4b8ae3e533e29145935657ea45276fefbdb5

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 0da1086f454c8c4b3f3fafaf737159333cfe3ca9ee988aba8b765938f6f68500
MD5 6aae954e63e7f093a2b6d7d94798f58d
BLAKE2b-256 11e94e40a617a6a20645c492b7228d507fcc088501dc6c4f8e02ad47978137cf

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ca7442e9d65676bdf64ee124bb3db465cf1f966510b2d87cb2f7a66c18127998
MD5 3f7582412704daf67b9665a6e93234d4
BLAKE2b-256 f67e07d0d30bb8ca60289bb4a94561976836abb94749f1ccd3873bf606c17084

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp310-cp310-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 5e25c15301d5ab9a070b9b5422c5bb5760708322717fba0f1dd77fe55aff9b16
MD5 05788eb7803c781834e737f6a134c24c
BLAKE2b-256 99a8cef693bef710315b1db99097a9eebde2a0c22205131c54b43dab4bf9c380

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp310-cp310-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.10, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 3ecec3b9214f483af3e6d32d511824f5513959c482c1cb0b068a6fcb1630b858
MD5 c8a0c86000c0f9a39dc24d53d696810e
BLAKE2b-256 8fbefb5bd3e60e3d0e7fd6a9a87d9805926ae6a8651360bca470a5b5b185b7bd

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp39-none-win_amd64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp39-none-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp39-none-win_amd64.whl
Algorithm Hash digest
SHA256 45a56b3b071d5388ea5ea0fcd0ef71cf9ca0d844217b291e812dbd22d8587996
MD5 14a4ced71a53686f2487228019f89111
BLAKE2b-256 3200e142eb02ce847d8e971918fadae328f6d941e1c75cdf7c0e2cecd2b1ec7c

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 a109b6fe6cb001a8b25f0e308a5998fd5ddae288a6fbc4a9b2b146b1fdbbbffd
MD5 d2914b67808257a6b44859fe5b2be5d2
BLAKE2b-256 1772f709bb9d9e76cd057b3062bf4b4f4101fdaa144be71ddc94cc56d5072395

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp39-cp39-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 fd4fbc7b0289787a3235d8719072a7693763cc6434d2d51e40b9e757091d3805
MD5 be25b72c671013775b5d32932d660941
BLAKE2b-256 fb518df37aedb62272fefbf6ecc2224188dd2cf71af3d2aa82a8247c575b3dad

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp39-cp39-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.9, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 646490c7929edc686327af105f7539e084b6ac81b3bc79ac3db4a207f3cac627
MD5 6b20bdda79e8d21d7ce516261d4cb932
BLAKE2b-256 3a5d0b49557367a874c7ccce73c84285ceba88c99ab8dcc3a770fe78c9e8b378

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp38-none-win_amd64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp38-none-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp38-none-win_amd64.whl
Algorithm Hash digest
SHA256 ef5f33dbd1a7be963b328a7f33c2c2cc5b337e312e91235f70e2b8804fc391db
MD5 90bcf3722b350d7890c415a4cb58f03a
BLAKE2b-256 01fa3b916db104021af3eaf2402d8be12804166236c94daef1dc45d4c8d0d810

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 c3231602bf7114e6151b0a02d84db18337e5e903c6a59a6cca7ec29356ae18f9
MD5 7ddff44144370da8648c82971ed4a970
BLAKE2b-256 7ef2c6bd34659e7255ddfc0a337241abb2bc69e8600448e58e2d08a7db2dac42

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp38-cp38-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl
Algorithm Hash digest
SHA256 fbd26c3228207f587585be961b494f24e7389b334b0dd59504b317d54e983f12
MD5 036c26823e3ecec55fd1fe4e19d78bd4
BLAKE2b-256 42b3ace52661132790838d79fb0edf5fe9d1b2213f372d7d20532d774682c9a9

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl
  • Upload date:
  • Size: 1.5 MB
  • Tags: CPython 3.8, macOS 10.7+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp38-cp38-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 7126d5c40e3500149a330e9aebac5c69c85ee8a93b0409baec2258a328900819
MD5 b026d8e392d6a7d02b70053a58d4f8f7
BLAKE2b-256 e9cef218ef3249abbcbc532b93bddb995f179a5f128e1ce91bde944412dffef5

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp37-none-win_amd64.whl.

File metadata

  • Download URL: kerndeterminer-0.0.1-cp37-none-win_amd64.whl
  • Upload date:
  • Size: 1.3 MB
  • Tags: CPython 3.7, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.15

File hashes

Hashes for kerndeterminer-0.0.1-cp37-none-win_amd64.whl
Algorithm Hash digest
SHA256 f4cdaef1eeb1f3d8bbd9a171ec0c27bdebbbee77631bda647f629f776fb19b50
MD5 284593d99c6b704b2921568830961df2
BLAKE2b-256 c37afec58fa4c7cfebf5f7b7521ee31f1c72221bf608f19577112d921a0f1510

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8e7666a584f8f8987c8fae536af01c18aecc6e72994f5883ac1700fe5a513a38
MD5 d9e0aa3c81c369de1262e1896a56074c
BLAKE2b-256 6c70444bcd140664e561d3d7e4d73dc28fa350611b61f9833736374969c2efba

See more details on using hashes here.

File details

Details for the file kerndeterminer-0.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for kerndeterminer-0.0.1-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 50c2928b654eebaafb371e1889b2e1f66c8bb07a81a1308ed65c1abff477d9cd
MD5 0d5a5f96bad6cac99f955ecc6f34c5e1
BLAKE2b-256 c775d0b9b32b3e01011be17fe5fb853f6f71e0974b4e279757c04df161ca3e6d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page