Skip to content

Python 3.5+ ligatures addLookup results in "OpenType tags must be represented strings" #3057

@pelson

Description

@pelson

I have FF from git at tag 20161012. I'm on OSX Yosemite, and have compiled FF with:

./bootstrap --force

# Tell fontforge where it can find PANGO.
export PANGO_CFLAGS=-i${PREFIX}/include/pango-1.0
export PANGO_LIBS=-lpango-1.0
    
# Turn off the X11 interface - we just want the python package.
./configure --prefix=${PREFIX} --without-x --without-cairo
make
make install

I create a font with:

import fontforge

font = fontforge.font()
font.encoding = "UnicodeFull"

# We also create a ligature lookup table.
font.addLookup('ligatures', 'gsub_ligature', (), [['liga', [['latn', ['dflt']]]]])

On python2, this works. On python3.5+, I get the following traceback:

Traceback (most recent call last):
  File "support/shortened.py", line 7, in <module>
    font.addLookup('ligatures', 'gsub_ligature', (), [['liga', [['latn', ['dflt']]]]])
TypeError: OpenType tags must be represented strings

I've tested this to fail on both python3.5 and python3.6.

In addition, I'm entirely unable to compile from source on master (@ b8e5ff8 currently). I get the following compilation error:

libtool: compile:  gcc -g -O2 -arch x86_64 -arch i386 -g -c -I../inc -I../inc -I../lib -I../lib -DSHAREDIR=\"/Users/pelson/miniconda/envs/fontforge_py35/share/fontforge\" -DDOCDIR=\"/Users/pelson/miniconda/envs/fontforge_py35/share/doc/fontforge\" -I../uthash/src -I../uthash/src -DFF_UTHASH_GLIF_NAMES=1 -DPLUGINDIR=\"/Users/pelson/miniconda/envs/fontforge_py35/lib/fontforge/plugins\" -I/Users/pelson/miniconda/envs/fontforge_py35/include -D_REENTRANT -I/Users/pelson/miniconda/envs/fontforge_py35/include/glib-2.0 -I/Users/pelson/miniconda/envs/fontforge_py35/lib/glib-2.0/include -I/Users/pelson/miniconda/envs/fontforge_py35/include -i/Users/pelson/miniconda/envs/fontforge_py35/include/pango-1.0 -I/Users/pelson/miniconda/envs/fontforge_py35/include/freetype2 -I/Users/pelson/miniconda/envs/fontforge_py35/include/libxml2 -I/Users/pelson/miniconda/envs/fontforge_py35/include -I/Users/pelson/miniconda/envs/fontforge_py35/include/python3.5m -Qunused-arguments -pthread -I/ ./splinerefigure.c  -fno-common -DPIC -o .libs/splinerefigure.o
In file included from ./splinerefigure.c:34:
In file included from ./splineutil.h:6:
In file included from ./views.h:32:
In file included from ./ffglib.h:27:
In file included from /Users/pelson/miniconda/envs/fontforge_py35/include/glib-2.0/glib.h:30:
In file included from /Users/pelson/miniconda/envs/fontforge_py35/include/glib-2.0/glib/galloca.h:32:
/Users/pelson/miniconda/envs/fontforge_py35/include/glib-2.0/glib/gtypes.h:423:3: error: '_GStaticAssertCompileTimeAssertion_0' declared as an array with a negative
      size
  G_STATIC_ASSERT(sizeof (unsigned long long) == sizeof (guint64));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/pelson/miniconda/envs/fontforge_py35/include/glib-2.0/glib/gmacros.h:232:103: note: expanded from macro 'G_STATIC_ASSERT'
#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
                                                                                                      ^~~~~~~~~~~~~~~
1 error generated.
make[2]: *** [splinerefigure.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

with

$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions