mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 808288 - render missing glyphs as hexboxes in <canvas> text. r=bas
This commit is contained in:
parent
8f83670945
commit
f20b79de6f
@ -59,6 +59,7 @@
|
||||
#include "gfxFont.h"
|
||||
#include "gfxBlur.h"
|
||||
#include "gfxUtils.h"
|
||||
#include "gfxFontMissingGlyphs.h"
|
||||
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsFrameLoader.h"
|
||||
@ -3038,6 +3039,55 @@ struct NS_STACK_CLASS CanvasBidiProcessor : public nsBidiPresUtils::BidiProcesso
|
||||
gfxTextRun::DetailedGlyph *detailedGlyphs =
|
||||
mTextRun->GetDetailedGlyphs(i);
|
||||
|
||||
if (glyphs[i].IsMissing()) {
|
||||
float xpos;
|
||||
float advance = detailedGlyphs[0].mAdvance * devUnitsPerAppUnit;
|
||||
if (mTextRun->IsRightToLeft()) {
|
||||
xpos = baselineOrigin.x - advanceSum - advance;
|
||||
} else {
|
||||
xpos = baselineOrigin.x + advanceSum;
|
||||
}
|
||||
advanceSum += advance;
|
||||
|
||||
// default-ignorable characters will have zero advance width.
|
||||
// we don't draw a hexbox for them, just leave them invisible
|
||||
if (advance > 0) {
|
||||
// for now, we use gfxFontMissingGlyphs to draw the hexbox;
|
||||
// some day we should replace this with a direct Azure version
|
||||
|
||||
// get the DrawTarget's transform, so we can apply it to the
|
||||
// thebes context for gfxFontMissingGlyphs
|
||||
Matrix matrix = mCtx->mTarget->GetTransform();
|
||||
nsRefPtr<gfxContext> thebes;
|
||||
if (gfxPlatform::GetPlatform()->SupportsAzureContent()) {
|
||||
// XXX See bug 808288 comment 5 - Bas says:
|
||||
// This is a little tricky, potentially this could go wrong if
|
||||
// we fell back to a Cairo context because of for example
|
||||
// extremely large Canvas size. Cairo content is technically
|
||||
// -not- supported, but SupportsAzureContent would return true
|
||||
// as the browser uses D2D content.
|
||||
// I'm thinking Cairo content will be good enough to do
|
||||
// DrawMissingGlyph though.
|
||||
thebes = new gfxContext(mCtx->mTarget);
|
||||
} else {
|
||||
nsRefPtr<gfxASurface> drawSurf;
|
||||
mCtx->GetThebesSurface(getter_AddRefs(drawSurf));
|
||||
thebes = new gfxContext(drawSurf);
|
||||
}
|
||||
thebes->SetMatrix(gfxMatrix(matrix._11, matrix._12, matrix._21,
|
||||
matrix._22, matrix._31, matrix._32));
|
||||
|
||||
gfxFloat height = font->GetMetrics().maxAscent;
|
||||
gfxRect glyphRect(xpos, baselineOrigin.y - height,
|
||||
advance, height);
|
||||
gfxFontMissingGlyphs::DrawMissingGlyph(thebes, glyphRect,
|
||||
detailedGlyphs[0].mGlyphID);
|
||||
|
||||
mCtx->mTarget->SetTransform(matrix);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t c = 0; c < glyphs[i].GetGlyphCount(); c++) {
|
||||
newGlyph.mIndex = detailedGlyphs[c].mGlyphID;
|
||||
if (mTextRun->IsRightToLeft()) {
|
||||
|
@ -28,6 +28,7 @@ EXPORTS = \
|
||||
gfxFont.h \
|
||||
gfxFontConstants.h \
|
||||
gfxFontFeatures.h \
|
||||
gfxFontMissingGlyphs.h \
|
||||
gfxFontUtils.h \
|
||||
gfxFontTest.h \
|
||||
gfxImageSurface.h \
|
||||
|
@ -50,7 +50,8 @@ fails-if(Android) != text-font-lang.html text-font-lang-notref.html
|
||||
== strokeText-path.html strokeText-path-ref.html
|
||||
|
||||
# check that emoji character renders as something non-blank (for Apple Color Emoji font, bug 715798)
|
||||
random-if(!cocoaWidget) fails-if(OSX==10.6) random-if(OSX==10.7) != text-emoji.html text-emoji-notref.html
|
||||
# apparently fails on some 10.7 systems for unknown reasons, bug 804522.
|
||||
random-if(OSX==10.7) != text-emoji.html text-emoji-notref.html
|
||||
|
||||
# azure quartz uses CGDrawLinearGradient instead of DrawShading
|
||||
# so we have less control over degenerate behaviour as tested by this
|
||||
|
Loading…
Reference in New Issue
Block a user