Page 1 of 1

How do I make a glyph usable?

Posted: Wed Dec 07, 2016 2:30 am
by 1940LaSalle
As noted I'm a beginner, interested in font design as a hobby. That said, here's what's probably an easy question.

Suppose I want to add a new glyph (for grins, let's say I want to add the so-called vulgar fraction ⅛). The operation clearly starts with the "Insert Glyph" command, which allows me to place it where I want it. Then it's a comparatively simple matter to set up the contours to make a glyph that's generally consistent in style with the rest of the font in question. Now: what else do I need to do to make the new glyph usable as part of a TrueType (let's say) font? And if I have to do something to the added glyph, how do I do it? Thanks. (Didn't see a tutorial on adding a glyph, by the way.)

Re: How do I make a glyph usable?

Posted: Wed Dec 07, 2016 5:28 am
by Bhikkhu Pesala
Welcome to the High-Logic forum. I moved your thread from the Tutorials and Solutions forum to the Support forum and gave it a meaningful title.

The help topic on Adding a New Character is what you're looking for.

To be usable in applications, glyphs need to be mapped. Using insert character does that for you, whereas insert glyph does not. The vulgar fraction 1/8 is in the Number Forms Character set. In the illustration below, I searched for "eighth" to find 1/8, and then double-clicked on 1/3, and Shift + Double-clicked on 7/8 to insert the full range of common vulgar fractions (1/4, 1/2, and 3/4 are already in a default font. They are found in the Latin-1 Supplement character set).
Insert Characters.png
Insert Characters.png (33.92 KiB) Viewed 3871 times

Re: How do I make a glyph usable?

Posted: Thu Dec 08, 2016 1:54 am
by 1940LaSalle
Thanks all around.

Now, a follow-up question: suppose for some obscure reason I wanted to create (say) a vulgar fraction 3/17? I rather doubt that exists anywhere, so how would one go about mapping something brand-new?

Re: How do I make a glyph usable?

Posted: Thu Dec 08, 2016 5:34 am
by MikeW
Not obscure.

What I think you are asking isn't about 17ths per se. Rather, I think you would like for any number sets to be available as fractions, yes?

If so, what you want to create is an arbitrary fraction feature. So you would need (or, best made as) a set of super-scripted numerals from 0-9 and a set of sub-scripted numerals from 0-9. And a fraction slash which is like the normal forward-facing slash but it leans over further and you can insert the fraction slash following BP's advice above for searching for the code point above to find it. I use the PUA to add these numerals to.

It is advantageous to name the sub- and super-scripted numerals in a consistent manner. I name them as the numeral, a period and then what they represent for their position. So for a denominator, I would use zero.dnom as the name. And so with the numerator--but I simply use the position, so zero.sups. This makes it easy to limit the view when building the OT feature via using the filter when adding glyphs to the feature.

I think there is a script one can run to automate the building and adding the code points, but as this really doesn't cut down much of the work--the majority of the work, to me, is making the numerals not appear to thin from scaling no matter how the scaling is done.

Once you have those numerals and the fraction slash, you would then go into the OpenType Designer. Once there, you would add the fraction (frac) feature to the language. Then the fun part begins--the coding.

Depending upon whether you have added the standard type of pre-composed fractions or not, you at least will be adding a substitution lookup for changing the numerals from proportional figures (what one types on a keyboard) to their respective super- or sub-scripted positions and swapping out the keyboard-typed slash to the fraction slash. And you will need to add one or more chaining context feature to the frac feature for the magic part--putting it all together with the appropriate substitutions.

The fraction feature is one that can be relatively simple to create or as complicated as you would like to make it. One of the easy methods of seeing how to do this is to perhaps download one of BP's fonts or one from another open source font and look at how they built the fraction feature, test it in the bottom of the OpenType Designer window to see it in action (don't forget to check the checkbox for the frac feature).

Mike

Re: How do I make a glyph usable?

Posted: Thu Dec 08, 2016 5:43 am
by Bhikkhu Pesala
While I was busy writing my post, Mike W posted his.

If any character does not have any accepted Unicode mapping, one can assign it to the Private Use Area (PUA). As the name suggests, you can use these code-points from decimal code-point 57344, hex E000.

However, all vulgar fractions can be created by using an OpenType fractions (frac) feature, so you only need to create numerators, denominators, and a fraction slash to create any fraction. This may be step too far for you yet, but it's good to know that it exists before you start creating a whole load of characters that you don't need.
Three seventeenths.png
Three seventeenths.png (14.57 KiB) Viewed 3850 times