Why Python is important? What are the first steps to work with it?

paulow's picture

Hi, wise people. Although I have many fonts, just now I am working hard to learn technical knowledge needed. Therefore, Python is one thing I would like to know, since two years ago. However, the last two times I tried to install it on my PC, I could not. So why is it important for the job? What are the first steps to work with it, including your installation?

Mark Simonson's picture

Making fonts without Python is like riding a bike without ever shifting out of first gear. It is possible, but it's a lot more work and takes a lot longer to get where you're going.

This page on the FontLab site has a very comprehensive overview, including installation instructions and links to other Python resources on the web: http://www.fontlab.com/python/

Richard Fink's picture

Thank you for the link, Mark.
paulow seems to be where I'm at - with the same questions. Time to get down with Python, it seems.

rich

Mark Simonson's picture

One thing to keep in mind, you don't need to know everything there is to know about Python for it to be useful. The basics -- loops, conditional statements, simple string operations -- combined with FontLab- or RoboFab-specific functions and data objects, will go a long way. I highly recommend RoboFab since it makes using Python in FontLab easier. This page is a good place to start: http://www.robofab.org/talks09/index.html

Khaled Hosny's picture

I, myself, started learning Python independent of using it in font development, but combined with FontForge's Python interface turned to be an integral part of my font development work flow, I can hardly do any font now without a bunch of Python scripts.

paulow's picture

Thanks, Mark. But I think I will need a book called "Python for Dummies" to get! RoboFab seems have only Mac versions, and I work with Windows 7. But I did install (aparently) the 3.1.2 Python version (self-installer).

After this I did add some python library files like NuggedMacros, accentTools, FeatureProof (this I did not try install), all downloaded from the pages which you indicates) to my macro folder at FontLab folder. But the 'Macro" tool at FontLab never shows nothing. Is not activated.

And yes, Richard, we need a lot of time to learn this stuff. My case is worst, because sometimes the language barrel is a problem, I speak portuguese, and my english is limited because I am a self-taugth english speaker.

jordydavies's picture

I am not sure I understand the value of Python in designing type fonts. Scripting is fine I suppose for some things, but people have designed fonts for years without Python so why use it? Can you show me an example of how it might make things simple or simpler? I have a new IMAC with OS 10.6.4 which apparently already has Python installed. What am I missing here?

Richard Fink's picture

@jordydavies
Your questions are good ones, I'm about to find out.
If anybody else wants to answer, I'd love to hear.

@mark
Luckily, I've gotten pretty good with more than one scripting language over the years, and that will help, I'm sure.

@paulow
"we need a lot of time to learn this stuff."
Yes, very time consuming. Especially at first. And it makes you feel like you're five years old again.
I thank the universe every day for being born in an English speaking country! Not because it's the best language or culture, but because it's still the language of computer coding. I give you much credit. I would go nuts - I have no natural talent for learning languages at all. (But when emersed, I find I start picking it up.)
Keep going and good luck.

Off to install.... and see if I can get something to work. I'll report.

Mark Simonson's picture

When I say it makes things simpler, I mean things that would be tedious or time-consuming to do otherwise, like renaming hundreds of glyphs.

Here are a few things that I've used Python and RoboFab for in FontLab:
- Renaming glyphs (especially when there are many)
- Automatically placing anchors in preparation for adding accents
- Manipulating composites in various ways
- Adding features and tools to FontLab (usually using scripts written by others)
- Importing and exporting UFO files
- Updating individual glyphs in external UFO files
- Running the Adobe autohinter
- Checking outlines and font integrity
- Generating fonts quickly for testing
- Manipulating masters in MM fonts
- Clearing hundreds of random master guidelines that sometimes get added because of a certain FontLab bug (FontLab has no "clear guidelines" command)
- Selecting a specific group of glyphs repeatedly (in different related fonts usually)
- Doing simple interpolations between two glyphs
- Manipulating outlines (adding bevels to corners, for example)

Some of these I've done using scripts I've written myself, but most of the examples above I do with scripts written by others (some free, some paid for).

