googlefonts / ufo2ft

A bridge from UFOs to FontTools objects (and therefore, OTFs and TTFs).
MIT License
151 stars 43 forks source link

Support cmap format 13: Many-to-one range mappings #556

Open m4rc1e opened 2 years ago

m4rc1e commented 2 years ago

Just had a quick skim of the codebase and I don't think we support this.

We're releasing a family called Redacted which would really benefit from this format, https://github.com/google/fonts/pull/4004. The font in question simply redacts text by using boxes instead of letters, ▉ ▉ ▉ ▉ ▉ ▉.

https://docs.microsoft.com/en-us/typography/opentype/spec/cmap#format-13-many-to-one-range-mappings

I'll happily submit a pr for this if people think it would be a good addition.

anthrotype commented 2 years ago

well, we do support multiple unicode codepoints associated with the same glyph

https://github.com/googlefonts/ufo2ft/blob/006059f9dead263e389e248165872dfee455fd96/Lib/ufo2ft/util.py#L207-L211

we just don't build a cmap13 out of it. Merely using the presence of more than one glyph.unicodes as a marker to determine whether one wants to build cmap13 is not ideal. It feels that cmap13 use is farily specialized for last-resort kind of fonts. How do you envision implementing this exactly?

behdad commented 2 years ago

ufo2ft should transparently choose format 13 if that's more compact than other formats.