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