+2011-09-29 Cary Clark <caryclark@google.com>
+
+ Enable LCD text in Skia on Mac
+ https://bugs.webkit.org/show_bug.cgi?id=68734
+
+ Reviewed by Stephen White.
+
+ No new tests. Existing layout tests are generated
+ with LCD text disabled for pixel comparisons.
+
+ Duplicate the logic in FontMac.mm to pass settings
+ for antialiasing and smoothing. Also disable smoothing
+ for DumpRenderTree.
+
+ * platform/graphics/skia/FontSkia.cpp:
+ (WebCore::setupPaint):
+ (WebCore::Font::drawGlyphs):
+
2011-09-29 Varun Jain <varunjain@google.com>
Implement flick gesture in Chromium Gesture Recognizer
#include "GlyphBuffer.h"
#include "GraphicsContext.h"
#include "PlatformContextSkia.h"
+#include "PlatformSupport.h"
#include "SimpleFontData.h"
#include "SkCanvas.h"
paint->setLCDRenderText(false);
}
-static void setupPaint(SkPaint* paint, const SimpleFontData* fontData, const Font* font)
+static void setupPaint(SkPaint* paint, const SimpleFontData* fontData, const Font* font, bool shouldAntialias, bool shouldSmoothFonts)
{
const FontPlatformData& platformData = fontData->platformData();
const float textSize = platformData.m_size >= 0 ? platformData.m_size : 12;
- paint->setAntiAlias(true);
+ paint->setAntiAlias(shouldAntialias);
paint->setEmbeddedBitmapText(false);
paint->setTextSize(SkFloatToScalar(textSize));
SkTypeface* typeface = SkCreateTypefaceFromCTFont(platformData.ctFont());
paint->setFakeBoldText(platformData.m_syntheticBold);
paint->setTextSkewX(platformData.m_syntheticOblique ? -SK_Scalar1 / 4 : 0);
paint->setAutohinted(false); // freetype specific
- paint->setLCDRenderText(font->fontDescription().fontSmoothing() == SubpixelAntialiased);
+ paint->setLCDRenderText(shouldSmoothFonts);
}
// TODO: This needs to be split into helper functions to better scope the
const FloatPoint& point) const {
COMPILE_ASSERT(sizeof(GlyphBufferGlyph) == sizeof(uint16_t), GlyphBufferGlyphSize_equals_uint16_t);
+ bool shouldSmoothFonts = true;
+ bool shouldAntialias = true;
+
+ switch (fontDescription().fontSmoothing()) {
+ case Antialiased:
+ shouldSmoothFonts = false;
+ break;
+ case SubpixelAntialiased:
+ break;
+ case NoSmoothing:
+ shouldAntialias = false;
+ shouldSmoothFonts = false;
+ break;
+ case AutoSmoothing:
+ // For the AutoSmooth case, don't do anything! Keep the default settings.
+ break;
+ }
+
+ if (!shouldUseSmoothing() || PlatformSupport::layoutTestMode())
+ shouldSmoothFonts = false;
+
const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from);
SkScalar x = SkFloatToScalar(point.x());
SkScalar y = SkFloatToScalar(point.y());
if (textMode & TextModeFill) {
SkPaint paint;
gc->platformContext()->setupPaintForFilling(&paint);
- setupPaint(&paint, font, this);
+ setupPaint(&paint, font, this, shouldAntialias, shouldSmoothFonts);
adjustTextRenderMode(&paint, gc->platformContext());
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.setColor(gc->fillColor().rgb());
SkPaint paint;
gc->platformContext()->setupPaintForStroking(&paint, 0, 0);
- setupPaint(&paint, font, this);
+ setupPaint(&paint, font, this, shouldAntialias, shouldSmoothFonts);
adjustTextRenderMode(&paint, gc->platformContext());
paint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
paint.setColor(gc->strokeColor().rgb());