bug 553571 - try to avoid breaking font runs at ZWNJ when using font fallback, because Indic scripts require shaping across the ZWNJ character. r=roc

This commit is contained in:
Jonathan Kew 2011-07-01 07:38:14 +01:00
parent 456ca10684
commit ca191217c7
5 changed files with 21 additions and 2 deletions

View File

@ -2572,9 +2572,9 @@ gfxFontGroup::FindFontForChar(PRUint32 aCh, PRUint32 aPrevCh,
{
nsRefPtr<gfxFont> selectedFont;
// if this character or the previous one is a join-causer,
// if this character is a join-control or the previous is a join-causer,
// use the same font as the previous range if we can
if (gfxFontUtils::IsJoinCauser(aCh) || gfxFontUtils::IsJoinCauser(aPrevCh)) {
if (gfxFontUtils::IsJoinControl(aCh) || gfxFontUtils::IsJoinCauser(aPrevCh)) {
if (aPrevMatchedFont && aPrevMatchedFont->HasCharacter(aCh)) {
selectedFont = aPrevMatchedFont;
return selectedFont.forget();

View File

@ -755,6 +755,10 @@ public:
return (ch == 0x200D);
}
static inline bool IsJoinControl(PRUint32 ch) {
return (ch == 0x200C || ch == 0x200D);
}
enum {
kUnicodeVS1 = 0xFE00,
kUnicodeVS16 = 0xFE0F,

View File

@ -0,0 +1,6 @@
<html>
<body>
&#xD94;&#x200C;&#xDD8;
</body>
</html>

View File

@ -0,0 +1,6 @@
<html>
<body>
&#xD94;&#xDD8;
</body>
</html>

View File

@ -1477,6 +1477,9 @@ random-if(!haveTestPlugin) == 546071-1.html 546071-1-ref.html
== 551463-1.html 551463-1-ref.html
== 551699-1.html 551699-1-ref.html
== 552334-1.html 552334-1-ref.html
# 553571 depends on MS Indic shaping behavior and Win7 font support;
# not expected to be reliable on XP or non-Windows platforms
random-if(!winWidget) random-if(/^Windows\x20NT\x205/.test(http.oscpu)) != 553571-1.html 553571-1-notref.html # expect dotted circle in test, not in ref
random-if(d2d) == 555388-1.html 555388-1-ref.html
== 556661-1.html 556661-1-ref.html
fails-if(Android) == 557087-1.html 557087-ref.html