robotools / compositor

A basic OpenType GSUB and GPOS layout engine.
MIT License
31 stars 11 forks source link

more py23 fixes #10

Closed adrientetar closed 8 years ago

adrientetar commented 8 years ago

@typesupply I haven't tested _nameToString on Python 2, maybe best to test it before merging. Anyhow, it should be more robust than the current decoding code.

adrientetar commented 8 years ago

3rd time's a charm.

anthrotype commented 8 years ago

:+1:

anthrotype commented 8 years ago

sorry again. I don't know compositor's code much, but.. wouldn't it be better if it always uses unicode strings on both python 2 and 3 (i.e. toUnicode instead of version-specific toStr).

adrientetar commented 8 years ago

Well, I thought these strings are to be consumed by the user and as such should be in each version's preferred form. But what the current code is doing, it looks like it's assuming utf16-be and unpadding it. So that would be unicode.

I'll change to use toUnicode() then.

typesupply commented 8 years ago

FWIW, that name extraction is very old and probably very rarely used. The idea was to get basic, RoboFab-like naming info from the binary for reference. I wrote the code and I don't recall ever even using it myself.

typesupply commented 8 years ago

Oh, but the stylistic set naming info is used by defconAppKit's GSUB/GPOS controls.

anthrotype commented 8 years ago

so the question would be, can the client handle unicode strings or is expecting bytes, and if so, with which encoding? The first option should be preferable (using unicode wherever possible).

typesupply commented 8 years ago

Unicode strings.

anthrotype commented 8 years ago

ok. so the current patch should work.