Frage

I'm trying to use fonts from the Nitti Basic family for programming. These fonts are packaged as OpenType PostScript OTF files.

Its U+002D (HYPHEN-MINUS) glyph works well as a hyphen, but not so well as a minus. For example, it doesn't line up with the horizontal bar of the plus sign. On the other hand, Nitti's glyph for U+2212 (MINUS) is perfect as a minus (of course), and this is what I need when programming. It's not feasible for me to actually use codepoint U+2212; after all, U+002D is what you get when you press the minus sign on the keyboard and it's what programming languages use for subtraction.

So instead I'd like to steal the glyph from U+2212 and use it for U+002D, so that that character looks like a minus sign.

How can I do it?

Update: Yes, it is possible to use U+002D as a hyphen in source code. As mentioned above, a minus sign is what I need.

War es hilfreich?

Lösung 3

For posterity, here's how to do it:

  1. Obtain Adobe's AFDKO font tools and install them.

  2. Put the OTF files into an empty directory.

  3. Run ttx *.otf to convert the OTF files to TTX (XML).

  4. Edit each TTX file in a text editor:

    1. In the cmap section, change occurrences of hyphen to minus. This table maps characters to glyphs. Character U+002D was originally mapped to the hyphen glyph; this change maps it to the minus glyph.

    2. Over the whole file, change ocurrences of NittiBasic to NittiBasicM and Nitti Basic to Nitti Basic M. This will distinguish the modified version of the font from the original once it's installed.

  5. Rename the TTX files, replacing Nitti Basic with Nitti Basic M.

  6. Run ttx -b *.ttx to convert the TTX files back to OTF.

  7. Finally, install the newly-created OTF files.

Andere Tipps

I agree with Jukka, there are tools to do this.

However, please don't forget that a font is usually protected by very similar contracts as software. In this case the link you provided for example points to a legal document that reads (amongst much other):

"Except as permitted herein, you may not rename, modify, adapt, translate, reverse engineer, decompile, disassemble, alter or otherwise copy the Bold Monday Font Software."

Notice the fact that you're not permitted legally to change this font. If you read the rest of the agreement you'll see a lot of restrictions on the actual use of the font as well. Make sure you're not breaking your license by what you are doing...

Tools like FontForge can be used to edit a font in a simple manner.

Note that in programming, too, HYPHEN-MINUS has multiple uses: as a minus sign, but also (in some languages) as allowed in identifiers, as well as in comments, where it usually appears in the role of hyphen. In some uses, a HYPHEN glyph will look odd.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top