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

Overview

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

You might also like...
A visual canvas and virtual machine for writing assembly to build cool things. Create machines and connect them together.
A visual canvas and virtual machine for writing assembly to build cool things. Create machines and connect them together.

Visual Assembly Canvas A highly visual assembly editor, infinite canvas for wiring blocks and machines together, bytecode virtual machine runnable nat

A fork of criterion.rs to keep things afloat.

Criterion.rs Statistics-driven Microbenchmarking in Rust Getting Started | User Guide | Master API Docs | Released API Docs | Changelog | Criterion.rs

A very fast implementation of tldr in Rust
A very fast implementation of tldr in Rust

A very fast implementation of tldr in Rust: Simplified, example based and community-driven man pages.

A very simple third-party cargo subcommand to execute a custom command

cargo-x A very simple third-party cargo subcommand to execute a custom command Usage install cargo-x cargo install cargo-x or upgrade cargo install -

A cli based pastebin in Rust, but very insecure

pasta A cli based pastebin in Rust, but very insecure Use nightly toolchain to build rustup override set nightly When this program is running, you can

A very opinionated, zero-configuration shell prompt
A very opinionated, zero-configuration shell prompt

A very opinionated, zero-configuration shell prompt

Learning Rust through Advent of Code 2021 - probably not very clean!

AoC 2021 ======== I'm using AoC2021 as an excuse to learn Rust (and maybe some other languages). Please do *not* use this repository as a good source

Fls - Ferris-LS, a very bad LS replacement. Besides that, proves that I suck at clean & good code.

FLS A handy ls remake, purely for learning. Why FLS? There's no reason, at all, don't use it. I just want to learn Rust :D Usage Flags: -i = Use icons

dlfile is a very simple, straightforward CLI to download a file

dlfile dlfile is a very simple, straightforward CLI to download a file, except it... Only downloads over HTTPS Requires TLS 1.2 or higher Executes in

Owner
Simon Cozens
Simon Cozens
Logging for text that should stay in the same place in a console.

console_static_text Crate for logging text that should stay in the same place in a console. This measures words to handle wrapping and has some consol

David Sherret 8 Dec 25, 2022
Rust library for putting things in a grid

rust-term-grid This library arranges textual data in a grid format suitable for fixed-width fonts, using an algorithm to minimise the amount of space

Benjamin Sago 61 Nov 4, 2022
Scouty is a command-line interface (CLI) to keep an eye on substrate-based chains and hook things up

scouty is a command-line interface (CLI) to keep an eye on substrate-based chains and hook things up

TurboFlakes 15 Aug 6, 2022
Brutally simple command line app for jotting things down

jot Brutally simple command line app for jotting things down. About jot lets you get things down before you forget, without fiddling folders, naming,

Alexander Alexandrov 1 Apr 8, 2022
Giddy up! Things are going to be wild.

Jocky - For controlling your horses Current Idea The idea is essentially to have a custom directory that writes immutable segments, this means only 2

Harrison Burt 3 Jan 7, 2023
Tool to copy things!

zp zp is a cli command to copy the contents of the source file or of the std output buffer to the clipboard. To use the zp, simply open your terminal

Gokul 26 Apr 22, 2023
A crate to help you copy things into raw buffers without invoking spooky action at a distance (undefined behavior).

?? presser Utilities to help make copying data around into raw, possibly-uninitialized buffers easier and safer. presser can help you when copying dat

Embark 131 Mar 16, 2023
ratlab is a programming platform designed loosely for hobbyist and masochist to analyse and design stuff and things that transform our world?

ratlab A programming language developed by Quinn Horton and Jay Hunter. ratlab is a programming platform designed loosely for hobbyists and masochists

Jay 10 Sep 4, 2023
A visual canvas and virtual machine for writing assembly to build cool things. Create machines and connect them together.

Visual Assembly Canvas A highly visual assembly editor, infinite canvas for wiring blocks and machines together, bytecode virtual machine runnable nat

Phoomparin Mano 31 Oct 11, 2023
An Azalea plugin with things that will probably trigger anticheats.

Azalea Hax An Azalea plugin with useful features that will probably trigger anticheats. Usage async fn handle(mut bot: Client, event: azalea::Event, s

null 4 Oct 17, 2023