mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 476378. Use U+002D instead of U+2010 for a soft hyphen if the first font in the fontgroup doesn't have a glyph for U+2010. r+sr=roc
This commit is contained in:
parent
410d311d40
commit
534bc96e01
@ -1463,14 +1463,15 @@ GetHyphenTextRun(gfxTextRun* aTextRun, gfxContext* aContext, nsTextFrame* aTextF
|
||||
gfxFontGroup* fontGroup = aTextRun->GetFontGroup();
|
||||
PRUint32 flags = gfxFontGroup::TEXT_IS_PERSISTENT;
|
||||
|
||||
// only use U+2010 if it is supported by the first font in the group;
|
||||
// it's better to use ASCII '-' from the primary font than to fall back to U+2010
|
||||
// from some other, possibly poorly-matching face
|
||||
static const PRUnichar unicodeHyphen = 0x2010;
|
||||
gfxTextRun* textRun =
|
||||
gfxTextRunCache::MakeTextRun(&unicodeHyphen, 1, fontGroup, ctx,
|
||||
aTextRun->GetAppUnitsPerDevUnit(), flags);
|
||||
if (textRun && textRun->CountMissingGlyphs() == 0)
|
||||
return textRun;
|
||||
|
||||
gfxTextRunCache::ReleaseTextRun(textRun);
|
||||
gfxFont *font = fontGroup->GetFontAt(0);
|
||||
if (font && font->HasCharacter(unicodeHyphen)) {
|
||||
return gfxTextRunCache::MakeTextRun(&unicodeHyphen, 1, fontGroup, ctx,
|
||||
aTextRun->GetAppUnitsPerDevUnit(), flags);
|
||||
}
|
||||
|
||||
static const PRUint8 dash = '-';
|
||||
return gfxTextRunCache::MakeTextRun(&dash, 1, fontGroup, ctx,
|
||||
|
@ -6,7 +6,7 @@
|
||||
</head>
|
||||
<body dir="rtl">
|
||||
<p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכל</p>
|
||||
<p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת‐<br>אבגדהוזחטיכלמנסעפצקרשת</p>
|
||||
<p>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשתאבגדהוזחטיכלמנסעפצקרשת-<br>אבגדהוזחטיכלמנסעפצקרשת</p>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
|
19
layout/reftests/text/476378-soft-hyphen-fallback-ref.html
Normal file
19
layout/reftests/text/476378-soft-hyphen-fallback-ref.html
Normal file
@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Soft hyphen font fallback (for bug 476378)</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- On OS X, Hoefler Text has a distinctive hyphen; on Windows, Segoe UI does.
|
||||
In each case U+2010 will fall back to a font with a very different glyph. -->
|
||||
<div style="width: 50pt;
|
||||
font-family: Hoefler Text, Segoe UI, Trebuchet MS, Lucida Grande;
|
||||
font-size: 24pt;">
|
||||
|
||||
<!-- reference text uses an explicit ASCII hyphen at the expected break point -->
|
||||
<p>aaa-<br>aa</p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
19
layout/reftests/text/476378-soft-hyphen-fallback.html
Normal file
19
layout/reftests/text/476378-soft-hyphen-fallback.html
Normal file
@ -0,0 +1,19 @@
|
||||
<html>
|
||||
<head>
|
||||
<title>Soft hyphen font fallback (for bug 476378)</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- On OS X, Hoefler Text has a distinctive hyphen; on Windows, Segoe UI does.
|
||||
In each case U+2010 will fall back to a font with a very different glyph. -->
|
||||
<div style="width: 50pt;
|
||||
font-family: Hoefler Text, Segoe UI, Trebuchet MS, Lucida Grande;
|
||||
font-size: 24pt;">
|
||||
|
||||
<!-- test whether soft-hyphen gets rendered from the primary font -->
|
||||
<p>aaa­aa</p>
|
||||
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
@ -32,3 +32,4 @@ random-if(MOZ_WIDGET_TOOLKIT=="gtk2") != zwnj-01.html zwnj-01-notref.html # Bad
|
||||
fails-if(MOZ_WIDGET_TOOLKIT=="windows") == cgj-01.html cgj-01-ref.html # bug 455455
|
||||
== 444656.html 444656-ref.html
|
||||
== 449555-1.html 449555-1-ref.html
|
||||
== 476378-soft-hyphen-fallback.html 476378-soft-hyphen-fallback-ref.html
|
||||
|
@ -2,11 +2,11 @@
|
||||
<body>
|
||||
|
||||
<div>
|
||||
<p>Hy‐<br>phen.
|
||||
<p>Hy‐<br>phen.
|
||||
<p>Hy‐<br>phen.
|
||||
<p>Hy‐<br>phen.
|
||||
<p>Hy‐<br>phen.
|
||||
<p>Hy-<br>phen.
|
||||
<p>Hy-<br>phen.
|
||||
<p>Hy-<br>phen.
|
||||
<p>Hy-<br>phen.
|
||||
<p>Hy-<br>phen.
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user