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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 ASSERT(fontPlatformData); | 154 ASSERT(fontPlatformData); |
155 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); | 155 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); |
156 } | 156 } |
157 | 157 |
158 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) | 158 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) |
159 { | 159 { |
160 #if !OS(WIN) && !OS(ANDROID) | 160 #if !OS(WIN) && !OS(ANDROID) |
161 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { | 161 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { |
162 if (Platform::current()->sandboxSupport()) | 162 if (Platform::current()->sandboxSupport()) |
163 return typefaceForFontconfigInterfaceIdAndTtcIndex(creationParams.fo
ntconfigInterfaceId(), creationParams.ttcIndex()); | 163 return typefaceForFontconfigInterfaceIdAndTtcIndex(creationParams.fo
ntconfigInterfaceId(), creationParams.ttcIndex()); |
164 return adoptRef(SkTypeface::CreateFromFile(creationParams.filename().dat
a(), creationParams.ttcIndex())); | 164 return fromSkSp(SkTypeface::MakeFromFile(creationParams.filename().data(
), creationParams.ttcIndex())); |
165 } | 165 } |
166 #endif | 166 #endif |
167 | 167 |
168 AtomicString family = creationParams.family(); | 168 AtomicString family = creationParams.family(); |
169 // If we're creating a fallback font (e.g. "-webkit-monospace"), convert the
name into | 169 // If we're creating a fallback font (e.g. "-webkit-monospace"), convert the
name into |
170 // the fallback name (like "monospace") that fontconfig understands. | 170 // the fallback name (like "monospace") that fontconfig understands. |
171 if (!family.length() || family.startsWith("-webkit-")) { | 171 if (!family.length() || family.startsWith("-webkit-")) { |
172 name = getFallbackFontFamily(fontDescription).getString().utf8(); | 172 name = getFallbackFontFamily(fontDescription).getString().utf8(); |
173 } else { | 173 } else { |
174 // convert the name to utf8 | 174 // convert the name to utf8 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return adoptPtr(new FontPlatformData(tf, | 212 return adoptPtr(new FontPlatformData(tf, |
213 name.data(), | 213 name.data(), |
214 fontSize, | 214 fontSize, |
215 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr
iption.isSyntheticBold(), | 215 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr
iption.isSyntheticBold(), |
216 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 216 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
217 fontDescription.orientation())); | 217 fontDescription.orientation())); |
218 } | 218 } |
219 #endif // !OS(WIN) | 219 #endif // !OS(WIN) |
220 | 220 |
221 } // namespace blink | 221 } // namespace blink |
OLD | NEW |