| 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 27 matching lines...) Expand all Loading... |
| 38 #include "platform/fonts/FontDescription.h" | 38 #include "platform/fonts/FontDescription.h" |
| 39 #include "platform/fonts/SimpleFontData.h" | 39 #include "platform/fonts/SimpleFontData.h" |
| 40 #include "platform/fonts/win/FontFallbackWin.h" | 40 #include "platform/fonts/win/FontFallbackWin.h" |
| 41 #include "platform/fonts/win/FontPlatformDataWin.h" | 41 #include "platform/fonts/win/FontPlatformDataWin.h" |
| 42 | 42 |
| 43 namespace WebCore { | 43 namespace WebCore { |
| 44 | 44 |
| 45 FontCache::FontCache() | 45 FontCache::FontCache() |
| 46 : m_purgePreventCount(0) | 46 : m_purgePreventCount(0) |
| 47 { | 47 { |
| 48 SkFontMgr* fontManager = 0; | 48 SkFontMgr* fontManager; |
| 49 | 49 |
| 50 // Prefer DirectWrite (if runtime feature is enabled) but fallback | 50 if (s_useDirectWrite) { |
| 51 // to GDI on platforms where DirectWrite is not supported. | |
| 52 if (RuntimeEnabledFeatures::directWriteEnabled()) | |
| 53 fontManager = SkFontMgr_New_DirectWrite(); | 51 fontManager = SkFontMgr_New_DirectWrite(); |
| 52 } else { |
| 53 fontManager = SkFontMgr_New_GDI(); |
| 54 // Subpixel text positioning is not supported by the GDI backend. |
| 55 s_useSubpixelPositioning = false; |
| 56 } |
| 54 | 57 |
| 55 // Subpixel text positioning is not supported by the GDI backend. | 58 ASSERT(fontManager); |
| 56 m_useSubpixelPositioning = fontManager | |
| 57 ? RuntimeEnabledFeatures::subpixelFontScalingEnabled() | |
| 58 : false; | |
| 59 | |
| 60 if (!fontManager) | |
| 61 fontManager = SkFontMgr_New_GDI(); | |
| 62 | |
| 63 m_fontManager = adoptPtr(fontManager); | 59 m_fontManager = adoptPtr(fontManager); |
| 64 } | 60 } |
| 65 | 61 |
| 66 static bool fontContainsCharacter(const FontPlatformData* fontData, const wchar_
t* family, UChar32 character) | 62 static bool fontContainsCharacter(const FontPlatformData* fontData, const wchar_
t* family, UChar32 character) |
| 67 { | 63 { |
| 68 SkPaint paint; | 64 SkPaint paint; |
| 69 fontData->setupPaint(&paint); | 65 fontData->setupPaint(&paint); |
| 70 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); | 66 paint.setTextEncoding(SkPaint::kUTF32_TextEncoding); |
| 71 | 67 |
| 72 uint16_t glyph; | 68 uint16_t glyph; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 if (!typefacesMatchesFamily(tf.get(), family)) { | 201 if (!typefacesMatchesFamily(tf.get(), family)) { |
| 206 return 0; | 202 return 0; |
| 207 } | 203 } |
| 208 | 204 |
| 209 FontPlatformData* result = new FontPlatformData(tf, | 205 FontPlatformData* result = new FontPlatformData(tf, |
| 210 name.data(), | 206 name.data(), |
| 211 fontSize, | 207 fontSize, |
| 212 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr
iption.isSyntheticBold(), | 208 fontDescription.weight() >= FontWeightBold && !tf->isBold() || fontDescr
iption.isSyntheticBold(), |
| 213 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes
cription.isSyntheticItalic(), | 209 fontDescription.style() == FontStyleItalic && !tf->isItalic() || fontDes
cription.isSyntheticItalic(), |
| 214 fontDescription.orientation(), | 210 fontDescription.orientation(), |
| 215 m_useSubpixelPositioning); | 211 s_useSubpixelPositioning); |
| 216 return result; | 212 return result; |
| 217 } | 213 } |
| 218 | 214 |
| 219 } | 215 } |
| OLD | NEW |