It is currently 22 May 2022, 02:01

• Featuring Members' Images •
Could be related to 'Update to Custom Font Tools FontSlab to Version 0.08'
skinnyhouse
skinnyhouse
skinnyhouse
tim
skinnyhouse

GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Update to Custom Font Tools FontSlab to Version 0.08

Share your Python Fu Scripts/plug-ins for GIMP here
skinnyhouse
Script Coder
5th Place
2503 Post(s)

Update to Custom Font Tools FontSlab to Version 0.08

Post#1 by skinnyhouse » 24 Jan 2019, 14:44


I wanted to add kerning pairs paths to FontSlab and I thought that Tim had used this feature in his original custom font script: I wanted to make sure that whatever I did would be compatible with his scripts. I couldn't locate it so I have just gone ahead with my version (which can always be easily altered).
Font_Slab-v0-08.py #
(241.84 KiB) Downloaded 140 times
Kerning was introduced in font making in order to automatically adjust the amount of space between pairs of letters. With kerning tools space can be added to either side of a letter or, indeed, to both sides of a letter: It is both time-consuming and brain-numbing to add kerning information to traditional computer fonts.

Custom fonts can use a kerning mechanism in FontSlab but this exists at a much more basic level.

Without any kerning information custom font displaying plug-ins, such as FontSlab, use the width of each character layer to work out letter spacing: The designer of each custom font decides how much space to allow for these invisible margins when creating the custom font.

You can see these character layer outlines in the example below in the word ‘Coat’.
01 Coat Hat.png
01 Coat Hat.png # (28.92 KiB) Viewed 3461 times Thumbnail
To add kerning information to a custom font the designer needs to add a separate path to denote the new width to use; this takes the same format as used when naming individual letters i.e. the character followed by ‘.png’ (without the quotes). In the example below I have added a new path called ‘C.png’ which is smaller than the width of the ‘C’ character layer.
02 C.png
02 C.png # (19.47 KiB) Viewed 3461 times Thumbnail
03 C path.png
03 C path.png # (1.78 KiB) Viewed 3461 times Thumbnail
As expected this adjusts the spacing of the following letters as they are displayed on the screen.
04 Coat.png
04 Coat.png # (14.28 KiB) Viewed 3461 times Thumbnail
This path method allow us to increase or decrease the amount of space on the right hand side of any character.

In the first example below, the ‘Q’ character has no additional kerning path so it takes its spacing information from the width of the character layer.
05 Queen.png
05 Queen.png # (28.26 KiB) Viewed 3461 times Thumbnail
The next example adds a ‘Q.png’ kerning path to match the body of the letter ‘Q’.
06 Queen.png
06 Queen.png # (27.52 KiB) Viewed 3461 times Thumbnail
FontSlab version 0.05 was able to display custom fonts with kerning path adjustments to right hand margins like this, but it could not handle any adjustments to the left-hand side of characters. So the character ‘f’, using this type of custom font, could not be displayed in a satisfactory way in the middle of words. The layer outline shows that the path works on the right-hand side of the character but not on the left.
07 before.png
07 before.png # (19.71 KiB) Viewed 3461 times Thumbnail
Version 0.07 of FontSlab addresses this issue and can use kerning paths with negative co-ordinates to display these characters properly as the example below shows.
08 before.png
08 before.png # (31.8 KiB) Viewed 3461 times Thumbnail
To use this feature, select the path tool and draw a path from the beginning of the layer to the point where you want other characters to start being displayed. (In the example below I wanted the following characters to be quite close to the cross-stroke of the ‘f’ and leading characters to be displayed beyond the start of the hook of the ‘f’.)
09 f.png
09 f.png # (13.48 KiB) Viewed 3461 times Thumbnail
Next move the whole path to the left of the character layer left-hand boundary by the amount you want the characters to overlap – as shown in the example below.
10 f.png
10 f.png # (14.31 KiB) Viewed 3461 times Thumbnail
(Use either the move tool set to move path mode or the path tool whilst holding down the Alt key.)
11 path tool.png
11 path tool.png # (5.55 KiB) Viewed 3461 times Thumbnail
Using a kerning path ending in ‘.png’ affects every occurrence of the same character in the same way but in some situations you need certain letters to be closer together or further apart only with some characters – for example the capital letters ‘A’ and ‘W’ might need to be moved closer together whereas the capitals ‘A’ and ‘E’ would probably not want to be moved any closer together.

In version 0.08 of FontSlab I have introduced kerning pair paths. These are created and work in exactly the same way as ‘.png’ kerning paths and are simply denoted by a two character name in the list of paths. Kerning pair paths take precedence over ‘.png’ kerning paths.

The example below uses no kerning at all:
12 Avast.png
12 Avast.png # (33.17 KiB) Viewed 3461 times Thumbnail
Now kerning has been added to the letter ‘A’ in the form of a path called ‘A.png’. This has the desired effect of moving the ‘V’ closer to the ‘A’; unfortunately, however, the ‘A – S’ combination does not work.
13 Avast.png
13 Avast.png # (32.56 KiB) Viewed 3461 times Thumbnail
By replacing that path with one named ‘AV’ only that particular combination of characters will be kerned. All that needs to be done now is to create a kerning pairs path for ‘V’ and ‘A’ to remove the unsightly gap between those two characters.
14 Avast.png
14 Avast.png # (33.03 KiB) Viewed 3461 times Thumbnail
Not every custom font will benefit from the addition of kerning paths but those with swashes and other decorations may certainly benefit from at least some extra work. This over-the-top example uses a large number of kerning paths.
15 Warning.png
15 Warning.png # (89.89 KiB) Viewed 3461 times Thumbnail

Issabella
Script Tester
3rd Place
3672 Post(s)

Post#2 by Issabella » 25 Jan 2019, 07:07


Thank you so much for your constant work invested in getting custom fonts more and more interesting to do. :gimp_clap: :happy_purple:
Issabella

Don’t be afraid to start over. It’s a new chance to rebuild what you want.

skinnyhouse
Script Coder
5th Place
2503 Post(s)

Post#3 by skinnyhouse » 25 Jan 2019, 08:03


Thank you Issa


GIMP/GL:  Tutorials | Tips | Questions | Interests | Script Requests
Recommendations:  Index | Top 10
Resources:  🡆 Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply New Topic
  • Similar Topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 27 guests