Help appreciated: ligatures and font forge

Music notation symbols, fonts, font sources and font creation, SmuFL.
e_del
Posts: 16
Joined: 22 Jun 2016, 09:18

Help appreciated: ligatures and font forge

Post by e_del »

Hello everybody,
I just stumbled by chance in this forum while looking for hints about Font Forge, so if you don't mind, I post my problem hoping someone can help (or redirect me to someone thn can)...
I just wrote a font to write guitar fretboard diagrams in a regular text editor, with frets number, note names and various symbols (dots, squares, triangles, etc...).
The font is avaliable here : http://enricodellaquila.blogspot.it/p/m ... uitar.html
and I set up a facebook support page here : https://www.facebook.com/My-Guitar-Font ... 8108496016

I started writing it mainly for myself, and I'm glad it's been helpful for some other people too, although far from perfect...
The font simply substitutes the letters available on a regular keyboard with the symbols needed to write the diagrams, hopefully in a logic and ergonomic way... the possible glypsh are thus limited, due to the number of letters on a keyboard and to the different key.

My goal now is to write a much better version using ligatures and overcome the limited number symbols available with simple keystrokes (don't want get mad with ALT-<code> symbols, or crtl-shift-alt-key, etc...)
There is some documentation about ligatures and fontforge, but if anyone worked with it yet, would be easier to understand and get a good grasp on this topic...
Does anyone know this stuff and wishes to help?
Sorry if I annoyed, looking for suggestions
thanks in advance
Enrico Dell'Aquila
User avatar
liuscorne
Posts: 36
Joined: 09 Oct 2015, 21:13
Location: Erfurt, Germany

Re: Help appreciated: ligatures and font forge

Post by liuscorne »

The guys (and a few girls) at http://typedrawers.com/ might help. Lots of experts in type design there; I'm sure some of them are familiar with FontForge.
Another alternative: https://typography.guru/ It's primarily focused on typography in general, but there are a few members around who are familiar with font software.
Knut
Posts: 867
Joined: 05 Oct 2015, 18:07
Location: Oslo, Norway

Re: Help appreciated: ligatures and font forge

Post by Knut »

To handle ligatures automatically, you'll need to make use of the OpenType feature liga, and format your font as OpenType. I have no experience with FontForge, but you'll probably figure it out by searching OpenType features in the manual. A good introductory article on OT features, including ligatures, can be found here:

http://ilovetypography.com/OpenType/ope ... tures.html
e_del
Posts: 16
Joined: 22 Jun 2016, 09:18

Re: Help appreciated: ligatures and font forge

Post by e_del »

Thank you all!
Honestly, I hoped Simeone here did already work with ligatures, but I'll give a try also on the websites you indicate, @liuscorne.
And @Knut: yes, my confusion comes indeed from reading th FontForge documentation...
I need to figure out what has to be done, compared to what I've understood. :)
User avatar
tisimst
Posts: 416
Joined: 08 Oct 2015, 17:57
Location: UT, USA
Contact:

Help appreciated: ligatures and font forge

Post by tisimst »

e_del wrote:Thank you all!
Honestly, I hoped Simeone here did already work with ligatures, but I'll give a try also on the websites you indicate, @liuscorne.
And @Knut: yes, my confusion comes indeed from reading th FontForge documentation...
I need to figure out what has to be done, compared to what I've understood. :)
I've done ligatures with FF (it's all I use). It's actually not that hard. I'm not in a position to explain at this very moment, but I'll try to get a longer, more explanatory post here soon.
Music Typeface Designer & Engraver - LilyPond | Sibelius | Finale | MuseScore | Dorico | SMuFL | Inkscape | FontForge
User avatar
tisimst
Posts: 416
Joined: 08 Oct 2015, 17:57
Location: UT, USA
Contact:

Re: Help appreciated: ligatures and font forge

Post by tisimst »

Ok, e_del. Here's the tutorial I promised on creating text ligatures in FontForge (please excuse my poorly done hand-drawn arrows in the images). There are really two ways to do this (at least), so I'll show one and describe the other. I'm going to assume that you have a font that has the base glyphs and the ligature glyphs already created.

