Hi!
to run this script you will need at the very least an instance of nodejs, and npm.
the steps to generate your own template would be as follows:
- Download the script by either
a. using npm to install the package (npm i kerning-template
) - RECOMMENDED
b. using git to clone the repository (git clone https://github.com/mia-cx/kerning-template.git
)
c. downloading a zipped archive of the git repository
- Open the
index.ts
file in a text or code editor (Notepad++, VS Code, Atom, Sublime Text)
- Edit the
const
variables (lowercase
and symbols
specifically) at the top of the script to include all the characters you include in your typeface, and save the file.
- In your terminal, run
npm i; npm start
. It will output a file called kerning.txt
, which is the generated template.
If you prefer a different prefix from the default “NN”/“nn”, which I simply copied from the built-in templates, find line 33 (inside the generateKerningString()
function), and change the value of the prefix
variable.
As for the logic behind the script, it simply loops over all the characters that are available in the variables declared at the top of the script. Inside each iteration it will loop over these characters again, to append each character to each other character. This ensures that every possible character pair will exist in your template. It pushes all these pairs, along with the “NN”/“nn” prefix into a monstrous array containing all of the pairs, formats it into a string, and spews it out to a text file.
If you think I should write a version that can work in a web browser (e.g. https://jsfiddle.net or even a standalone page), please leave a comment urging me to do so!