| 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 s_statusFontFamilyName = new AtomicString(familyName); | 94 s_statusFontFamilyName = new AtomicString(familyName); |
| 95 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); | 95 s_statusFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); |
| 96 } | 96 } |
| 97 | 97 |
| 98 FontCache::FontCache() | 98 FontCache::FontCache() |
| 99 : m_purgePreventCount(0) | 99 : m_purgePreventCount(0) |
| 100 { | 100 { |
| 101 m_fontManager = s_fontManager; | 101 m_fontManager = s_fontManager; |
| 102 if (!m_fontManager.get()) | 102 if (!m_fontManager.get()) |
| 103 m_fontManager = adoptRef(SkFontMgr_New_DirectWrite()); | 103 m_fontManager = adoptRef(SkFontMgr_New_DirectWrite()); |
| 104 | |
| 105 s_useSubpixelPositioning = true; | |
| 106 | |
| 107 ASSERT(m_fontManager.get()); | 104 ASSERT(m_fontManager.get()); |
| 108 } | 105 } |
| 109 | 106 |
| 110 // Given the desired base font, this will create a SimpleFontData for a specific | 107 // Given the desired base font, this will create a SimpleFontData for a specific |
| 111 // font that can be used to render the given range of characters. | 108 // font that can be used to render the given range of characters. |
| 112 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( | 109 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
| 113 const FontDescription& fontDescription, UChar32 character, | 110 const FontDescription& fontDescription, UChar32 character, |
| 114 const SimpleFontData* originalFontData, | 111 const SimpleFontData* originalFontData, |
| 115 FontFallbackPriority fallbackPriority) | 112 FontFallbackPriority fallbackPriority) |
| 116 { | 113 { |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } else { | 391 } else { |
| 395 return nullptr; | 392 return nullptr; |
| 396 } | 393 } |
| 397 } | 394 } |
| 398 | 395 |
| 399 OwnPtr<FontPlatformData> result = adoptPtr(new FontPlatformData(tf, | 396 OwnPtr<FontPlatformData> result = adoptPtr(new FontPlatformData(tf, |
| 400 name.data(), | 397 name.data(), |
| 401 fontSize, | 398 fontSize, |
| 402 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 399 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
| 403 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 400 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
| 404 fontDescription.orientation(), | 401 fontDescription.orientation())); |
| 405 s_useSubpixelPositioning)); | |
| 406 | 402 |
| 407 struct FamilyMinSize { | 403 struct FamilyMinSize { |
| 408 const wchar_t* family; | 404 const wchar_t* family; |
| 409 unsigned minSize; | 405 unsigned minSize; |
| 410 }; | 406 }; |
| 411 const static FamilyMinSize minAntiAliasSizeForFont[] = { | 407 const static FamilyMinSize minAntiAliasSizeForFont[] = { |
| 412 { L"simsun", 11 }, | 408 { L"simsun", 11 }, |
| 413 { L"dotum", 12 }, | 409 { L"dotum", 12 }, |
| 414 { L"gulim", 12 }, | 410 { L"gulim", 12 }, |
| 415 { L"pmingliu", 11 }, | 411 { L"pmingliu", 11 }, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 if (typefacesMatchesFamily(tf.get(), family)) { | 445 if (typefacesMatchesFamily(tf.get(), family)) { |
| 450 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); | 446 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); |
| 451 break; | 447 break; |
| 452 } | 448 } |
| 453 } | 449 } |
| 454 | 450 |
| 455 return result.release(); | 451 return result.release(); |
| 456 } | 452 } |
| 457 | 453 |
| 458 } // namespace blink | 454 } // namespace blink |
| OLD | NEW |