Bug 20611

Summary: Cursive overlap too small
Product: DejaVu Reporter: Roozbeh Pournader <roozbeh>
Component: GeneralAssignee: Deja Vu bugs <dejavu-bugs>
Status: NEW --- QA Contact:
Severity: major    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Screenshot of gaps

Description Roozbeh Pournader 2009-03-11 15:49:25 UTC
Created attachment 23771 [details]
Screenshot of gaps

The current cursive overlap of cursive scripts (Arabic and N'Ko) in Sans and Sans Mono are 20 font units on each side (totaling 40). This results in distracting (and ugly) gaps between letters.

For example, see the attached screenshot, taken from this webpage in FireFox:

http://www.roozonline.com/archives/2009/03/post_11979.php

According to Microsoft, the overlap should be at least 70 font units, and should preferable be only at the left (trailing) side:

http://www.microsoft.com/typography/CursiveScriptGuidelines.mspx
Comment 1 Ben Laenen 2009-03-12 05:35:07 UTC
I'm tempted to mark this as wontfix. The gaps have to be solved with proper hinting anyway, and I'm quite sure that what you see in your screenshot is the result of the freetype autohinter. Disable autohinter and the gaps should be gone.

Also, more overlap will result in problems with the curves not aligning well for example, and when there's completely no hinting, it will give black blobs on the connections.
Comment 2 Roozbeh Pournader 2009-03-12 15:56:51 UTC
Yes, turning off autohinting solves the problem, but I don't think this is really an option. There would be systems with the autohinting on, and the gap would show. (I just turned it back on, to avoid the grayish feeling of text on my desktop which makes things unreadable.)

Also, I think Microsoft is quite aware that hinting would solve the problem. They recommend all fonts to be hinted (or embed bitmaps) anyway. But since there is no mention of hinting on the page, I wonder if there are cases that even proper hinting can't solve the problem. Microsoft's own Arabic fonts have both the hinting and the overlap.

Finally, I think your reasoning calls for no overlaps at all, not 20 units on each side.
Comment 3 Ben Laenen 2009-03-13 05:59:09 UTC
(In reply to comment #2)
> Yes, turning off autohinting solves the problem, but I don't think this is
> really an option. There would be systems with the autohinting on, and the gap
> would show. (I just turned it back on, to avoid the grayish feeling of text on
> my desktop which makes things unreadable.)

And we just can't solve things for the autohinter. The autohinter could easily become smarter here (it sees a coordinate beyond the glyph bounds → at least make sure that that is preserved after the hinting). And if the next version of freetype changed its autohinting algorithms we could adjust our glyphs again to match the new results. We've always ignored the autohinter bugs in our fonts, because we just can't fix things for it, as it's a running target and the target even moves by changing the options (slight/medium/hard hinting, subpixel or grayscale hinting).

Furthermore, there's nothing here that says the autohinter won't produce gaps when the overlap is increased 15 units to both sides.

> Also, I think Microsoft is quite aware that hinting would solve the problem.
> They recommend all fonts to be hinted (or embed bitmaps) anyway. But since
> there is no mention of hinting on the page, I wonder if there are cases that
> even proper hinting can't solve the problem. Microsoft's own Arabic fonts have
> both the hinting and the overlap.

Hinting solves it, it's the nature of how hinting works, as you can align the outlines to the pixel grid exactly. The overlap is only needed when the glyphs aren't hinted at all.

> Finally, I think your reasoning calls for no overlaps at all, not 20 units on
> each side.

No, because then you'll get gaps when the hinting is turned off... The 40 units overlap was chosen because it was at that point when the overlaps didn't produce the blobs (rendering the same letter twice at the same spot on top of each other will produce a thick look, as the gray pixels on the outlines are blackened, it's the same effect here), the curves near the connections could be preserved and the gaps weren't visible (all when rendered without hinting).

To me, the 70 units overlap on that page is just as arbitrarily chosen.

The overlap in DejaVu was really tested out when I've made the glyphs and this was how it looked best. If the autohinter makes a mess, that's the autohinter's problem and not something we can solve.

Actually it would be worse for the autohinter if we increased the overlap, as the autohinter could then think the oulines have to be rendered a pixel outside the glyph boundaries. Depending on the exact method (the light hinting options most likely) this can also result in black blobs on the connections.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.