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 25 matching lines...) Expand all Loading... |
36 #include "SkTypeface_win.h" | 36 #include "SkTypeface_win.h" |
37 #include "platform/RuntimeEnabledFeatures.h" | 37 #include "platform/RuntimeEnabledFeatures.h" |
38 #include "platform/fonts/FontDescription.h" | 38 #include "platform/fonts/FontDescription.h" |
39 #include "platform/fonts/FontFaceCreationParams.h" | 39 #include "platform/fonts/FontFaceCreationParams.h" |
40 #include "platform/fonts/FontPlatformData.h" | 40 #include "platform/fonts/FontPlatformData.h" |
41 #include "platform/fonts/SimpleFontData.h" | 41 #include "platform/fonts/SimpleFontData.h" |
42 #include "platform/fonts/win/FontFallbackWin.h" | 42 #include "platform/fonts/win/FontFallbackWin.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 | 45 |
46 HashMap<String, RefPtr<SkTypeface> >* FontCache::s_sideloadedFonts = 0; | 46 HashMap<String, RefPtr<SkTypeface>>* FontCache::s_sideloadedFonts = 0; |
47 | 47 |
48 // Cached system font metrics. | 48 // Cached system font metrics. |
49 AtomicString* FontCache::s_menuFontFamilyName = 0; | 49 AtomicString* FontCache::s_menuFontFamilyName = 0; |
50 int32_t FontCache::s_menuFontHeight = 0; | 50 int32_t FontCache::s_menuFontHeight = 0; |
51 AtomicString* FontCache::s_smallCaptionFontFamilyName = 0; | 51 AtomicString* FontCache::s_smallCaptionFontFamilyName = 0; |
52 int32_t FontCache::s_smallCaptionFontHeight = 0; | 52 int32_t FontCache::s_smallCaptionFontHeight = 0; |
53 AtomicString* FontCache::s_statusFontFamilyName = 0; | 53 AtomicString* FontCache::s_statusFontFamilyName = 0; |
54 int32_t FontCache::s_statusFontHeight = 0; | 54 int32_t FontCache::s_statusFontHeight = 0; |
55 | 55 |
56 namespace { | 56 namespace { |
57 | 57 |
58 int32_t ensureMinimumFontHeightIfNeeded(int32_t fontHeight) | 58 int32_t ensureMinimumFontHeightIfNeeded(int32_t fontHeight) |
59 { | 59 { |
60 // Adjustment for codepage 936 to make the fonts more legible in Simplified
Chinese. | 60 // Adjustment for codepage 936 to make the fonts more legible in Simplified
Chinese. |
61 // Please refer to RenderThemeChromiumFontProviderWin.cpp for more informati
on. | 61 // Please refer to RenderThemeChromiumFontProviderWin.cpp for more informati
on. |
62 return (fontHeight < 12.0f) && (GetACP() == 936) ? 12.0f : fontHeight; | 62 return (fontHeight < 12.0f) && (GetACP() == 936) ? 12.0f : fontHeight; |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
66 | 66 |
67 // static | 67 // static |
68 void FontCache::addSideloadedFontForTesting(SkTypeface* typeface) | 68 void FontCache::addSideloadedFontForTesting(SkTypeface* typeface) |
69 { | 69 { |
70 if (!s_sideloadedFonts) | 70 if (!s_sideloadedFonts) |
71 s_sideloadedFonts = new HashMap<String, RefPtr<SkTypeface> >; | 71 s_sideloadedFonts = new HashMap<String, RefPtr<SkTypeface>>; |
72 SkString name; | 72 SkString name; |
73 typeface->getFamilyName(&name); | 73 typeface->getFamilyName(&name); |
74 s_sideloadedFonts->set(name.c_str(), adoptRef(typeface)); | 74 s_sideloadedFonts->set(name.c_str(), adoptRef(typeface)); |
75 } | 75 } |
76 | 76 |
77 // static | 77 // static |
78 void FontCache::setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
) | 78 void FontCache::setMenuFontMetrics(const wchar_t* familyName, int32_t fontHeight
) |
79 { | 79 { |
80 s_menuFontFamilyName = new AtomicString(familyName); | 80 s_menuFontFamilyName = new AtomicString(familyName); |
81 s_menuFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); | 81 s_menuFontHeight = ensureMinimumFontHeightIfNeeded(fontHeight); |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (typefacesMatchesFamily(tf.get(), family)) { | 421 if (typefacesMatchesFamily(tf.get(), family)) { |
422 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); | 422 result->setMinSizeForSubpixel(minSizeForSubpixelForFont); |
423 break; | 423 break; |
424 } | 424 } |
425 } | 425 } |
426 | 426 |
427 return result; | 427 return result; |
428 } | 428 } |
429 | 429 |
430 } // namespace blink | 430 } // namespace blink |
OLD | NEW |