Pierre Hanser
2016-05-29 15:24:20 UTC
hello
I've a really small python script that tries to generate a BDF file from
a ttf one
--------------------------------
#!/usr/bin/env python
import sys, fontforge
def do1file(filename):
font = fontforge.open(filename)
size = 23
bpp = 4
u = tuple((((bpp << 16) + size), 25))
print u, type(u)
print "before", font.bitmapSizes
font.bitmapSizes = u
print "after", font.bitmapSizes
font.regenBitmaps(u)
print "regenerated"
font.generate("u.bdf", bitmap_resolution=100)
for name in sys.argv[1:]:
do1file(name)
------------
and the output is:
(262167, 25) <type 'tuple'>
before ()
Traceback (most recent call last):
File "./any2bdf.py", line 30, in <module>
do1file(name)
File "./any2bdf.py", line 18, in do1file
font.bitmapSizes = u
SystemError: new style getargs format but argument is not a tuple
I do not understand why my tuple is not recognized as such!
Any idea?
I use git current version of fontforge.
If I do it in graphical interface, as long as I defined LANG=C before
running fontforge, I can get the BDF correctly.
There is still the bug that if I run fontforge with LANG=fr_FR.UTF-8
the generation fails because the matching of bitmap sizes never succeed.
But this is not my current subject.
I've a really small python script that tries to generate a BDF file from
a ttf one
--------------------------------
#!/usr/bin/env python
import sys, fontforge
def do1file(filename):
font = fontforge.open(filename)
size = 23
bpp = 4
u = tuple((((bpp << 16) + size), 25))
print u, type(u)
print "before", font.bitmapSizes
font.bitmapSizes = u
print "after", font.bitmapSizes
font.regenBitmaps(u)
print "regenerated"
font.generate("u.bdf", bitmap_resolution=100)
for name in sys.argv[1:]:
do1file(name)
------------
and the output is:
(262167, 25) <type 'tuple'>
before ()
Traceback (most recent call last):
File "./any2bdf.py", line 30, in <module>
do1file(name)
File "./any2bdf.py", line 18, in do1file
font.bitmapSizes = u
SystemError: new style getargs format but argument is not a tuple
I do not understand why my tuple is not recognized as such!
Any idea?
I use git current version of fontforge.
If I do it in graphical interface, as long as I defined LANG=C before
running fontforge, I can get the BDF correctly.
There is still the bug that if I run fontforge with LANG=fr_FR.UTF-8
the generation fails because the matching of bitmap sizes never succeed.
But this is not my current subject.
--
Pierre
Pierre