[HarfBuzz] MS/Symbol cmap subtables

Behdad Esfahbod behdad at behdad.org
Mon Jan 15 14:46:15 UTC 2018


Hi Eric,

On Mon, Jan 15, 2018 at 2:25 AM, Eric Muller <emuller at amazon.com> wrote:

> It seems that with a font that has only a 3, 0 cmap subtable (and may be
> some macintosh subtables), then HB will automatically do the shift by F000
> (in the function get_glyph_from_symbol) for code points below U+00FF that
> are not mapped by the subtable.
>

Right. Only in hb-ot-func though. Client font funcs can do otherwise.



> It is clear that when U+0041 A is set with a symbol font, then that U+0041
> has actually the semantics of a PUA code point, and certainly should not be
> treated as an "A". That's the whole point of a 3,0 cmap subtable.
>

Correct.


> Consider an HTML page. The font-family is only a request and there is no
> guarantee that the actual font will or will not be a symbol font. Thus the
> semantic of the HTML page can change depending on the browser environment.
> Outside a browser, it seems that the safe treatment is therefore to
> consider all code points below U+00FF as PUA, which is clearly not tenable.
> So in that environment, I think that the shift should not be done. Of
> course, U+F041 should work.
>

My take on this is that it's a bug of the font fallback logic if it falls
back to a symbol font.  I changed fontconfig to never do that.


> Note that behavior of Word 2016 on Windows is actually more elaborate:
> enter U+0041, and set it with a non-symbol font; copy/paste or save to a
> text file, and the result is U+0041; but set this A in a symbol font, and
> copy/paste or save to a text file, and the result is U+F041.
>

That's good behavior, but beyond what HarfBuzz can do.


> I think that the shift should be controllable by the client, rather than
> systematically applied. I don't have a strong opinion about the default
> behavior (i.e. when HB's client does not specify whether the shift should
> be done or not).
>

What would clients do with that control then? How would they set it?

I implemented this shift in fontconfig and then harfbuzz because in
LibreOffice and other software, there were existing documents that referred
to windings or other symbol fonts and encoding characters in the ASCII
range. It's clear that if the symbol font is asked by name, we should do
the shift. If it's NOT, then it should not be chosen to render text to
begin with, which means the shift can be applied unconditionally.

How does that sound?
behdad


> Thoughts?
>
> Thanks,
> Eric.
>

-- 
behdad
http://behdad.org/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/harfbuzz/attachments/20180115/6cb19e87/attachment.html>


More information about the HarfBuzz mailing list