Arranging glyph order (sorting) in FontLab

jason's picture

This is probably a simple issue, but how does one re-arrange glyph order in FontLab? In the shot below notice that "Kcommaaccent.small" is stuck between the "L"s? I can't seem to figure out a simple way of shifting it back into position. I've tried sorting glyphs based on name, unicode, encoding under the Glyph menu, but that just messes everything up. Is there an easy way to just move glyphs into the position you want them?

Miguel Sousa's picture

Jason,

In which view do you want to have them sorted? 'Names mode' or 'Index mode'?

If 'Names mode' then you'll have to create your own Encoding file, which consists in a text file listing your glyphs in the order you want. You'll have to save this file in the 'Encoding' folder. (The first line of this file also needs to be build in a specific way, in order for Fontlab to recognise it. Check the Manual.)

If 'Index mode' then the only thing you have to do is to select the glyphs and move them around.

However, if you have done the 'Names mode' step, you don't need the second one, since you can do 'Sort glyphs by...' --> 'Encoding' (while in 'Names mode')

jason's picture

Hi Miguel, thanks for the suggestions. While I was waiting I managed to discover the custom encoding procedure, which seems like the thing to do in order to have a custom index/order on hand. Your "Index mode" method is what I was looking for as a quick fix, but then I'd have to re-sort each font one at a time. The encoding file seems like the right route to take. Thanks for pointing me in the right direction(s).

Miguel Sousa's picture

Jason: but then I’d have to re-sort each font one at a time

Not necessarily. You can automate it, if you're keen with FLPy scripting.
Take a look at the following programs:
Sort by Adobe OTF Standard Name List
Set Encoding & Codepages

Toby's picture

Bumping this old thread. I still don´t get how to move individual glyphs manually. When I try, Fontlab just wants to replace glyphs. The glyphs I´m trying to move are non-Unicode..Any ideas?

agisaak's picture

If it wants to replace glyphs, you're not working in index mode. Switch modes using the menu in the lower left corner. Make sure it's the MODE menu from which you select 'index' rather than the LABEL menu (which is immediately to the left of the mode menu, at least it is on MacOS).

André

dezcom's picture

What I do is generate a file using >Glyph>Glyph Names> "Save encoding" . I then select all glyphs ( in FontLab ) and copy- paste to a text file. I search-replace slash with carriage return. This gives me a list of every glyph drawn. I copy-paste this list to Excel and reorder glyphs as I please which is quite easy in Excel.
Next, I create a list of numbers in order from 1 to however many you need in the next column. This is very easy using Excel ordinal list formula [cell above] plus 1 and fill-down to end of list in one full swoop. Just be sure your first few glyphs are the same as a normal encoding:
%%FONTLAB ENCODING: [fontlab's given number for your saved encoding]; FontName #[fontlab's given number for your saved encoding]
.notdef 0
space 1
.null 2
CR 3
---
after that, order as you wish but be sensible.

Then, open the encoding you saved (a .enc file) in a text editor to find the generated number, etc.

Save your Excel file as "tab delimited text" and replace tabs with spaces and CR with Linefeeds.
Then, replace the list of glyphs in the encoding with the list you just generated from Excel and save as ascii but use .enc as file ending.
Then replace the original file in the exact same location you found it in "Libraries".
Close Fontlab and restart or reboot. Then go back to your original Fontlab vfb file and change the default encoding the the new encoding you just created. Then sort by encoding.

If you want to have certain special characters you have designed that have no unicode name show up in future fonts, first give them a PUA number so that they always have the same position.

I know this sounds like a great deal of work but you only need do it once. It can be used for every font you design with that same number of glyphs and names.

John Hudson's picture

Next, I create a list of numbers in order from 1 to however many you need in the next column. This is very easy using Excel ordinal list formula [cell above] plus 1 and fill-down to end of list in one full swoop.

This isn't necessary. Although FontLab generated .enc files number each glyph, for a long time now it has been possible to create .enc files that are just lists of glyph names (plus the header).

dezcom's picture

You mean the numbered list is no-longer needed? Then why does it always show up?

John Hudson's picture

Because the code that saves .enc files is older than the code that handles .enc files without numbering. I requested the latter from Yuri, many years ago, because I was making lots of custom .enc files and didn't like the hassle of numbering what was, after all, a sequential list. It makes inserting individual glyphs much easier if you don't have to number the lines.

This is how one of my typical custom .enc files looks:
%%FONTLAB ENCODING: 98943639; Brill Italic Post
%
% Version 3.6, 24 October 2012
%
.notdef
NULL
CR
space
uni00A0
A
B
C
D
E
...[etc.]

dezcom's picture

That sounds fine by me as long as it works everywhere and I am sure you have tested it well.
Thanks, John!

Toby's picture

Thanks guys, that index mode did the trick!

Syndicate content Syndicate content