13rac1 / scfbuild

Create OpenType-SVG color fonts from a set of SVG source files.
GNU General Public License v3.0
81 stars 12 forks source link

Error: unichr() arg not in range #16

Closed b-g closed 6 years ago

b-g commented 6 years ago

Hi there!

I'm having trouble to generate fonts with complex ligatures like 🏳️‍🌈1F3F3-FE0F-200D-1F308 or 👩‍⚕️1F469-200D-2695-FE0F. Is there a special file convention I'm not aware of?

It works out of the box for simple ones like 🏝1F3DD or 🎣1F3A3, yay!!

Here is also a self containing folder with my issue in an isolated way: OpenMoji-Colorfont-POC.zip

Sorry to bother again!

Log:

$ scfbuild/bin/scfbuild -c scfbuild.yml 
INFO:scfbuild.builder:Creating a new font
DEBUG:scfbuild.fforge:Space character width: 561
INFO:scfbuild.builder:Adding glyphs and ligatures
DEBUG:scfbuild.fforge:Creating glyph at 0xa9 for black/svg/00A9.svg
DEBUG:scfbuild.util:Found SVG width/height (72.00/72.00)
DEBUG:scfbuild.fforge:Set glyph width/height (2048/2048)
DEBUG:scfbuild.fforge:Translate glyph (0, 0)
DEBUG:scfbuild.fforge:Creating glyph at 0x1f3a3 for black/svg/1F3A3.svg
DEBUG:scfbuild.util:Found SVG width/height (72.00/72.00)
DEBUG:scfbuild.fforge:Set glyph width/height (2048/2048)
DEBUG:scfbuild.fforge:Translate glyph (0, 0)
DEBUG:scfbuild.fforge:Creating glyph at 0x1f3dd for black/svg/1F3DD.svg
DEBUG:scfbuild.util:Found SVG width/height (72.00/72.00)
DEBUG:scfbuild.fforge:Set glyph width/height (2048/2048)
DEBUG:scfbuild.fforge:Translate glyph (0, 0)
DEBUG:scfbuild.fforge:Creating ligature glyph 1F3F3-FE0F-200D-1F308
Traceback (most recent call last):
  File "scfbuild/bin/scfbuild", line 17, in <module>
    sys.exit(main())
  File "/Users/bene/Desktop/OpenMoji Colorfont Test/scfbuild/scfbuild/main.py", line 124, in main
    return builder.run()
  File "/Users/bene/Desktop/OpenMoji Colorfont Test/scfbuild/scfbuild/builder.py", line 58, in run
    fforge.add_glyphs(ff_font, svg_filepaths, self.conf)
  File "/Users/bene/Desktop/OpenMoji Colorfont Test/scfbuild/scfbuild/fforge.py", line 87, in add_glyphs
    u_str = ''.join(map(unichr, u_ids))
ValueError: unichr() arg not in range(0x10000) (narrow Python build)
13rac1 commented 6 years ago

Narrow Python... what?!?! I had no idea this was a thing or even an option. Details: https://stackoverflow.com/questions/25111521/how-to-install-python-on-mac-with-wide-build

I would have written this in Python3 instead of Python2 if FontForge supported Python3, but it doesn't. Easiest option is to run this within Docker, but maybe I just say that because I deal with an inordinate amount of Docker nowadays.

b-g commented 6 years ago

@eosrei Wow this is really esoteric! :) Many thanks for clarification!

Never used docker ... but skimmed over some tutorials on the weekend. Seems doable for me or at least worth a try. Especially as getting the "wide-build" to run on 20 diverse students computer would be a nightmare (we have an upcoming OpenMoji workshop).

Could you give me some guidance e.g. FROM which image should I based everything (there a plenty of Python2 and host OS choices)? 🙏

13rac1 commented 6 years ago

Another option which may be easier to use VirtualBox with a regular Ubuntu install. YMMV I guess.

Use the Docker https://hub.docker.com/_/ubuntu/ image. Most recent LTS is 18.04.