Bug 1404370 - TextDrawTarget: add fallbacks for remaining cases, remove some hacks. r=jrmuizel

This adds fallbacks for:
* synthetic bold
* synthetic italics
* text-writing-modes

This also removes an old hack to make synthetic italics less broken.

This also prevents special opacity handling for color fonts so that webrender
gets that information.

MozReview-Commit-ID: DKiTUBR6hzy

--HG--
extra : rebase_source : 22b445d40ee46bb09d4325828a8e959d3da7a9c7
This commit is contained in:
Alexis Beingessner 2017-09-29 12:05:34 -04:00
Родитель 411be7e1c2
Коммит b5bacff9f8
3 изменённых файлов: 18 добавлений и 14 удалений

Просмотреть файл

@ -2084,6 +2084,12 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
gfxPoint origPt = *aPt;
if (aRunParams.isVerticalRun && !fontParams.isVerticalFont) {
if (textDrawer) {
textDrawer->FoundUnsupportedFeature();
return;
}
sideways = true;
matrixRestore.SetContext(aRunParams.context);
gfxPoint p(aPt->x * aRunParams.devPerApp,
@ -2139,6 +2145,11 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
// use as many strikes as needed for the the increased advance
fontParams.extraStrikes =
std::max(1, NS_lroundf(GetSyntheticBoldOffset() / xscale));
if (textDrawer) {
textDrawer->FoundUnsupportedFeature();
return;
}
}
} else {
fontParams.synBoldOnePixelOffset = 0;
@ -2167,6 +2178,10 @@ gfxFont::Draw(const gfxTextRun *aTextRun, uint32_t aStart, uint32_t aEnd,
cairo_matrix_t matrix;
cairo_scaled_font_get_font_matrix(mScaledFont, &matrix);
if (matrix.xy != 0) {
if (textDrawer) {
textDrawer->FoundUnsupportedFeature();
}
// If this matrix applies a skew, which can happen when drawing
// oblique fonts, we will set the DrawTarget matrix to apply the
// skew. We'll need to move the glyphs by the inverse of the skew to

Просмотреть файл

@ -642,7 +642,9 @@ gfxTextRun::Draw(Range aRange, gfxPoint aPt, const DrawParams& aParams) const
if (aParams.drawMode & DrawMode::GLYPH_FILL &&
HasNonOpaqueNonTransparentColor(aParams.context, currentColor) &&
HasSyntheticBoldOrColor(this, aRange)) {
HasSyntheticBoldOrColor(this, aRange) &&
!aParams.context->GetTextDrawer()) {
needToRestore = true;
// Measure text; use the bounding box to determine the area we need
// to buffer.

Просмотреть файл

@ -160,19 +160,6 @@ public:
size_t oldLength = glyphs.Length();
glyphs.SetLength(oldLength + aBuffer.mNumGlyphs);
PodCopy(glyphs.Elements() + oldLength, aBuffer.mGlyphs, aBuffer.mNumGlyphs);
// If there's a skew for synthetic italics we need to apply it, as the font
// code applies the inverse transformation to glyph positions in anticipation.
Matrix trans = GetTransform();
if (trans._21 != 0) {
Matrix skew = Matrix(1, trans._12,
trans._21, 1,
0, 0);
for (size_t i = oldLength; i < oldLength + aBuffer.mNumGlyphs; ++i) {
auto position = &glyphs[i].mPosition;
*position = skew.TransformPoint(*position);
}
}
}
void