New to Typophile? Accounts are free, and easy to set up.
Hello there:
As there is nothing like Prepolator for PC....
I'm thinking of some kind of basic script to help PC users to prepare fonts for "mask to master" interpolation.
Nothing too complex, maybe something simple like this:
For each glyph in the current open font:
- Count number of points
- Count number of contours
- Save list as .txt file, or just output somewhere that can be copied and pasted.
So, we can run the script in 2 fonts, open the list in excel & quickly find the glyphs that needs more tunning to be compatible.
Can this be done? Where do I star looking for info to code this?
Thanks in advance.
10 Nov 2010 — 6:13pm
Superpolator comes with a Fontlab/robofab script that does this. Superpolator does not deign to run on PCs, but you might be able to get Erik to license the script.
11 Nov 2010 — 2:31am
You can use the robofab framework. A robofab glyph has a "isCompatible" method:
isCompatible(self, otherGlyph, report=True):
"""Return a bool value if the glyph is compatible with otherGlyph.With report = True, isCompatible will return a report of what's wrong. The interpolate method requires absolute equality between contour data. Absolute equality is preferred among component and anchor data, but it is NOT required. Interpolation between components and anchors will only deal with compatible data and incompatible data will be ignored. This method reflects this system."""
... and it works on PC
Eigi
11 Nov 2010 — 8:38am
Thanks Andreas, that's great!
15 Nov 2010 — 1:23am
from robofab.world import CurrentFont,CurrentGlyph
font = CurrentFont()
# make a list to collect your data
stuff = []
# naming attributes
stuff.append(font.info.fullName)
stuff.append('---------------------------------------------------------')
for glyph in font:
stuff.append(' ')
stuff.append(glyph.name)
stuff.append("(glyph has %d contour)" % len(glyph))
stuff.append('-------------------------------')
for contour in glyph:
#stuff.append(`contour`)
stuff.append(" This contour has %d segments" % len(contour.segments))
# make up a path where you want to save
# if you run this script in fontlab
# you need to provide a full path
import os.path
path = os.path.join( os.path.split(fl.font.file_name)[0] , "segmentos.txt")
f = open(path, 'w')
f.write("\r".join(stuff))
f.close
15 Nov 2010 — 1:29am
IMPORTANTE: cortar y pegar en FL y poner las indentaciones tal como muestra la imagen que adjunto (sino no anda).
15 Nov 2010 — 11:32am
Thanks Ramiro!
Works great