0

I'm trying to add a custom glyph to a font. I've opened the font in FontForge. I go to Encoding > Add Encoding Slots > then press OK for adding 1 new slot. Then I add the glyph to the new slot.

Unfortunately, when I try to write the glyph in my html, by say, 𐏱, or က, and open that html in the browser, the new glyph doesn't render - I just get the box with a question mark in it (I can have other glyphs that are a part of the original font render no problems using the same referencing syntax). So something seems to be wrong with the way I've set up the glyph in terms of the reference - like maybe I'm supposed to declare the reference somewhere?

I've gone to glyph info and added a glyph name.. Also tried referring to it that way i.e. &myName; without success.

1 Answer 1

0

This isn't a direct solution so much as a potential workaround.

You could probably achieve the effect of custom glyphs displayed in a custom font by (ab)using ligatures. Under the hood, ligatures scan the characters that are to be rendered for specific sequences, and if any such sequences are found, the entire set of characters are represented with a single, combined glyph that represents all of those characters together. The typical use is to implement specialized glyphs for character sequences such as "ffl" that might look weird if rendered using the standard glyphs of each letter. However, the tool could benefit your use case.

From the FontForge documentation:

If you wish to build a ligature that is not part of Unicode you may do so. First add an unencoded glyph to your font (or if your font is a Unicode font, you could use a code point in the private use area), and name the glyph. The name is important, if you name it correctly FontForge will be able to figure out that it is a ligature and what its components are. If you want to build a ligature out of the glyphs “longs”, “longs” and “l” then name it “longs_longs_l”, if you want to build a ligature out of Unicode 0D15, 0D4D and 0D15 then name it “uni0D15_uni0D4D_uni0D15”.

[...]

Unfortunately simply creating a ligature glyph is not enough. You must also include information in the font to say that the glyph is a ligature, and to say what components it is built from.

[...]

You would open the Lookups pane of the Element->FontInfo command and press the [Add Lookup] button. This will give you a new dialog in which you can fill in the attributes of your new lookup.

You must first choose the lookup type. For ligatures this should be “Ligature Substitution”. You may then bind this lookup to a feature, script and language set. The “ffi” ligature is a standard ligature in latin typesetting so it should be bound to the ‘liga’ tag, and the ‘latn’ script. (If you click on the little box to the right of “liga” you will get a pulldown list of the so-called “friendly names” for the features. “liga” corresponds to “Standard Ligatures”).

[...]

Once you have created a lookup, you must create a subtable in that lookup. Select the lookup line (in the Lookups pane of Font Info) and press [Add Subtable]. This is a fairly simple dialog… you simply provide a name for the sub-table, and then another dialog will pop up and you will (finally) be able to store your ligature information.

As an example, by defining your glyph to be a "ligature" for the string of characters "${GLYPH_1}", you could make that sequence of characters be substituted by your glyph wherever they would be rendered by your font. As an added bonus, if the text were to be rendered in a different font for some reason, the rendered text would be more comprehensible than that of a nonexistent glyph.

It's worth noting, though, that particular client applications and OSes may not necessarily support ligatures that are specified within fonts. I expect that this risk might be low in the case of ligatures, but it's still worth pointing out; I myself had an issue quite some time ago where a chaining contextual substitution defined in a font I made only worked when tested within FontForge... but after several years, I came to discover that the font worked just fine when tried on Windows 7 instead of Windows XP.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.