For doing single fonts with basic character sets, the advantages might not be apparent, but once you start doing multi-weight families with hundreds of glyphs, it can make a big difference.

I remember a few years ago when I was working on some changes to Proxima Nova, a 42-font family. I don't remember exactly what I was doing to it (it was a few years ago), but I needed to do a long series of steps to each font. Working as fast as I could using just the built-in commands in FontLab, doing all these tedious steps, which affected dozens of glyphs in each font, and being careful not to make mistakes, I got it down to around half an hour for each font. Facing days of doing such a mind-numbing task, I was motivated to figure out a way to speed things up using Python scripting (which I had not done much before). I went through all the steps and identified where the bottlenecks were and which things could be accomplished using scripting. It took me less than a day to write the scripts I needed, reducing the time to make the changes to a few minutes for each font. I remember that one step went from about a 15 minutes down to a few seconds. It literally saved me days worth of work, and I'm sure I couldn't have done it as accurately manually. And I would have been bored out of my mind.

So, sure, it's possible to design fonts without using scripting, but when such a powerful lever is handed to you and the only cost is to take some time to learn how to use it, why not take advantage of it?

Mark Simonson's picture

Paulo: RoboFab does work on Windows, too. Details are on this page, about halfway down: http://www.robofab.com/install.html

Mark Simonson's picture

By the way, this Typographica article by Ben Kiel from about five years ago was what inspired to take this Python/Robofab scripting stuff more seriously: http://typographica.org/2005/on-typography/an-introduction-to-robofab/ .

paulow's picture

Thanks for the kind words, Richard. I will read now the advices from Mark, and try again, After this I will report here the progression of my work. I appreciate your reports, too.

paulow's picture

Mark, first, thanks for the patience to help us with this accurate explanation (I think its stolen a time from your time).

I will pick up the mostly important things which I think can help at my job, mainly:

- Renaming glyphs (especially when there are many) - In future, when I begin to create text fonts, for while I make only display

- Automatically placing anchors in preparation for adding accents, GOOD
- Manipulating composites in various ways, GOOD
- Adding features and tools to FontLab (usually using scripts written by others), GOOD
- Running the Adobe autohinter, SEEMS GOOD, but what is "Adobe autohinter" ?
- Checking outlines and font integrity, GOOD
- Clearing hundreds of random master guidelines that sometimes get added because of a certain FontLab bug (FontLab has no "clear guidelines" command) - I dont remember to see this kind of bug into here
- Doing simple interpolations between two glyphs, GOOD
- Manipulating outlines (adding bevels to corners, for example), GOOD

"So, sure, it's possible to design fonts without using scripting, but when such a powerful lever is handed to you and the only cost is to take some time to learn how to use it, why not take advantage of it?"

I think which the main question here is, in fact, a philosophical question: since Gutenberg, the technics to make fonts never stop to up. New tools was added along the centurys. So, we need, to exist like typographers, learn ever, or die.

But, is not possible which, in some years, these complicated tools of Python programing be added like easy human interfaces at FontLab? Like single buttons and panels self-instructives for dummies (like me sometimes)?

I will lear RoboFab and Python because my next natural step will be make accurate text fonts. But, I have fear which when I finish the lesson, someone has added single tools like all here listed in easy buttons at FontLab.

A last question: many of these resources, principally those which helps with extensive font projects seems good to high legible text fonts. You think which is good to script fonts? I request this because my actual works runs around a lot of script fonts

Thanks

paulow's picture

YES !!! Richard, follow my steps:

1
I did install first the Python 2.3
http://www.python.org/download/releases/2.3/

2
after I did install over, the Python for windows extensions
http://starship.python.net/crew/mhammond/win32/

3
some Pythons library which I did install yesterday at Macros folder (at FontLab root folder) are NOW RUNNING! The Macro tool at FontLab now works.

My next steps:

a - try the installation of RoboFab

b - try and learn to use the installed tools

c - after this, searh for more tools

Mark Simonson's picture

In the links below are some examples of what others have done to extend the features of FontLab, showing that using Python need not be complicated. Each of these was designed so that it looks and works like other features in FontLab, much the way plug-ins work in some programs. (Note: These are both commercial projects, but have free demo versions.) These are videos from the RoboFab conference back in early 2009.

