| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 AtomicString* FontCache::s_menuFontFamilyName = 0; | 51 AtomicString* FontCache::s_menuFontFamilyName = 0; |
| 52 int32_t FontCache::s_menuFontHeight = 0; | 52 int32_t FontCache::s_menuFontHeight = 0; |
| 53 AtomicString* FontCache::s_smallCaptionFontFamilyName = 0; | 53 AtomicString* FontCache::s_smallCaptionFontFamilyName = 0; |
| 54 int32_t FontCache::s_smallCaptionFontHeight = 0; | 54 int32_t FontCache::s_smallCaptionFontHeight = 0; |
| 55 AtomicString* FontCache::s_statusFontFamilyName = 0; | 55 AtomicString* FontCache::s_statusFontFamilyName = 0; |
| 56 int32_t FontCache::s_statusFontHeight = 0; | 56 int32_t FontCache::s_statusFontHeight = 0; |
| 57 | 57 |
| 58 namespace { | 58 namespace { |
| 59 | 59 |
| 60 int32_t ensureMinimumFontHeightIfNeeded(int32_t fontHeight) { | 60 int32_t ensureMinimumFontHeightIfNeeded(int32_t fontHeight) { |
| 61 // Adjustment for codepage 936 to make the fonts more legible in Simplified Ch
inese. | 61 // Adjustment for codepage 936 to make the fonts more legible in Simplified |
| 62 // Please refer to LayoutThemeFontProviderWin.cpp for more information. | 62 // Chinese. Please refer to LayoutThemeFontProviderWin.cpp for more |
| 63 // information. |
| 63 return (fontHeight < 12.0f) && (GetACP() == 936) ? 12.0f : fontHeight; | 64 return (fontHeight < 12.0f) && (GetACP() == 936) ? 12.0f : fontHeight; |
| 64 } | 65 } |
| 65 | 66 |
| 66 } // namespace | 67 } // namespace |
| 67 | 68 |
| 68 // static | 69 // static |
| 69 void FontCache::addSideloadedFontForTesting(SkTypeface* typeface) { | 70 void FontCache::addSideloadedFontForTesting(SkTypeface* typeface) { |
| 70 if (!s_sideloadedFonts) | 71 if (!s_sideloadedFonts) |
| 71 s_sideloadedFonts = new HashMap<String, sk_sp<SkTypeface>>; | 72 s_sideloadedFonts = new HashMap<String, sk_sp<SkTypeface>>; |
| 72 SkString name; | 73 SkString name; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 data = getFontPlatformData(fontDescription, createByFamily); | 155 data = getFontPlatformData(fontDescription, createByFamily); |
| 155 } | 156 } |
| 156 } | 157 } |
| 157 | 158 |
| 158 // Last resort font list : PanUnicode. CJK fonts have a pretty | 159 // Last resort font list : PanUnicode. CJK fonts have a pretty |
| 159 // large repertoire. Eventually, we need to scan all the fonts | 160 // large repertoire. Eventually, we need to scan all the fonts |
| 160 // on the system to have a Firefox-like coverage. | 161 // on the system to have a Firefox-like coverage. |
| 161 // Make sure that all of them are lowercased. | 162 // Make sure that all of them are lowercased. |
| 162 const static wchar_t* const cjkFonts[] = { | 163 const static wchar_t* const cjkFonts[] = { |
| 163 L"arial unicode ms", L"ms pgothic", L"simsun", L"gulim", L"pmingliu", | 164 L"arial unicode ms", L"ms pgothic", L"simsun", L"gulim", L"pmingliu", |
| 164 L"wenquanyi zen hei", // Partial CJK Ext. A coverage but more widely know
n to Chinese users. | 165 L"wenquanyi zen hei", // Partial CJK Ext. A coverage but more widely |
| 166 // known to Chinese users. |
| 165 L"ar pl shanheisun uni", L"ar pl zenkai uni", | 167 L"ar pl shanheisun uni", L"ar pl zenkai uni", |
| 166 L"han nom a", // Complete CJK Ext. A coverage. | 168 L"han nom a", // Complete CJK Ext. A coverage. |
| 167 L"code2000" // Complete CJK Ext. A coverage. | 169 L"code2000" // Complete CJK Ext. A coverage. |
| 168 // CJK Ext. B fonts are not listed here because it's of no use | 170 // CJK Ext. B fonts are not listed here because it's of no use |
| 169 // with our current non-BMP character handling because we use | 171 // with our current non-BMP character handling because we use |
| 170 // Uniscribe for it and that code path does not go through here. | 172 // Uniscribe for it and that code path does not go through here. |
| 171 }; | 173 }; |
| 172 | 174 |
| 173 const static wchar_t* const commonFonts[] = { | 175 const static wchar_t* const commonFonts[] = { |
| 174 L"tahoma", L"arial unicode ms", L"lucida sans unicode", | 176 L"tahoma", L"arial unicode ms", L"lucida sans unicode", |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 SkTypeface::LocalizedString actualFamily; | 234 SkTypeface::LocalizedString actualFamily; |
| 233 | 235 |
| 234 while (actualFamilies->next(&actualFamily)) { | 236 while (actualFamilies->next(&actualFamily)) { |
| 235 if (equalIgnoringCase(family, actualFamily.fString)) { | 237 if (equalIgnoringCase(family, actualFamily.fString)) { |
| 236 matchesRequestedFamily = true; | 238 matchesRequestedFamily = true; |
| 237 break; | 239 break; |
| 238 } | 240 } |
| 239 } | 241 } |
| 240 actualFamilies->unref(); | 242 actualFamilies->unref(); |
| 241 | 243 |
| 242 // getFamilyName may return a name not returned by the createFamilyNameIterato
r. | 244 // getFamilyName may return a name not returned by the |
| 245 // createFamilyNameIterator. |
| 243 // Specifically in cases where Windows substitutes the font based on the | 246 // Specifically in cases where Windows substitutes the font based on the |
| 244 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes registry
entries. | 247 // HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\FontSubstitutes registry |
| 248 // entries. |
| 245 if (!matchesRequestedFamily) { | 249 if (!matchesRequestedFamily) { |
| 246 SkString familyName; | 250 SkString familyName; |
| 247 tf->getFamilyName(&familyName); | 251 tf->getFamilyName(&familyName); |
| 248 if (equalIgnoringCase(family, familyName)) | 252 if (equalIgnoringCase(family, familyName)) |
| 249 matchesRequestedFamily = true; | 253 matchesRequestedFamily = true; |
| 250 } | 254 } |
| 251 | 255 |
| 252 return matchesRequestedFamily; | 256 return matchesRequestedFamily; |
| 253 } | 257 } |
| 254 | 258 |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 404 if (typefacesMatchesFamily(tf.get(), family)) { | 408 if (typefacesMatchesFamily(tf.get(), family)) { |
| 405 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); | 409 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); |
| 406 break; | 410 break; |
| 407 } | 411 } |
| 408 } | 412 } |
| 409 | 413 |
| 410 return result; | 414 return result; |
| 411 } | 415 } |
| 412 | 416 |
| 413 } // namespace blink | 417 } // namespace blink |
| OLD | NEW |