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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after | 171 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after |
172 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. | 172 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. |
173 SkTypeface* typeface = nullptr; | 173 SkTypeface* typeface = nullptr; |
174 if (blink::Platform::current()->sandboxSupport()) | 174 if (blink::Platform::current()->sandboxSupport()) |
175 typeface = SkTypeface::CreateFromStream(streamForFontconfigInterface
Id(creationParams.fontconfigInterfaceId())); | 175 typeface = SkTypeface::CreateFromStream(streamForFontconfigInterface
Id(creationParams.fontconfigInterfaceId())); |
176 else | 176 else |
177 typeface = SkTypeface::CreateFromFile(creationParams.filename().data
()); | 177 typeface = SkTypeface::CreateFromFile(creationParams.filename().data
()); |
178 | 178 |
179 if (typeface) | 179 if (typeface) |
180 return adoptRef(typeface); | 180 return adoptRef(typeface); |
| 181 else |
| 182 return nullptr; |
181 } | 183 } |
182 #endif | 184 #endif |
183 | 185 |
184 AtomicString family = creationParams.family(); | 186 AtomicString family = creationParams.family(); |
185 // If we're creating a fallback font (e.g. "-webkit-monospace"), convert the
name into | 187 // If we're creating a fallback font (e.g. "-webkit-monospace"), convert the
name into |
186 // the fallback name (like "monospace") that fontconfig understands. | 188 // the fallback name (like "monospace") that fontconfig understands. |
187 if (!family.length() || family.startsWith("-webkit-")) { | 189 if (!family.length() || family.startsWith("-webkit-")) { |
188 name = getFallbackFontFamily(fontDescription).string().utf8(); | 190 name = getFallbackFontFamily(fontDescription).string().utf8(); |
189 } else { | 191 } else { |
190 // convert the name to utf8 | 192 // convert the name to utf8 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 fontSize, | 227 fontSize, |
226 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 228 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
227 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), | 229 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), |
228 fontDescription.orientation(), | 230 fontDescription.orientation(), |
229 fontDescription.useSubpixelPositioning()); | 231 fontDescription.useSubpixelPositioning()); |
230 return result; | 232 return result; |
231 } | 233 } |
232 #endif // !OS(WIN) | 234 #endif // !OS(WIN) |
233 | 235 |
234 } // namespace blink | 236 } // namespace blink |
OLD | NEW |