Replacing glyphs with Python in OTF

Primary tabs

6 posts / 0 new
Last post
Carren Edward Petrosyan's picture
Joined: 5 Nov 2005 - 10:21am
Replacing glyphs with Python in OTF
0

Hi everybody, I have a question. I know I can replace glyphs in the same OpenType font.

However, is it possible to replace glyphs in one OpenType font to glyphs from another OpenType font. Is there a python script available for that? Or is there some other way to achieve that? Thank you in advance.

Nick Curtis's picture
Offline
Joined: 21 Apr 2005 - 8:16am
0

There are several options available under Tools > Merge Fonts which may accomplish what you want to do...

Carren Edward Petrosyan's picture
Joined: 5 Nov 2005 - 10:21am
0

Thanks, but that's not what I was asking about. I guess, I wasn't clear. I'm not talking about replacing glyphs via Fontlab.

I want to be able to replace specific glyphs in already generated OTF from a different OTF that are in the same folder for example. I know that if I apply a script I can change f f l to a ligature ffl in one particular font. But is it possible to control a font with a script from within a different font,.. being able to replace, let's say, a lowercase "g" from one font with another "g" from a different font? I hope this explains. Thanks.

Reynir Heiðberg Stefánsson's picture
Joined: 19 Nov 2010 - 11:15am
0

In CSS, unicode-range will do it, as long as the UA (User Agent) supports it.

Adam Twardoch's picture
Offline
Joined: 3 Dec 2002 - 7:36pm
0

Nycgraphiste,

without a high-level font editor such as FontLab Studio, it can be quite tricky. Especially with OpenType PS (.otf) fonts which rely on the compression of the CFF table through subroutines.

It's possible, using the FontTools/TTX Python toolkit, but it requires quite a lot of low-level knowledge of the OpenType font format.

One solution might be to try compiling FontForge as a Python module (which unfortunately I haven't been able to do on a Linux server), and/or use the UFO/GLIF format to exchange the glyph data.

It's not trivial. But yes, it can be done.

Carren Edward Petrosyan's picture
Joined: 5 Nov 2005 - 10:21am
0

Twardoch,

I meant doing it in Fontlab Studio. So how is it possible to do it via FS? Is it rather complicated or not to attach such a script to a font that would work on other fonts, because I'm not an advanced (or intermediate) scripter?

The issue here is that there is a specific OpenType font created for a particular brand. The concept is to use different fonts (in publication materials) alongside the custom font but some of the glyphs (characters in the brand name) will always be replaced with the corresponding glyphs from that custom font. Cheers.