Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(332)

Unified Diff: third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp

Issue 1931393002: Introduce typeface cache in blink::FontCache (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: wip: others Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp b/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
index d16dc21a6bc27828e7feb08be4a5e9b2ec16a2a3..f72f7c89154ff1a16aea40a0756aaea92d531e5e 100644
--- a/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
+++ b/third_party/WebKit/Source/platform/fonts/linux/FontPlatformDataLinux.cpp
@@ -40,100 +40,11 @@
namespace blink {
-static SkPaint::Hinting skiaHinting = SkPaint::kNormal_Hinting;
-static bool useSkiaAutoHint = true;
-static bool useSkiaBitmaps = true;
-static bool useSkiaAntiAlias = true;
-static bool useSkiaSubpixelRendering = false;
-
-void FontPlatformData::setHinting(SkPaint::Hinting hinting)
-{
- skiaHinting = hinting;
-}
-
-void FontPlatformData::setAutoHint(bool useAutoHint)
-{
- useSkiaAutoHint = useAutoHint;
-}
-
-void FontPlatformData::setUseBitmaps(bool useBitmaps)
-{
- useSkiaBitmaps = useBitmaps;
-}
-
-void FontPlatformData::setAntiAlias(bool useAntiAlias)
-{
- useSkiaAntiAlias = useAntiAlias;
-}
-
-void FontPlatformData::setSubpixelRendering(bool useSubpixelRendering)
+void FontPlatformData::setupPaint(SkPaint* paint) const
{
- useSkiaSubpixelRendering = useSubpixelRendering;
-}
-
-void FontPlatformData::setupPaint(SkPaint* paint, float deviceScaleFactor, const Font*) const
-{
- paint->setAntiAlias(m_style.useAntiAlias);
- paint->setHinting(static_cast<SkPaint::Hinting>(m_style.hintStyle));
- paint->setEmbeddedBitmapText(m_style.useBitmaps);
- paint->setAutohinted(m_style.useAutoHint);
- if (m_style.useAntiAlias)
- paint->setLCDRenderText(m_style.useSubpixelRendering);
-
- // Do not enable subpixel text on low-dpi if full hinting is requested.
- bool useSubpixelText = (paint->getHinting() != SkPaint::kFull_Hinting || deviceScaleFactor > 1.0f);
-
- // TestRunner specifically toggles the subpixel positioning flag.
- if (useSubpixelText && !LayoutTestSupport::isRunningLayoutTest())
- paint->setSubpixelText(true);
- else
- paint->setSubpixelText(m_style.useSubpixelPositioning);
-
- const float ts = m_textSize >= 0 ? m_textSize : 12;
- paint->setTextSize(SkFloatToScalar(ts));
paint->setTypeface(m_typeface.get());
paint->setFakeBoldText(m_syntheticBold);
paint->setTextSkewX(m_syntheticItalic ? -SK_Scalar1 / 4 : 0);
}
-void FontPlatformData::querySystemForRenderStyle()
-{
- WebFontRenderStyle style;
-#if OS(ANDROID)
- style.setDefaults();
-#else
- // If the font name is missing (i.e. probably a web font) or the sandbox is disabled, use the system defaults.
- if (!m_family.length() || !Platform::current()->sandboxSupport()) {
- style.setDefaults();
- } else {
- const int sizeAndStyle = (((int)m_textSize) << 2) | (m_typeface->style() & 3);
- Platform::current()->sandboxSupport()->getWebFontRenderStyleForStrike(m_family.data(), sizeAndStyle, &style);
- }
-#endif
- style.toFontRenderStyle(&m_style);
-
- // Fix FontRenderStyle::NoPreference to actual styles.
- if (m_style.useAntiAlias == FontRenderStyle::NoPreference)
- m_style.useAntiAlias = useSkiaAntiAlias;
-
- if (!m_style.useHinting)
- m_style.hintStyle = SkPaint::kNo_Hinting;
- else if (m_style.useHinting == FontRenderStyle::NoPreference)
- m_style.hintStyle = skiaHinting;
-
- if (m_style.useBitmaps == FontRenderStyle::NoPreference)
- m_style.useBitmaps = useSkiaBitmaps;
- if (m_style.useAutoHint == FontRenderStyle::NoPreference)
- m_style.useAutoHint = useSkiaAutoHint;
- if (m_style.useAntiAlias == FontRenderStyle::NoPreference)
- m_style.useAntiAlias = useSkiaAntiAlias;
- if (m_style.useSubpixelRendering == FontRenderStyle::NoPreference)
- m_style.useSubpixelRendering = useSkiaSubpixelRendering;
-
- // TestRunner specifically toggles the subpixel positioning flag.
- if (m_style.useSubpixelPositioning == FontRenderStyle::NoPreference
- || LayoutTestSupport::isRunningLayoutTest())
- m_style.useSubpixelPositioning = FontDescription::subpixelPositioning();
-}
-
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698