Search code examples
fontswindows-7non-ascii-characters

How to output my font characters with Alt+code instead of default (ASCII) characters?


I am in the process of creating my own font. The issue is, my font is based on symbols (instead of characters) and there are 120,000 symbols in my font. Obviously this is a humongous number and it is simply impossible to write the required symbol using the normal A-Z characters.

So I was thinking if it is possible to use Alt+code method to input the number of my symbol in order to print it. Is it possible (on Windows 7) to change the settings of my computer to print my required symbol instead of the regular ASCII chars with Alt+code method?

If Alt+code method cannot be used, is it possible to use Ctrl+alphabetic code to print my symbol? I mean something like Ctrl+A-B-C should print one symbol while Ctrl+A-B-T should print some other symbol (as I specify)?

Many thanks.


Solution

  • Fonts can't support 120,000 different symbols. Internally, they have 16-bit numeric glyph IDs, so can't support more than 64K glyphs.

    You said your using "symbols not characters". That makes it sound like you wouldn't want to use a Unicode encoding. But the only alternative would be to use the Windows symbol encoding. While in principle a format 4 cmap subtable could be used to map 64K codes from 0x0 to 0xFFFF, in practice some implementations will expect no more than 224 graphic characters.

    You'd be better off encoding your symbols as Unicode PUA characters, using platform 3 encoding 10 (Windows / full Unicode) with a format 12 cmap subtable. That way, you can use any Unicode PUA code points, U+E000 - U+F800 or U+F0000 - U+1FFFFF. That's enough for 120,000 symbols.

    However, a single font will still be limited to 64K glyphs, so you'd have to divide your symbols into two fonts.

    As for keyboard input... good luck remembering numbers for each of 120,000 symbols. But however many you can remember, you could enter them on a numeric keypad using ALT + <number>. You might want to create a special input method for this, however: what's the point of having 120,000 symbols if you can only remember how to enter a dozen or so.