mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Backed out changeset 4905048de8d1 (bug 1412355) for frequently failing reftest layout/reftests/writing-mode/1248248-1-orientation-break-glyphrun.html on Linux x64 debug and asan. r=backout
--HG-- extra : amend_source : 61e56c97354c788bfd03aa551e911a1aff14006e
This commit is contained in:
parent
c04d322a0a
commit
8968724f1a
@ -527,7 +527,8 @@ gfxCoreTextShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
|
||||
while (true) {
|
||||
gfxTextRun::DetailedGlyph *details = detailedGlyphs.AppendElement();
|
||||
details->mGlyphID = glyphs[glyphStart];
|
||||
details->mOffset.y = -positions[glyphStart].y * appUnitsPerDevUnit;
|
||||
details->mXOffset = 0;
|
||||
details->mYOffset = -positions[glyphStart].y * appUnitsPerDevUnit;
|
||||
details->mAdvance = advance;
|
||||
if (++glyphStart >= glyphEnd) {
|
||||
break;
|
||||
|
@ -151,6 +151,8 @@ gfxFT2Font::AddRange(const char16_t *aText, uint32_t aOffset,
|
||||
NS_ASSERTION(details.mGlyphID == gid,
|
||||
"Seriously weird glyph ID detected!");
|
||||
details.mAdvance = advance;
|
||||
details.mXOffset = 0;
|
||||
details.mYOffset = 0;
|
||||
gfxShapedText::CompressedGlyph g;
|
||||
g.SetComplex(charGlyphs[aOffset].IsClusterStart(), true, 1);
|
||||
aShapedText->SetGlyphs(aOffset, g, &details);
|
||||
|
@ -685,6 +685,8 @@ gfxShapedText::SetMissingGlyph(uint32_t aIndex, uint32_t aChar, gfxFont *aFont)
|
||||
mAppUnitsPerDevUnit)));
|
||||
details->mAdvance = uint32_t(width * mAppUnitsPerDevUnit);
|
||||
}
|
||||
details->mXOffset = 0;
|
||||
details->mYOffset = 0;
|
||||
GetCharacterGlyphs()[aIndex].SetMissing(1);
|
||||
}
|
||||
|
||||
@ -705,6 +707,8 @@ gfxShapedText::FilterIfIgnorable(uint32_t aIndex, uint32_t aCh)
|
||||
DetailedGlyph *details = AllocateDetailedGlyphs(aIndex, 1);
|
||||
details->mGlyphID = aCh;
|
||||
details->mAdvance = 0;
|
||||
details->mXOffset = 0;
|
||||
details->mYOffset = 0;
|
||||
GetCharacterGlyphs()[aIndex].SetMissing(1);
|
||||
return true;
|
||||
}
|
||||
@ -729,7 +733,7 @@ gfxShapedText::AdjustAdvancesForSyntheticBold(float aSynBoldOffset,
|
||||
// rare case, tested by making this the default
|
||||
uint32_t glyphIndex = glyphData->GetSimpleGlyph();
|
||||
glyphData->SetComplex(true, true, 1);
|
||||
DetailedGlyph detail = { glyphIndex, advance, gfx::Point() };
|
||||
DetailedGlyph detail = {glyphIndex, advance, 0, 0};
|
||||
SetGlyphs(i, *glyphData, &detail);
|
||||
}
|
||||
} else {
|
||||
@ -1937,7 +1941,14 @@ gfxFont::DrawGlyphs(const gfxShapedText* aShapedText,
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
gfx::Point glyphPt(*aPt + details->mOffset);
|
||||
gfx::Point glyphPt(*aPt);
|
||||
if (aBuffer.mFontParams.isVerticalFont) {
|
||||
glyphPt.x += details->mYOffset;
|
||||
glyphPt.y += details->mXOffset;
|
||||
} else {
|
||||
glyphPt.x += details->mXOffset;
|
||||
glyphPt.y += details->mYOffset;
|
||||
}
|
||||
DrawOneGlyph<FC>(details->mGlyphID, glyphPt, aBuffer,
|
||||
&emittedGlyphs);
|
||||
}
|
||||
@ -2573,8 +2584,7 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
|
||||
uint32_t j;
|
||||
for (j = 0; j < glyphCount; ++j, ++details) {
|
||||
uint32_t glyphIndex = details->mGlyphID;
|
||||
gfxPoint glyphPt(x + details->mOffset.x,
|
||||
details->mOffset.y);
|
||||
gfxPoint glyphPt(x + details->mXOffset, details->mYOffset);
|
||||
double advance = details->mAdvance;
|
||||
gfxRect glyphRect;
|
||||
if (glyphData->IsMissing() || !extents ||
|
||||
@ -2585,6 +2595,10 @@ gfxFont::Measure(const gfxTextRun *aTextRun,
|
||||
glyphRect = gfxRect(0, -metrics.mAscent,
|
||||
advance, metrics.mAscent + metrics.mDescent);
|
||||
}
|
||||
if (orientation == eVertical) {
|
||||
Swap(glyphRect.x, glyphRect.y);
|
||||
Swap(glyphRect.width, glyphRect.height);
|
||||
}
|
||||
if (isRTL) {
|
||||
glyphRect -= gfxPoint(advance, 0);
|
||||
}
|
||||
|
@ -957,17 +957,15 @@ public:
|
||||
* in SimpleGlyph format, we use an array of DetailedGlyphs instead.
|
||||
*/
|
||||
struct DetailedGlyph {
|
||||
// The glyphID, or the Unicode character if this is a missing glyph
|
||||
/** The glyphID, or the Unicode character
|
||||
* if this is a missing glyph */
|
||||
uint32_t mGlyphID;
|
||||
// The advance of the glyph, in appunits.
|
||||
// mAdvance is in the text direction (RTL or LTR),
|
||||
// and will normally be non-negative (although this is not guaranteed)
|
||||
/** The advance, x-offset and y-offset of the glyph, in appunits
|
||||
* mAdvance is in the text direction (RTL or LTR)
|
||||
* mXOffset is always from left to right
|
||||
* mYOffset is always from top to bottom */
|
||||
int32_t mAdvance;
|
||||
// The offset from the glyph's default position, in line-relative
|
||||
// coordinates (so mOffset.x is an offset in the line-right direction,
|
||||
// and mOffset.y is an offset in line-downwards direction).
|
||||
// These values are in floating-point appUnits.
|
||||
mozilla::gfx::Point mOffset;
|
||||
float mXOffset, mYOffset;
|
||||
};
|
||||
|
||||
void SetGlyphs(uint32_t aCharIndex, CompressedGlyph aGlyph,
|
||||
@ -1085,7 +1083,7 @@ protected:
|
||||
DetailedGlyph details = {
|
||||
aGlyph.GetSimpleGlyph(),
|
||||
(int32_t) aGlyph.GetSimpleAdvance(),
|
||||
mozilla::gfx::Point()
|
||||
0, 0
|
||||
};
|
||||
SetGlyphs(aIndex, CompressedGlyph().SetComplex(true, true, 1),
|
||||
&details);
|
||||
|
@ -339,16 +339,17 @@ gfxGraphiteShaper::SetGlyphsFromSegment(gfxShapedText *aShapedText,
|
||||
for (uint32_t j = c.baseGlyph; j < c.baseGlyph + c.nGlyphs; ++j) {
|
||||
gfxShapedText::DetailedGlyph* d = details.AppendElement();
|
||||
d->mGlyphID = gids[j];
|
||||
d->mOffset.y = roundY ? NSToIntRound(-yLocs[j]) * dev2appUnits
|
||||
: -yLocs[j] * dev2appUnits;
|
||||
d->mYOffset = roundY ? NSToIntRound(-yLocs[j]) * dev2appUnits
|
||||
: -yLocs[j] * dev2appUnits;
|
||||
if (j == c.baseGlyph) {
|
||||
d->mXOffset = 0;
|
||||
d->mAdvance = appAdvance;
|
||||
clusterLoc = xLocs[j];
|
||||
} else {
|
||||
float dx = rtl ? (xLocs[j] - clusterLoc) :
|
||||
(xLocs[j] - clusterLoc - adv);
|
||||
d->mOffset.x = roundX ? NSToIntRound(dx) * dev2appUnits
|
||||
: dx * dev2appUnits;
|
||||
d->mXOffset = roundX ? NSToIntRound(dx) * dev2appUnits
|
||||
: dx * dev2appUnits;
|
||||
d->mAdvance = 0;
|
||||
}
|
||||
}
|
||||
|
@ -1736,19 +1736,12 @@ gfxHarfBuzzShaper::SetGlyphsFromRun(gfxShapedText *aShapedText,
|
||||
detailedGlyphs.AppendElement();
|
||||
details->mGlyphID = ginfo[glyphStart].codepoint;
|
||||
|
||||
details->mXOffset = iOffset;
|
||||
details->mAdvance = advance;
|
||||
|
||||
if (aVertical) {
|
||||
details->mOffset.x = bPos -
|
||||
(roundB ? appUnitsPerDevUnit * FixedToIntRound(b_offset)
|
||||
: floor(hb2appUnits * b_offset + 0.5));
|
||||
details->mOffset.y = iOffset;
|
||||
} else {
|
||||
details->mOffset.x = iOffset;
|
||||
details->mOffset.y = bPos -
|
||||
(roundB ? appUnitsPerDevUnit * FixedToIntRound(b_offset)
|
||||
: floor(hb2appUnits * b_offset + 0.5));
|
||||
}
|
||||
details->mYOffset = bPos -
|
||||
(roundB ? appUnitsPerDevUnit * FixedToIntRound(b_offset)
|
||||
: floor(hb2appUnits * b_offset + 0.5));
|
||||
|
||||
if (b_advance != 0) {
|
||||
bPos -=
|
||||
|
@ -2758,6 +2758,7 @@ gfxFontGroup::InitScriptRun(DrawTarget* aDrawTarget,
|
||||
gfxTextRun::DetailedGlyph detailedGlyph;
|
||||
detailedGlyph.mGlyphID = mainFont->GetSpaceGlyph();
|
||||
detailedGlyph.mAdvance = advance;
|
||||
detailedGlyph.mXOffset = detailedGlyph.mYOffset = 0;
|
||||
gfxShapedText::CompressedGlyph g;
|
||||
g.SetComplex(true, true, 1);
|
||||
aTextRun->SetGlyphs(aOffset + index,
|
||||
|
@ -161,6 +161,8 @@ MergeCharactersInTextRun(gfxTextRun* aDest, gfxTextRun* aSrc,
|
||||
gfxTextRun::DetailedGlyph details;
|
||||
details.mGlyphID = g.GetSimpleGlyph();
|
||||
details.mAdvance = g.GetSimpleAdvance();
|
||||
details.mXOffset = 0;
|
||||
details.mYOffset = 0;
|
||||
glyphs.AppendElement(details);
|
||||
}
|
||||
} else {
|
||||
|
@ -588,6 +588,7 @@ nsOpenTypeTable::MakeTextRun(DrawTarget* aDrawTarget,
|
||||
NSToCoordRound(aAppUnitsPerDevPixel *
|
||||
aFontGroup->GetFirstValidFont()->
|
||||
GetGlyphHAdvance(aDrawTarget, aGlyph.glyphID));
|
||||
detailedGlyph.mXOffset = detailedGlyph.mYOffset = 0;
|
||||
gfxShapedText::CompressedGlyph g;
|
||||
g.SetComplex(true, true, 1);
|
||||
textRun->SetGlyphs(0, g, &detailedGlyph);
|
||||
|
Loading…
Reference in New Issue
Block a user