googlefonts / roboto-2

The Roboto family of fonts
Apache License 2.0
3.85k stars 309 forks source link

U+0332 COMBINING LOW LINE and U+0333 COMBINING DOUBLE LOW LINE don't connect #98

Open roozbehp opened 9 years ago

roozbehp commented 9 years ago

According to Unicode, U+0332 COMBINING LOW LINE and U+0333 COMBINING DOUBLE LOW LINE should connect on left an right, creating an underline appearance for the whole phrase. But they don't. See the attached screenshot for the following text:

U+0331: A̱Ḇ U+0332: A̲B̲ U+0333: A̳B̳

The first line is correct, but the last two lines should connect instead of being disconnected. 400

dougfelt commented 9 years ago

In some fonts (haven't checked Noto) the underlines are at different heights on different characters, because of descenders in letters like lower case p and q. There is no limit to the length of the series of characters, so you might have to join and unify heights across twenty or more characters. I don't know that opentype can do this well.

If one could determine from font data what the position of an underline for a character should be, then a rendering engine could look for character sequences in which this combining mark (and precomposed characters with it?) occur in a series, and substitute text with no underline/double underline plus a generated underline adornment (like underline in higher-level protocols) at a height it determines from examining the ideal height for each character. It's not clear to me that you'd want to do that, but you could in principle.

A more doable approach is to design the glyphs such that the underscore matches the advance width and is at a uniform height (perhaps with breaks around descenders). This could look messy with double-underscore. Or you could drop the underscore below the descenders, but this is like a below mark and requires a larger line height/leading. And of course tracking/justification/kerning could break the underscores apart. At least, a unified height could allow opentype to handle this by just dealing with pairs of characters.

I note that Wikipedia says that U+0331 should also join. https://en.wikipedia.org/wiki/Macron_below

On Fri, Aug 21, 2015 at 11:01 AM, Roozbeh Pournader < notifications@github.com> wrote:

According to Unicode, U+0332 COMBINING LOW LINE and U+0333 COMBINING DOUBLE LOW LINE should connect on left an right, creating an underline appearance for the whole phrase. But they don't. See the attached screenshot for the following text:

U+0331: A̱Ḇ U+0332: A̲B̲ U+0333: A̳B̳

The first line is correct, but the last two lines should connect instead of being disconnected. [image: 400] https://cloud.githubusercontent.com/assets/302255/9415392/eb90be3e-47f3-11e5-8105-1c8ef7936756.png

— Reply to this email directly or view it on GitHub https://github.com/google/roboto/issues/98.

khaledhosny commented 9 years ago

The way I’m doing this is by creating multiple variants of the over/under line glyphs with different widths and substituting them contextually. I have a script that generates the variant glyphs and the substitution rules. To avoid creating too many glyphs, it puts the glyphs that have closer widths into groups and create one glyph and substitution rule for each group.

For this to work the marks need to be placed at the same level (I use the ascender for over line, and under line position for under line) which might not look always nice.

over_under

roozbehp commented 9 years ago

I'm with @khaledhosny! His solution makes a lot of sense to me.

@dougfelt, you are misreading the Wikipedia article. It says U+0332 (low line) joins, but U+0331 (macron below) doesn't.

dougfelt commented 9 years ago

Yes, sorry my mistake.

On Fri, Aug 21, 2015 at 12:32 PM, Roozbeh Pournader < notifications@github.com> wrote:

I'm with @khaledhosny https://github.com/khaledhosny! His solution makes a lot of sense to me.

@dougfelt https://github.com/dougfelt, you are misreading the Wikipedia article. It says U+0332 (low line) joins, but U+0331 (macron below) doesn't.

— Reply to this email directly or view it on GitHub https://github.com/google/roboto/issues/98#issuecomment-133538335.

moyogo commented 9 years ago

U+0305 and U+033F should behave the same way but above, they should connect as well.

brawer commented 5 years ago

Friendly ping?