| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 uint32_t flags = paint->getFlags(); | 55 uint32_t flags = paint->getFlags(); |
| 56 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | | 56 static const uint32_t textFlagsMask = SkPaint::kAntiAlias_Flag | |
| 57 SkPaint::kLCDRenderText_Flag; | 57 SkPaint::kLCDRenderText_Flag; |
| 58 flags &= ~textFlagsMask; | 58 flags &= ~textFlagsMask; |
| 59 | 59 |
| 60 if (ts <= kMaxSizeForEmbeddedBitmap) | 60 if (ts <= kMaxSizeForEmbeddedBitmap) |
| 61 flags |= SkPaint::kEmbeddedBitmapText_Flag; | 61 flags |= SkPaint::kEmbeddedBitmapText_Flag; |
| 62 | 62 |
| 63 if (ts >= m_minSizeForAntiAlias) { | 63 if (ts >= m_minSizeForAntiAlias) { |
| 64 | 64 |
| 65 if (m_useSubpixelPositioning | 65 // Disable subpixel text for certain older fonts at smaller sizes as |
| 66 // Disable subpixel text for certain older fonts at smaller sizes as | 66 // they tend to get quite blurry at non-integer sizes and positions. |
| 67 // they tend to get quite blurry at non-integer sizes and positions. | 67 // For high-DPI this workaround isn't required. |
| 68 // For high-DPI this workaround isn't required. | 68 if ((ts >= m_minSizeForSubpixel |
| 69 && (ts >= m_minSizeForSubpixel | |
| 70 || FontCache::fontCache()->deviceScaleFactor() >= 1.5) | 69 || FontCache::fontCache()->deviceScaleFactor() >= 1.5) |
| 71 | 70 |
| 72 // Subpixel text positioning looks pretty bad without font | 71 // Subpixel text positioning looks pretty bad without font |
| 73 // smoothing. Disable it unless some type of font smoothing is used. | 72 // smoothing. Disable it unless some type of font smoothing is used. |
| 74 // As most tests run without font smoothing we enable it for tests | 73 // As most tests run without font smoothing we enable it for tests |
| 75 // to ensure we get good test coverage matching the more common | 74 // to ensure we get good test coverage matching the more common |
| 76 // smoothing enabled behavior. | 75 // smoothing enabled behavior. |
| 77 && ((textFlags & SkPaint::kAntiAlias_Flag) | 76 && ((textFlags & SkPaint::kAntiAlias_Flag) |
| 78 || LayoutTestSupport::isRunningLayoutTest())) | 77 || LayoutTestSupport::isRunningLayoutTest())) |
| 79 flags |= SkPaint::kSubpixelText_Flag; | 78 flags |= SkPaint::kSubpixelText_Flag; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 110 // Many web-fonts are so poorly hinted that they are terrible to read when d
rawn in BW. | 109 // Many web-fonts are so poorly hinted that they are terrible to read when d
rawn in BW. |
| 111 // In these cases, we have decided to FORCE these fonts to be drawn with at
least grayscale AA, | 110 // In these cases, we have decided to FORCE these fonts to be drawn with at
least grayscale AA, |
| 112 // even when the System (getSystemTextFlags) tells us to draw only in BW. | 111 // even when the System (getSystemTextFlags) tells us to draw only in BW. |
| 113 if (isWebFont(fontFamilyName)) | 112 if (isWebFont(fontFamilyName)) |
| 114 textFlags |= SkPaint::kAntiAlias_Flag; | 113 textFlags |= SkPaint::kAntiAlias_Flag; |
| 115 | 114 |
| 116 return textFlags; | 115 return textFlags; |
| 117 } | 116 } |
| 118 | 117 |
| 119 | 118 |
| 120 void FontPlatformData::querySystemForRenderStyle(bool) | 119 void FontPlatformData::querySystemForRenderStyle() |
| 121 { | 120 { |
| 122 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); | 121 m_paintTextFlags = computePaintTextFlags(fontFamilyName()); |
| 123 } | 122 } |
| 124 | 123 |
| 125 bool FontPlatformData::defaultUseSubpixelPositioning() | |
| 126 { | |
| 127 return FontCache::fontCache()->useSubpixelPositioning(); | |
| 128 } | |
| 129 | |
| 130 } // namespace blink | 124 } // namespace blink |
| OLD | NEW |