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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 void FontCache::setStatusFontMetrics(const wchar_t* familyName, | 98 void FontCache::setStatusFontMetrics(const wchar_t* familyName, |
99 int32_t fontHeight) { | 99 int32_t fontHeight) { |
100 s_statusFontFamilyName = new AtomicString(familyName); | 100 s_statusFontFamilyName = new AtomicString(familyName); |
101 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); | 101 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); |
102 } | 102 } |
103 | 103 |
104 FontCache::FontCache() : m_purgePreventCount(0) { | 104 FontCache::FontCache() : m_purgePreventCount(0) { |
105 m_fontManager = sk_ref_sp(s_staticFontManager); | 105 m_fontManager = sk_ref_sp(s_staticFontManager); |
106 if (!m_fontManager) | 106 if (!m_fontManager) |
107 m_fontManager = SkFontMgr_New_DirectWrite(); | 107 m_fontManager = SkFontMgr_New_DirectWrite(); |
108 ASSERT(m_fontManager.get()); | 108 DCHECK(m_fontManager.get()); |
109 } | 109 } |
110 | 110 |
111 // Given the desired base font, this will create a SimpleFontData for a specific | 111 // Given the desired base font, this will create a SimpleFontData for a specific |
112 // font that can be used to render the given range of characters. | 112 // font that can be used to render the given range of characters. |
113 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( | 113 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
114 const FontDescription& fontDescription, | 114 const FontDescription& fontDescription, |
115 UChar32 character, | 115 UChar32 character, |
116 const SimpleFontData* originalFontData, | 116 const SimpleFontData* originalFontData, |
117 FontFallbackPriority fallbackPriority) { | 117 FontFallbackPriority fallbackPriority) { |
118 // First try the specified font with standard style & weight. | 118 // First try the specified font with standard style & weight. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } | 319 } |
320 | 320 |
321 return false; | 321 return false; |
322 } | 322 } |
323 | 323 |
324 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData( | 324 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData( |
325 const FontDescription& fontDescription, | 325 const FontDescription& fontDescription, |
326 const FontFaceCreationParams& creationParams, | 326 const FontFaceCreationParams& creationParams, |
327 float fontSize, | 327 float fontSize, |
328 AlternateFontName alternateFontName) { | 328 AlternateFontName alternateFontName) { |
329 ASSERT(creationParams.creationType() == CreateFontByFamily); | 329 DCHECK_EQ(creationParams.creationType(), CreateFontByFamily); |
330 | 330 |
331 CString name; | 331 CString name; |
332 sk_sp<SkTypeface> tf = createTypeface(fontDescription, creationParams, name); | 332 sk_sp<SkTypeface> tf = createTypeface(fontDescription, creationParams, name); |
333 // Windows will always give us a valid pointer here, even if the face name | 333 // Windows will always give us a valid pointer here, even if the face name |
334 // is non-existent. We have to double-check and see if the family name was | 334 // is non-existent. We have to double-check and see if the family name was |
335 // really used. | 335 // really used. |
336 if (!tf || !typefacesMatchesFamily(tf.get(), creationParams.family())) { | 336 if (!tf || !typefacesMatchesFamily(tf.get(), creationParams.family())) { |
337 AtomicString adjustedName; | 337 AtomicString adjustedName; |
338 FontWeight variantWeight; | 338 FontWeight variantWeight; |
339 FontStretch variantStretch; | 339 FontStretch variantStretch; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
386 ((fontDescription.style() == FontStyleItalic || | 386 ((fontDescription.style() == FontStyleItalic || |
387 fontDescription.style() == FontStyleOblique) && | 387 fontDescription.style() == FontStyleOblique) && |
388 !tf->isItalic()) || | 388 !tf->isItalic()) || |
389 fontDescription.isSyntheticItalic(), | 389 fontDescription.isSyntheticItalic(), |
390 fontDescription.orientation())); | 390 fontDescription.orientation())); |
391 | 391 |
392 return result; | 392 return result; |
393 } | 393 } |
394 | 394 |
395 } // namespace blink | 395 } // namespace blink |
OLD | NEW |