| 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 24 matching lines...) Expand all Loading... |
| 35 #include "platform/fonts/AcceptLanguagesResolver.h" | 35 #include "platform/fonts/AcceptLanguagesResolver.h" |
| 36 #include "platform/fonts/AlternateFontFamily.h" | 36 #include "platform/fonts/AlternateFontFamily.h" |
| 37 #include "platform/fonts/FontCache.h" | 37 #include "platform/fonts/FontCache.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/SimpleFontData.h" | 40 #include "platform/fonts/SimpleFontData.h" |
| 41 #include "platform/graphics/skia/SkiaUtils.h" | 41 #include "platform/graphics/skia/SkiaUtils.h" |
| 42 #include "public/platform/Platform.h" | 42 #include "public/platform/Platform.h" |
| 43 #include "public/platform/linux/WebSandboxSupport.h" | 43 #include "public/platform/linux/WebSandboxSupport.h" |
| 44 #include "wtf/Assertions.h" | 44 #include "wtf/Assertions.h" |
| 45 #include "wtf/PtrUtil.h" |
| 45 #include "wtf/text/AtomicString.h" | 46 #include "wtf/text/AtomicString.h" |
| 46 #include "wtf/text/CString.h" | 47 #include "wtf/text/CString.h" |
| 48 #include <memory> |
| 47 #include <unicode/locid.h> | 49 #include <unicode/locid.h> |
| 48 | 50 |
| 49 #if !OS(WIN) && !OS(ANDROID) | 51 #if !OS(WIN) && !OS(ANDROID) |
| 50 #include "SkFontConfigInterface.h" | 52 #include "SkFontConfigInterface.h" |
| 51 | 53 |
| 52 static PassRefPtr<SkTypeface> typefaceForFontconfigInterfaceIdAndTtcIndex(int fo
ntconfigInterfaceId, int ttcIndex) | 54 static PassRefPtr<SkTypeface> typefaceForFontconfigInterfaceIdAndTtcIndex(int fo
ntconfigInterfaceId, int ttcIndex) |
| 53 { | 55 { |
| 54 SkAutoTUnref<SkFontConfigInterface> fci(SkFontConfigInterface::RefGlobal()); | 56 SkAutoTUnref<SkFontConfigInterface> fci(SkFontConfigInterface::RefGlobal()); |
| 55 SkFontConfigInterface::FontIdentity fontIdentity; | 57 SkFontConfigInterface::FontIdentity fontIdentity; |
| 56 fontIdentity.fID = fontconfigInterfaceId; | 58 fontIdentity.fID = fontconfigInterfaceId; |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 #endif | 196 #endif |
| 195 | 197 |
| 196 // FIXME: Use m_fontManager, matchFamilyStyle instead of | 198 // FIXME: Use m_fontManager, matchFamilyStyle instead of |
| 197 // legacyCreateTypeface on all platforms. | 199 // legacyCreateTypeface on all platforms. |
| 198 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); | 200 RefPtr<SkFontMgr> fm = adoptRef(SkFontMgr::RefDefault()); |
| 199 return adoptRef(fm->legacyCreateTypeface(name.data(), | 201 return adoptRef(fm->legacyCreateTypeface(name.data(), |
| 200 fontDescription.skiaFontStyle())); | 202 fontDescription.skiaFontStyle())); |
| 201 } | 203 } |
| 202 | 204 |
| 203 #if !OS(WIN) | 205 #if !OS(WIN) |
| 204 PassOwnPtr<FontPlatformData> FontCache::createFontPlatformData(const FontDescrip
tion& fontDescription, | 206 std::unique_ptr<FontPlatformData> FontCache::createFontPlatformData(const FontDe
scription& fontDescription, |
| 205 const FontFaceCreationParams& creationParams, float fontSize) | 207 const FontFaceCreationParams& creationParams, float fontSize) |
| 206 { | 208 { |
| 207 CString name; | 209 CString name; |
| 208 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name))
; | 210 RefPtr<SkTypeface> tf(createTypeface(fontDescription, creationParams, name))
; |
| 209 if (!tf) | 211 if (!tf) |
| 210 return nullptr; | 212 return nullptr; |
| 211 | 213 |
| 212 return adoptPtr(new FontPlatformData(tf, | 214 return wrapUnique(new FontPlatformData(tf, |
| 213 name.data(), | 215 name.data(), |
| 214 fontSize, | 216 fontSize, |
| 215 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr
iption.isSyntheticBold(), | 217 (fontDescription.weight() > 200 + tf->fontStyle().weight()) || fontDescr
iption.isSyntheticBold(), |
| 216 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), | 218 ((fontDescription.style() == FontStyleItalic || fontDescription.style()
== FontStyleOblique) && !tf->isItalic()) || fontDescription.isSyntheticItalic(), |
| 217 fontDescription.orientation())); | 219 fontDescription.orientation())); |
| 218 } | 220 } |
| 219 #endif // !OS(WIN) | 221 #endif // !OS(WIN) |
| 220 | 222 |
| 221 } // namespace blink | 223 } // namespace blink |
| OLD | NEW |