"Remix Tools": http://letterror.blip.tv/file/1911354/
( http://remix-tools.com/ )

"Autopsy" visual font auditor: http://letterror.blip.tv/file/1911264/
( http://www.yanone.de/typedesign/autopsy/ )

(Note: There are ads at the beginning of these that you can't skip, but they are short.)

The Adobe autohinter is superior to FontLab's built-in autohinting. It's the tool that Adobe uses for all their fonts, and they provide it free along with their AFDKO (Adobe Font Development Kit for OpenType). It can be run from the command line on your computer, or from within FontLab by running a special Python script. ( http://www.adobe.com/devnet/opentype/afdko.html )

Regarding your last question, some kinds of fonts and projects will benefit more than others from the use of scripting, but all can benefit some.

Richard Fink's picture

@mark
I believe Fontographer natively uses the Adobe autohinter.
And thanks for all the tips and links. Will be looking at every one of them.

@paulow
I haven't been able to spend a lot of time as yet, but in about the hour I spent, I haven't been able to get a damned thing to work within Fontlab. I *have* gone through a lot of poorly organized documentation, though!
Fontlab says, "Macros? What macros?"
Getting it wrong is a part of getting it right. And most of the time, you learn more if at first you get it wrong.

Will follow your steps later today and see what happens.

rich

Mark Simonson's picture

Reportedly, the Adobe autohinter will be part of FontLab Studio 6, too. I've also heard that RoboFab and UFO support will be included. But who knows how long we'll have to wait for the new version? In the mean time, we have all that now, thanks to Python support in FontLab.

jordydavies's picture

Thanks everyone for the explanations.

dezcom's picture

Mark, Thanks for the "Autopsy" link!

Richard Fink's picture

I'm one of those poor souls who reads documentation. I just don't believe the documentation, that's my problem. (with good reason a lot of the time - especially if it seems out of date.)
So far, Python 2.7 isn't working for me. Going to the previous release as per paulow.

blank's picture

FYI, stick to running the autohinter from the command line. The version that runs as a macro doesn’t do everything the command line version does, and it’s default configuration allows it to change outlines when run, which is not a good thing.

Richard Fink's picture

OK - this is starting to read like a travelogue. But it is, I suppose.
I installed Py 2.3.5 because there's a Windows installer for it and I'm a point and click kind of guy.
It worked. Macros are now alive in FL.

I paid $650.00 for this fracking app so why I do I have to go through this? Why isn't it just there?

But anyway...

Py 2.4.6 *should* work based on what I'm reading but there's no Win Installer.
(Will it?)

The docs say this:

Unpack the archive with tar -zxvf Python-2.4.6.tgz (or bzcat Python-2.4.6.tar.bz2 | tar -xf -). Change to the Python-2.4.6 directory and run the "./configure", "make", "make install" commands to compile and install Python. The source archive is also suitable for Windows users who feel the need to build their own version.

This is all a bit greek to me. If anybody wants to add to the canon and explain this, step-by-step, I'm surely not the only person who would benefit.

Next, on to Robofab and beyond!

Mark Simonson's picture

I wish I could help with that, but I've only ever installed it on Macs. Perhaps some helpful Windows user who has had experience with it will pop in.

John Hudson's picture

Rich, there is a Windows installer for Python 2.4.4, which is the version I use with FLS5:

http://www.python.org/download/releases/2.4.4/

Richard Fink's picture

JH>Rich, there is a Windows installer for Python 2.4.4

Thanks much. Must have missed it. A lot of Python versions there are. (And why am I talking like Yoda?)

@paulow and all:
Regarding the Windows Extensions: not sure what benefit the Windows Extensions bring. Everything seems to be working quite nicely without it.
I am also totally even more in the dark about how to install it than I am the tar package of Py 2.4.6. In what directory does it go? Placed how? etc.....

BTW, had to chance to play with some scripts a little, too. This is cool, really.
And I can see how it would be great time saver.

Syndicate content Syndicate content