1. Create the base and ligature glyphs
1-starting-glyphs.png
1-starting-glyphs.png (13.04 KiB) Viewed 22413 times
Here, I have three base glyphs f, m, and p. Based on those, I'm going to define ligature substitutions for the character pairs "m"+"p" and "f"+"f".

2. Create a new Lookup
2-font-information_lookups_gsub.png
2-font-information_lookups_gsub.png (23.26 KiB) Viewed 22413 times
With those glyphs created, we need to do some administrative setup. Click on the "Element" -> "Font Info" menu option. 1) Click on the "Lookups" tab on the left side of the window. 2) In the window you will see the GSUB tab (click on it, if necessary). 3) Click on "Add Lookup".

3. Select the "liga" Lookup table
3-lookup_standard-ligatures_liga.png
3-lookup_standard-ligatures_liga.png (30.15 KiB) Viewed 22413 times
In the window that pops up, 1) click on the top drop-down menu. There are many types of lookup tables to choose from. You'll want to select "Ligature Substitution" from the list. 2) If you want the ligature to happen automatically (with some word-processing apps, like LibreOffice), then choose the "Standard Ligatures" feature (you won't see "liga", but this is what it means). Otherwise, you can select "Discretionary Ligatures" ("dlig"), which are "off" by default. 3) Deselect the option to store the lookup data in a separate AFM file. Leave the "Lookup Name" as the default value. In my case it was automatically named " 'liga' Standard Ligatures in Latin lookup 0 ". Click "OK".

4. Add Subtable
4-add-subtable.png
4-add-subtable.png (22.69 KiB) Viewed 22413 times
With the name of the ligature lookup selected in the GSUB tab, click on the "Add Subtable" button on the right side of the window.

5. Name the Subtable
5-name-subtable.png
5-name-subtable.png (16.98 KiB) Viewed 22413 times
You can name the subtable whatever you want, but I'd recommend just leaving the default value there and clicking "OK".

6. Add ligature entries to the Subtable
6-add-liga-subtable-entries.png
6-add-liga-subtable-entries.png (23.77 KiB) Viewed 22413 times
We made it! Here's where you actually define the ligature substitutions. You'll see two columns in the "Lookup Subtable,..." window that pops up. The left column is where you'll type in the name of the ligature glyph and the right column is where you type in the base glyph names that you want the ligature to substitute for. 1) Click on "<New>" to create a new entry row. 2) Type in the name of your ligature (as you type, options will appear that you can click on, if desired). 3) Type in the names of the base glyphs, separated by a literal space.

7. Preview the ligature action
7-liga-preview-on-mouse-over.png
7-liga-preview-on-mouse-over.png (26.83 KiB) Viewed 22413 times
FontForge has a handy feature that lets you preview the ligature substitution. If you mouse-over a row (anywhere on the row), then you'll see a little pop-up that shows the ligature glyph (on the left) and the base glyphs (on the right). The arrow simply indicates that the base glyphs become the ligature in this substitution. When done, click "OK". (And, no, my real mouse cursor doesn't look like that...)

8. Add the Lookup to the Font
8-liga-gsub-all-set-up.png
8-liga-gsub-all-set-up.png (24.02 KiB) Viewed 22413 times
You should now see the full Lookup and Subtable entry in the GSUB tab. Click "OK" to actually add the lookup table to the font (otherwise all your hard work would be for nothing).

9. Test the ligature
9-liga-testing-in-metrics-window.png
9-liga-testing-in-metrics-window.png (25.78 KiB) Viewed 22413 times
Now that the lookup is added to the font, let's test it out! Click on the "Window" -> "New Metrics Window" menu option. In the metrics window, you'll notice a few things. 1) On the left are all the lookup tables that you've defined (here, I've only defined the "liga" table). Click on "liga" if it's not already selected. 2) Near the top is a text box where you can enter the actual glyph characters you have defined (hint: if you can't figure out how to put in the actual character in this field, you can manually enter it by name with the backslash prefix like "/m_p", since I named one of my ligature glyphs "m_p"). 3) As you type in the base glyph characters, with "liga" selected on the left, FontForge will automatically substitute the ligature glyph for the base glyphs where possible. You'll see the ligature glyph names appear in the metrics table below the preview frame instead of the base glyph names. You can turn off/on the ligature substitution by (de)selecting the "liga" option (via Ctrl+Left-Click).

