OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (c) 2006, 2007, 2008, 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 // convert the name to utf8 | 117 // convert the name to utf8 |
118 name = family.utf8(); | 118 name = family.utf8(); |
119 } | 119 } |
120 | 120 |
121 int style = SkTypeface::kNormal; | 121 int style = SkTypeface::kNormal; |
122 if (fontDescription.weight() >= FontWeightBold) | 122 if (fontDescription.weight() >= FontWeightBold) |
123 style |= SkTypeface::kBold; | 123 style |= SkTypeface::kBold; |
124 if (fontDescription.style()) | 124 if (fontDescription.style()) |
125 style |= SkTypeface::kItalic; | 125 style |= SkTypeface::kItalic; |
126 | 126 |
127 #if OS(WIN) | |
128 if (s_sideloadedFonts) { | |
129 HashMap<String, SkTypeface*>::iterator i = s_sideloadedFonts->find(name. data()); | |
eae
2014/04/12 10:51:33
The blink convention is to only use the variable n
scottmg
2014/04/12 15:42:39
Done.
| |
130 if (i != s_sideloadedFonts->end()) { | |
131 return adoptRef(i->value); | |
132 } | |
133 } | |
127 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa ce. | 134 // FIXME: Use SkFontStyle and matchFamilyStyle instead of legacyCreateTypefa ce. |
128 #if OS(WIN) | |
129 if (m_fontManager) | 135 if (m_fontManager) |
130 return adoptRef(m_fontManager->legacyCreateTypeface(name.data(), style)) ; | 136 return adoptRef(m_fontManager->legacyCreateTypeface(name.data(), style)) ; |
131 #endif | 137 #endif |
132 | 138 |
133 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa ce::Style>(style))); | 139 return adoptRef(SkTypeface::CreateFromName(name.data(), static_cast<SkTypefa ce::Style>(style))); |
134 } | 140 } |
135 | 141 |
136 #if !OS(WIN) | 142 #if !OS(WIN) |
137 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize) | 143 FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD escription, const AtomicString& family, float fontSize) |
138 { | 144 { |
139 CString name; | 145 CString name; |
140 RefPtr<SkTypeface> tf(createTypeface(fontDescription, family, name)); | 146 RefPtr<SkTypeface> tf(createTypeface(fontDescription, family, name)); |
141 if (!tf) | 147 if (!tf) |
142 return 0; | 148 return 0; |
143 | 149 |
144 FontPlatformData* result = new FontPlatformData(tf, | 150 FontPlatformData* result = new FontPlatformData(tf, |
145 name.data(), | 151 name.data(), |
146 fontSize, | 152 fontSize, |
147 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes cription.isSyntheticBold(), | 153 (fontDescription.weight() >= FontWeightBold && !tf->isBold()) || fontDes cription.isSyntheticBold(), |
148 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe ticItalic(), | 154 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe ticItalic(), |
149 fontDescription.orientation(), | 155 fontDescription.orientation(), |
150 fontDescription.useSubpixelPositioning()); | 156 fontDescription.useSubpixelPositioning()); |
151 return result; | 157 return result; |
152 } | 158 } |
153 #endif // !OS(WIN) | 159 #endif // !OS(WIN) |
154 | 160 |
155 } // namespace WebCore | 161 } // namespace WebCore |
OLD | NEW |