mozilla / zilla-slab

Mozilla's Zilla Slab Type Family
SIL Open Font License 1.1
419 stars 29 forks source link

Zilla Highlight in Google Docs has extra space appended to end of sentence #18

Closed m4rc1e closed 7 years ago

m4rc1e commented 7 years ago

This issue was reported to me in an email thread.

Zilla Highlight uses a liga OpenType feature to make the space appear highlighted by replacing the space glyph with a black variant.

lookup BLACKSPACE {
                sub space by space.black;
                sub uni00A0 by space.black;
            } BLACKSPACE;

Google Docs appends a   (uni00A0) to the end of user input.

<span class="kix-wordhtmlgenerator-word-node" style="...">Hello World<span class="goog-inline-block" style="...">&nbsp;</span>

This unfortunately produces the following: screen shot 2017-08-14 at 11 13 10

It should look like this: screen shot 2017-08-14 at 11 12 49

The easiest solution is to drop uni00A0 from the BLACKSPACE lookup:

lookup BLACKSPACE {
                sub space by space.black;
            } BLACKSPACE;

I'm wondering if anyone can think of any unforeseen consequences by doing this?

moyogo commented 7 years ago

I'm wondering if anyone can think of any unforeseen consequences by doing this?

Some people use uni00A0 on purpose between words or before and after punctuation.

m4rc1e commented 7 years ago

@moyogo This was an assumption I had. Thank you!

davelab6 commented 7 years ago

Right, so if anyone else uses nbsp on purpose, then they won't get the 'blackout' effect in the middle of those words, if Marc changes the feature only to remove the sub uni00A0 by space.black; rule.

The docs for the family could tell people who need to use nbsp with blackout to use another character that does the same thing (https://en.wikipedia.org/wiki/Non-breaking_space#Width_variation) and change that rule to one that uses those other non breaking space characters.

moyogo commented 7 years ago

How about substituting uni00A0 only in that context (at the end of the line)?

davelab6 commented 7 years ago

You mean, substituting it only when it is followed by another character?

m4rc1e commented 7 years ago

Thanks @moyogo. I've rewritten the feature in the following manner:

sub space by space.black;
sub uni00A0' @all by space.black;

This does the following:

Here's a demo of the liga feature being enabled and disabled. The text uses uni00A0 instead of spaces. A uni00A0 glyph has also been appended to the end to mimic the same pattern as GF Docs. It seems to be working just fine. zilla-slab

I'll make a quick test font now and try it out in GF Docs.

m4rc1e commented 7 years ago

The string below has uni00A0 instead of a space... its works nicely.

screen shot 2017-08-15 at 11 52 41

@davelab6 shall we proceed with this contextual sub approach?

davelab6 commented 7 years ago

Great work everyone!

On Sep 1, 2017 2:31 AM, "Alex Gibson" notifications@github.com wrote:

Closed #18 https://github.com/mozilla/zilla-slab/issues/18.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mozilla/zilla-slab/issues/18#event-1230820158, or mute the thread https://github.com/notifications/unsubscribe-auth/AAP9y0cZpSOdHCjHQc5BSPvy3Haz2lyJks5sd6TcgaJpZM4O2Mi7 .