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

Side by Side Diff: Source/platform/fonts/win/FontPlatformDataWin.cpp

Issue 553163002: [DirectWrite] Limit noSubpixelForSmallSizeFont to low-DPI (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« no previous file with comments | « Source/platform/fonts/FontCache.cpp ('k') | Source/web/win/WebFontRendering.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2006, 2007 Apple Computer, Inc. 2 * Copyright (C) 2006, 2007 Apple Computer, Inc.
3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved. 3 * Copyright (c) 2006, 2007, 2008, 2009, 2012 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | 57 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag |
58 SkPaint::kLCDRenderText_Flag | 58 SkPaint::kLCDRenderText_Flag |
59 SkPaint::kGenA8FromLCD_Flag; 59 SkPaint::kGenA8FromLCD_Flag;
60 flags &= ~textFlagsMask; 60 flags &= ~textFlagsMask;
61 61
62 if (ts <= kMaxSizeForEmbeddedBitmap) 62 if (ts <= kMaxSizeForEmbeddedBitmap)
63 flags |= SkPaint::kEmbeddedBitmapText_Flag; 63 flags |= SkPaint::kEmbeddedBitmapText_Flag;
64 64
65 if (ts >= m_minSizeForAntiAlias) { 65 if (ts >= m_minSizeForAntiAlias) {
66 66
67 // Subpixel text positioning looks pretty bad without font smoothing. 67 if (m_useSubpixelPositioning
68 // Disable it unless some type of font smoothing is used. As most tests 68 // Disable subpixel text for certain older fonts at smaller sizes as
69 // run without font smoothing we enable it for tests to ensure we get 69 // they tend to get quite blurry at non-integer sizes and positions.
70 // good test coverage matching the more common smoothing enabled 70 // For high-DPI this workaround isn't required.
71 // behavior. 71 && (ts >= m_minSizeForSubpixel
72 if (m_useSubpixelPositioning && ts >= m_minSizeForSubpixel 72 || FontCache::fontCache()->deviceScaleFactor() >= 1.5)
73 && ((textFlags & SkPaint::kAntiAlias_Flag) || LayoutTestSupport::isR unningLayoutTest())) 73
74 // Subpixel text positioning looks pretty bad without font
75 // smoothing. Disable it unless some type of font smoothing is used.
76 // As most tests run without font smoothing we enable it for tests
77 // to ensure we get good test coverage matching the more common
78 // smoothing enabled behavior.
79 && ((textFlags & SkPaint::kAntiAlias_Flag)
80 || LayoutTestSupport::isRunningLayoutTest()))
74 flags |= SkPaint::kSubpixelText_Flag; 81 flags |= SkPaint::kSubpixelText_Flag;
75 82
76 // Only set painting flags when we're actually painting. 83 // Only set painting flags when we're actually painting.
77 if (context && !context->couldUseLCDRenderedText()) { 84 if (context && !context->couldUseLCDRenderedText()) {
78 textFlags &= ~SkPaint::kLCDRenderText_Flag; 85 textFlags &= ~SkPaint::kLCDRenderText_Flag;
79 // If we *just* clear our request for LCD, then GDI seems to 86 // If we *just* clear our request for LCD, then GDI seems to
80 // sometimes give us AA text, and sometimes give us BW text. Since t he 87 // sometimes give us AA text, and sometimes give us BW text. Since t he
81 // original intent was LCD, we want to force AA (rather than BW), so we 88 // original intent was LCD, we want to force AA (rather than BW), so we
82 // add a special bit to tell Skia to do its best to avoid the BW: by 89 // add a special bit to tell Skia to do its best to avoid the BW: by
83 // drawing LCD offscreen and downsampling that to AA. 90 // drawing LCD offscreen and downsampling that to AA.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 { 159 {
153 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); 160 m_paintTextFlags = computePaintTextFlags(fontFamilyName());
154 } 161 }
155 162
156 bool FontPlatformData::defaultUseSubpixelPositioning() 163 bool FontPlatformData::defaultUseSubpixelPositioning()
157 { 164 {
158 return FontCache::fontCache()->useSubpixelPositioning(); 165 return FontCache::fontCache()->useSubpixelPositioning();
159 } 166 }
160 167
161 } // namespace blink 168 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/fonts/FontCache.cpp ('k') | Source/web/win/WebFontRendering.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698