Commit 5caf9f8e authored by eae@chromium.org's avatar eae@chromium.org

Handle missing glyphs when adjusting spacing in SimpleShaper

Handle the case where the space glyph is used instead of a missing zero-
width-space, soft-hypen or non-printable space glyph when adjusting the
spacing in SimpleShaper::advanceInternal.

TEST=fast/text/soft-hyphen-simple-text.html
BUG=422050
R=pdr@chromium.org

Review URL: https://codereview.chromium.org/648293003

git-svn-id: svn://svn.chromium.org/blink/trunk@183685 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 906aa01c
<!DOCTYPE html>
<html>
<head>
<title>Soft Hyphen Test</title>
<style>
p {
text-align: justify;
width: 250px;
height: 250px;
position: relative;
padding: 1px;
}
p > #cover {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: green;
display: block;
}
</style>
</head>
<body>
<p>
&nbsp;
<span id="cover">&nbsp;</span>
</p>
<p>
A green square and no text should appear above.
</p>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>Soft Hyphen Test</title>
<style>
p {
text-align: justify;
width: 250px;
height: 250px;
position: relative;
padding: 1px;
}
p > #cover {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: green;
display: block;
}
</style>
</head>
<body>
<p>
Lorem ipsu&shy;m dol&shy;or sit amet, consec&shy;tetur
ad&shy;ipi&shy;sci&shy;ng elit. Ve&shy;sti&shy;bul&shy;um
va&shy;rius, to&shy;rto&shy;r nec ti&shy;nci&shy;dunt
ali&shy;qu&shy;am, enim ve&shy;lit sem&shy;per nu&shy;lla,
al&shy;iqu&shy;am co&shy;ndim&shy;ent&shy;um est er&shy;at
nec mau&shy;ris. Nam sed ju&shy;sto at nu&shy;nc sem&shy;per
al&shy;iqu&shy;et sed sed nu&shy;lla. Nulla sit am&shy;et
od&shy;io a di&shy;am ves&shy;tib&shy;ulu&shy;m
ve&shy;hic&shy;ula sed vel la&shy;cus. Lor&shy;em ipsum
dolor sit amet, consectetur adipiscing elit. Phasellus
in vestibulum nisl. Nam ti&shy;ncid&shy;unt magna sed
ris&shy;us bl&shy;and&shy;it sa&shy;gitt&shy;is.
Ph&shy;as&shy;ell&shy;us a im&shy;per&shy;di&shy;et mi.
<span id="cover">&nbsp;</span>
</p>
<p>
A green square and no text should appear above.
</p>
</body>
</html>
......@@ -190,10 +190,12 @@ unsigned SimpleShaper::advanceInternal(TextIterator& textIterator, GlyphBuffer*
// Some fonts do not have a glyph for zero-width-space,
// in that case use the space character and override the width.
float width;
bool spaceUsedAsZeroWidthSpace = false;
if (!glyphData.glyph && Character::treatAsZeroWidthSpaceInComplexScript(charData.character)) {
charData.character = space;
glyphData = glyphDataForCharacter(charData);
width = 0;
spaceUsedAsZeroWidthSpace = true;
} else {
width = characterWidth(charData.character, glyphData);
}
......@@ -207,7 +209,7 @@ unsigned SimpleShaper::advanceInternal(TextIterator& textIterator, GlyphBuffer*
cacheFallbackFont(fontData, primaryFont);
}
if (hasExtraSpacing)
if (hasExtraSpacing && !spaceUsedAsZeroWidthSpace)
width = adjustSpacing(width, charData, *fontData, glyphBuffer);
if (m_bounds)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment