| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 #include "sky/engine/platform/fonts/SimpleFontData.h" | 42 #include "sky/engine/platform/fonts/SimpleFontData.h" |
| 43 #include "sky/engine/public/platform/Platform.h" | 43 #include "sky/engine/public/platform/Platform.h" |
| 44 #include "sky/engine/public/platform/linux/WebSandboxSupport.h" | 44 #include "sky/engine/public/platform/linux/WebSandboxSupport.h" |
| 45 #include "sky/engine/wtf/Assertions.h" | 45 #include "sky/engine/wtf/Assertions.h" |
| 46 #include "sky/engine/wtf/text/AtomicString.h" | 46 #include "sky/engine/wtf/text/AtomicString.h" |
| 47 #include "sky/engine/wtf/text/CString.h" | 47 #include "sky/engine/wtf/text/CString.h" |
| 48 #include "third_party/skia/include/core/SkStream.h" | 48 #include "third_party/skia/include/core/SkStream.h" |
| 49 #include "third_party/skia/include/core/SkTypeface.h" | 49 #include "third_party/skia/include/core/SkTypeface.h" |
| 50 #include "third_party/skia/include/ports/SkFontMgr.h" | 50 #include "third_party/skia/include/ports/SkFontMgr.h" |
| 51 | 51 |
| 52 #if !OS(WIN) && !OS(ANDROID) | 52 #if !OS(WIN) && !OS(ANDROID) && !OS(IOS) |
| 53 // TODO(bungeman) remove this temporary code ASAP. | 53 // TODO(bungeman) remove this temporary code ASAP. |
| 54 // This namespace exists to ease transition of SkTypeface from using SkStream to
SkStreamAsset. | 54 // This namespace exists to ease transition of SkTypeface from using SkStream to
SkStreamAsset. |
| 55 namespace tmp { | 55 namespace tmp { |
| 56 // Like std::declval but only returns lvalue references, ok since it isn't used
on rvalue references. | 56 // Like std::declval but only returns lvalue references, ok since it isn't used
on rvalue references. |
| 57 template<typename T> T& declvall(); | 57 template<typename T> T& declvall(); |
| 58 // The return type of SkFontConfigInterface::openStream(const SkFontConfigInterf
ace::FontIdentity&). | 58 // The return type of SkFontConfigInterface::openStream(const SkFontConfigInterf
ace::FontIdentity&). |
| 59 using StreamType = decltype(tmp::declvall<SkFontConfigInterface>().openStream(tm
p::declvall<const SkFontConfigInterface::FontIdentity&>())); | 59 using StreamType = decltype(tmp::declvall<SkFontConfigInterface>().openStream(tm
p::declvall<const SkFontConfigInterface::FontIdentity&>())); |
| 60 } | 60 } |
| 61 static tmp::StreamType streamForFontconfigInterfaceId(int fontconfigInterfaceId) | 61 static tmp::StreamType streamForFontconfigInterfaceId(int fontconfigInterfaceId) |
| 62 { | 62 { |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, (
AtomicString("Arial", AtomicString::ConstructFromLiteral))); | 208 DEFINE_STATIC_LOCAL(const FontFaceCreationParams, arialCreationParams, (
AtomicString("Arial", AtomicString::ConstructFromLiteral))); |
| 209 fontPlatformData = getFontPlatformData(description, arialCreationParams)
; | 209 fontPlatformData = getFontPlatformData(description, arialCreationParams)
; |
| 210 } | 210 } |
| 211 | 211 |
| 212 ASSERT(fontPlatformData); | 212 ASSERT(fontPlatformData); |
| 213 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); | 213 return fontDataFromFontPlatformData(fontPlatformData, shouldRetain); |
| 214 } | 214 } |
| 215 | 215 |
| 216 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) | 216 PassRefPtr<SkTypeface> FontCache::createTypeface(const FontDescription& fontDesc
ription, const FontFaceCreationParams& creationParams, CString& name) |
| 217 { | 217 { |
| 218 #if !OS(WIN) && !OS(ANDROID) | 218 #if !OS(WIN) && !OS(ANDROID) && !OS(IOS) |
| 219 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { | 219 if (creationParams.creationType() == CreateFontByFciIdAndTtcIndex) { |
| 220 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after | 220 // TODO(dro): crbug.com/381620 Use creationParams.ttcIndex() after |
| 221 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. | 221 // https://code.google.com/p/skia/issues/detail?id=1186 gets fixed. |
| 222 SkTypeface* typeface = nullptr; | 222 SkTypeface* typeface = nullptr; |
| 223 if (Platform::current()->sandboxSupport()) | 223 if (Platform::current()->sandboxSupport()) |
| 224 typeface = SkTypeface::CreateFromStream(streamForFontconfigInterface
Id(creationParams.fontconfigInterfaceId())); | 224 typeface = SkTypeface::CreateFromStream(streamForFontconfigInterface
Id(creationParams.fontconfigInterfaceId())); |
| 225 else | 225 else |
| 226 typeface = SkTypeface::CreateFromFile(creationParams.filename().data
()); | 226 typeface = SkTypeface::CreateFromFile(creationParams.filename().data
()); |
| 227 | 227 |
| 228 if (typeface) | 228 if (typeface) |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 fontSize, | 273 fontSize, |
| 274 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), | 274 (fontDescription.weight() >= FontWeight600 && !tf->isBold()) || fontDesc
ription.isSyntheticBold(), |
| 275 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), | 275 (fontDescription.style() && !tf->isItalic()) || fontDescription.isSynthe
ticItalic(), |
| 276 fontDescription.orientation(), | 276 fontDescription.orientation(), |
| 277 fontDescription.useSubpixelPositioning()); | 277 fontDescription.useSubpixelPositioning()); |
| 278 return result; | 278 return result; |
| 279 } | 279 } |
| 280 #endif // !OS(WIN) | 280 #endif // !OS(WIN) |
| 281 | 281 |
| 282 } // namespace blink | 282 } // namespace blink |
| OLD | NEW |