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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 // static | 90 // static |
91 void FontCache::setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht) | 91 void FontCache::setStatusFontMetrics(const wchar_t* familyName, int32_t fontHeig
ht) |
92 { | 92 { |
93 s_statusFontFamilyName = new AtomicString(familyName); | 93 s_statusFontFamilyName = new AtomicString(familyName); |
94 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); | 94 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); |
95 } | 95 } |
96 | 96 |
97 FontCache::FontCache() | 97 FontCache::FontCache() |
98 : m_purgePreventCount(0) | 98 : m_purgePreventCount(0) |
99 { | 99 { |
100 SkFontMgr* fontManager; | 100 if (s_fontManager) { |
101 | 101 m_fontManager = s_fontManager; |
102 if (s_useDirectWrite) { | 102 } else if (s_useDirectWrite) { |
103 fontManager = SkFontMgr_New_DirectWrite(s_directWriteFactory); | 103 m_fontManager = adoptRef(SkFontMgr_New_DirectWrite()); |
104 s_useSubpixelPositioning = true; | |
105 } else { | 104 } else { |
106 fontManager = SkFontMgr_New_GDI(); | 105 m_fontManager = adoptRef(SkFontMgr_New_GDI()); |
107 // Subpixel text positioning is not supported by the GDI backend. | |
108 s_useSubpixelPositioning = false; | |
109 } | 106 } |
110 | 107 |
111 ASSERT(fontManager); | 108 // Subpixel text positioning is only supported by the DirectWrite backend (n
ot GDI). |
112 m_fontManager = adoptPtr(fontManager); | 109 s_useSubpixelPositioning = s_useDirectWrite; |
| 110 |
| 111 ASSERT(m_fontManager.get()); |
113 } | 112 } |
114 | 113 |
115 void FontCache::acceptLanguagesChanged(const String&) | 114 void FontCache::acceptLanguagesChanged(const String&) |
116 { | 115 { |
117 // TODO(kojii): Take acceptLanguages into account for ambiguos scripts. | 116 // TODO(kojii): Take acceptLanguages into account for ambiguos scripts. |
118 } | 117 } |
119 | 118 |
120 // Given the desired base font, this will create a SimpleFontData for a specific | 119 // Given the desired base font, this will create a SimpleFontData for a specific |
121 // font that can be used to render the given range of characters. | 120 // font that can be used to render the given range of characters. |
122 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( | 121 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (typefacesMatchesFamily(tf.get(), family)) { | 423 if (typefacesMatchesFamily(tf.get(), family)) { |
425 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); | 424 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); |
426 break; | 425 break; |
427 } | 426 } |
428 } | 427 } |
429 | 428 |
430 return result.release(); | 429 return result.release(); |
431 } | 430 } |
432 | 431 |
433 } // namespace blink | 432 } // namespace blink |
OLD | NEW |