10. Generate the font

If everything is working like you want, save the file. When you generate the real font file, the "liga" lookup table will be embedded. That's it! Happy ligaturing!

P.S. You can also create the "liga" lookup, subtable, and entries by right-clicking on a ligature glyph in the main font window and selecting "Glyph Info" in the context menu. Then click on the "Ligatures" tab on the left, followed by "New Ligature" in the table to start a similar process to those above. Once the subtable is created, like in step 5, you just type in the base glyph names in the right column of the "Glyph Info" window. You can even preview the ligature there with a simple mouse-over! Click "OK" to add it to the font.

Hope that helps!
Last edited by tisimst on 28 Jun 2016, 20:59, edited 1 time in total.
Music Typeface Designer & Engraver - LilyPond | Sibelius | Finale | MuseScore | Dorico | SMuFL | Inkscape | FontForge
e_del
Posts: 16
Joined: 22 Jun 2016, 09:18

Re: Help appreciated: ligatures and font forge

Post by e_del »

wow, that's great!
I'll try ASAP to follow your guide.
At first sight it seems quite well written, but I'll have time to dig it only during the weekend.
I'm working now on the new set of glyphs, with numbers and symbols in a reserved Unicode section, and now I can start experimenting with ligatures
My goal is being able to insert e.g. a "b13" glyph made as a big dot + styled text on the fretboard, by pressing "b" - "1" - "3"
Similarly I could insert note names, scale degrees, symbols, etc.. while maintaning the "regular" alphabet chars available on the keyboard, in the word processor, without having to change font... would be a great improvement.
Thanks a lot for helping, I'll keep you informed about success (and failures!) :) :)
Enrico
e_del
Posts: 16
Joined: 22 Jun 2016, 09:18

Re: Help appreciated: ligatures and font forge

Post by e_del »

hello tisimst

seems I managed to build my first ligature! :)
In Font Forge I succesfully created a glyph with "b13" as a single char, and I'm able to get it when I digit "b","1",3" in the metrics window.
Everything seems fine, but unfortunately I cannot set it to work in LibreOffice...

Were you able to use your ligatures in LO? Or did you use another word processor?
Maybe I have to configure something in LO?
I'd strongly prefer to use an opensource editor, and hope I don't have to go to MS Word... but if it's the only program multi-platform that recognizes ligatures, I'm afraid I'll have to...

Let me know how and where you use ligatures...
They would be VERY handy.. if they worked! :) :)

bye, thanks
Enrico
User avatar
tisimst
Posts: 416
Joined: 08 Oct 2015, 17:57
Location: UT, USA
Contact:

Re: Help appreciated: ligatures and font forge

Post by tisimst »

I didn't have to do anything special. Using Windows 8 and LO 5.0.2, I get exactly what I expect from the glyphs in my tutorial:
use-in-LibreOffice.png
use-in-LibreOffice.png (68.71 KiB) Viewed 22339 times
What OS/LO version are you using?
Music Typeface Designer & Engraver - LilyPond | Sibelius | Finale | MuseScore | Dorico | SMuFL | Inkscape | FontForge
e_del
Posts: 16
Joined: 22 Jun 2016, 09:18

Re: Help appreciated: ligatures and font forge

Post by e_del »

Good to know, so it means that's a problem that can be fixed! :)

I'm alternating between iMac and a Win 10 Laptop,
Currently the Laptop is my main workhorse, and I'm using LO 5.1.4.2

Actually I'm now "upgrading" a OpenSans font file, adding the glyphs in the private area U+E0000 ...
There are many other Lookup tables, and a preexisting "liga" that contains the usual fi ff ffi ffl ligatures... that don't work too
(although in the FontForge metrics window they do)

Maybe I'll start again from scratch with an empty file, and see if anything changes
(I could also sed you a copy of my .sfd file to check if it doesn't work for you too...)

I'll post further news.. if any .. :)
thank you
Post Reply