[9] RFR JDK-8147002:[macosx] Arabic character cannot be rendered on MacOS X

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[9] RFR JDK-8147002:[macosx] Arabic character cannot be rendered on MacOS X

prasanta sadhukhan

Hi All,

Please review a fix for an issue which causes arabic character "alef" to be not rendered in osx for menlo font in italic style.

Bug: https://bugs.openjdk.java.net/browse/JDK-8147002

The issue was actually a regression caused by the fix to JDK-7162125: [macosx] A font has different behaviour for ligatures depending on its creation mode
in which we have added cascaded font list to find the real fonts that CFont uses, so that there is no need to use "negative" glyph code for finding the fallback fonts
using the "subsititution"/"fallback" mechanism used by osx code.

However, the above logic of using cascaded font list in CFont does not take into account of using JRE provided fonts like all those Lucida* ttf in jdk/lib/fonts/, so
when a glyph (in this intance, arabic 'alef' character) is intended to be rendered in Menlo font in italic style, osx will not be able to find the glyph in Menlo-Italic font
and neither in all the cascaded system fonts provided by CoreText, so it results in empty box.

Before 7162125 fix, the fallback code in
CoreTextSupport.m#CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode() uses JRSFontCreateFallbackFontForCharacters()
was adding jre/lib/fonts to the fallback list which was causing the glyph to be found in "LucidaBrightRegular.ttf" font and the glyph was rendered.

So, the proposed fix is to add jre provided font "Lucida Sans Regular" to the cascaded list so that we get the "alef" glyph.
The reason for choosing "Lucida Sans Regular" over "Lucida Bright Regular" is, because it is the largest font file in jre and has all the glyph codepoints that no other font in the jre has,
so we will not lose out on any codepoints and will help us in not getting missing glyph.

webrev: http://cr.openjdk.java.net/~psadhukhan/8147002/webrev.00/

Regards
Prasanta
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [9] RFR JDK-8147002:[macosx] Arabic character cannot be rendered on MacOS X

Philip Race
I am OK with this if you can confirm that removing Lucida Sans Regular from the JDK does not cause any nasty exceptions.

Apple use the PostScript name but our lookup code should work for the TrueType name.

So overall I think this should be fine - from visual inspection - and assuming it has been tested :-)

+1

-phil.

On 2/9/17, 1:08 AM, Prasanta Sadhukhan wrote:

Hi All,

Please review a fix for an issue which causes arabic character "alef" to be not rendered in osx for menlo font in italic style.

Bug: https://bugs.openjdk.java.net/browse/JDK-8147002

The issue was actually a regression caused by the fix to JDK-7162125: [macosx] A font has different behaviour for ligatures depending on its creation mode
in which we have added cascaded font list to find the real fonts that CFont uses, so that there is no need to use "negative" glyph code for finding the fallback fonts
using the "subsititution"/"fallback" mechanism used by osx code.

However, the above logic of using cascaded font list in CFont does not take into account of using JRE provided fonts like all those Lucida* ttf in jdk/lib/fonts/, so
when a glyph (in this intance, arabic 'alef' character) is intended to be rendered in Menlo font in italic style, osx will not be able to find the glyph in Menlo-Italic font
and neither in all the cascaded system fonts provided by CoreText, so it results in empty box.

Before 7162125 fix, the fallback code in
CoreTextSupport.m#CTS_CopyCTFallbackFontAndGlyphForJavaGlyphCode() uses JRSFontCreateFallbackFontForCharacters()
was adding jre/lib/fonts to the fallback list which was causing the glyph to be found in "LucidaBrightRegular.ttf" font and the glyph was rendered.

So, the proposed fix is to add jre provided font "Lucida Sans Regular" to the cascaded list so that we get the "alef" glyph.
The reason for choosing "Lucida Sans Regular" over "Lucida Bright Regular" is, because it is the largest font file in jre and has all the glyph codepoints that no other font in the jre has,
so we will not lose out on any codepoints and will help us in not getting missing glyph.

webrev: http://cr.openjdk.java.net/~psadhukhan/8147002/webrev.00/

Regards
Prasanta
Loading...