FontLab Forum
January 05, 2009, 08:52:45 PM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: SMF - Just Installed!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Printing Glyphs from Python  (Read 528 times)
ufuehrmann
Newbie
*

Karma: +0/-0
Posts: 3


View Profile
« on: October 21, 2008, 04:19:53 AM »

Hi all,
has anybody an idea how to print a glyph (maybe together with the information Fontlab prints in the glyph overview) from a Python script running within Fontlab. I want to print along list of character of a font, glyph's shape, name unicode etc. side by side for a customer to compare fonts. FLPyDoc or RoboFab don't mention this topic. Any help is appreciated.
Tia,
Uwe
Logged
Eigi
Newbie
*

Karma: +2/-0
Posts: 17



View Profile WWW
« Reply #1 on: October 21, 2008, 02:12:29 PM »

Hallo,

You can use ReportLab (www.ReportLab.org) to create PDFs in combination with fonttools (fonttools.sourceforge.net).
In fonttools you find a reportlab-pen wich can be used to draw glyphshapes on a PDF canvas.
Logged
ufuehrmann
Newbie
*

Karma: +0/-0
Posts: 3


View Profile
« Reply #2 on: October 29, 2008, 02:00:21 PM »

Thanks Eigi,
I'm dealing with PostScript fonts, so your hint doesn't help.
Does anybody know if the export via Python to .eps has been implemented in FontLab 5.04? This would solve my problems.
Tia
Uwe
Logged
Eigi
Newbie
*

Karma: +2/-0
Posts: 17



View Profile WWW
« Reply #3 on: November 02, 2008, 06:27:20 AM »

Hello Uwe,

You can use the reportlab-pen with PS or TT outlines. Since you are in FontLab the fontformat (Type 1 or OTF or what ever) does not matter.

You can also wirte your own pen to create .eps files. Use fonttools.pens.basePen._TestPen as an example.

Eigi
« Last Edit: November 02, 2008, 08:01:20 AM by Eigi » Logged
Eigi
Newbie
*

Karma: +2/-0
Posts: 17



View Profile WWW
« Reply #4 on: November 02, 2008, 08:06:25 AM »

Hello Uwe,

You may try the attached script. It is a very simple one. It exports only the current glyph and it works only with PS outlines. But it don't needs any additional modules (except os and time).
It may serve as a starter for you.

r
Eigi
Logged
solfeggio
Newbie
*

Karma: +1/-0
Posts: 6


View Profile
« Reply #5 on: November 02, 2008, 12:53:37 PM »

Eigi,

You might wish to more closely compare the output of your script with that produced by FontLab's "export as EPS" routine.

Attached are two exports of the uppercase "S" glyph from FreeSans: done once with the script (S_Eigi_.eps) and again with FontLab's export command (S_FLab_.eps). Their internal structure reads quite differently.

Also, for whatever it may be worth (perhaps nothing at all), the "FLab" version is readable by Illustrator and Photoshop whereas the "Eigi" version isn't so.

To be clear: this isn't a complaint, just an observation.

Thanks & best regards.
Logged
Eigi
Newbie
*

Karma: +2/-0
Posts: 17



View Profile WWW
« Reply #6 on: November 02, 2008, 02:42:16 PM »

Solfeggio,

Thanks for the hint. A EPS file must start with "%!PS-Adobe-3.0 EPSF-3.0" in the very first line. The EPS flies generated by my script starts with an empty line.

...fixed

Rgards
Eigi
Logged
solfeggio
Newbie
*

Karma: +1/-0
Posts: 6


View Profile
« Reply #7 on: November 02, 2008, 05:56:32 PM »

The new version of the script works fine. Thanks again.
Logged
ufuehrmann
Newbie
*

Karma: +0/-0
Posts: 3


View Profile
« Reply #8 on: November 14, 2008, 04:20:02 AM »

Hi Eigi,

I'm a bit late for the test of your script! It works like a treat. Many thanks!

Uwe
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.4 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!