OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND AN
Y | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR AN
Y | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND O
N | 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 21 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #include "platform/fonts/FontCache.h" | 25 #include "platform/fonts/FontCache.h" |
26 | 26 |
27 #include "platform/fonts/FontPlatformData.h" | 27 #include "platform/fonts/FontPlatformData.h" |
28 #include "platform/fonts/SimpleFontData.h" | 28 #include "platform/fonts/SimpleFontData.h" |
29 #include "public/platform/linux/WebFallbackFont.h" | 29 #include "public/platform/linux/WebFallbackFont.h" |
30 #include "public/platform/linux/WebSandboxSupport.h" | 30 #include "public/platform/linux/WebSandboxSupport.h" |
31 #include "public/platform/Platform.h" | 31 #include "public/platform/Platform.h" |
32 #include "ui/gfx/font_fallback_linux.h" | 32 #include "ui/gfx/font_fallback_linux.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 fallbackFont->isItalic = fallbackData.is_italic; | 70 fallbackFont->isItalic = fallbackData.is_italic; |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
74 #if !OS(ANDROID) | 74 #if !OS(ANDROID) |
75 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( | 75 PassRefPtr<SimpleFontData> FontCache::fallbackFontForCharacter( |
76 const FontDescription& fontDescription, | 76 const FontDescription& fontDescription, |
77 UChar32 c, | 77 UChar32 c, |
78 const SimpleFontData*, | 78 const SimpleFontData*, |
79 FontFallbackPriority fallbackPriority) { | 79 FontFallbackPriority fallbackPriority) { |
80 // The m_fontManager is set only if it was provided by the embedder with WebFo
ntRendering::setSkiaFontManager. This is | 80 // The m_fontManager is set only if it was provided by the embedder with |
81 // used to emulate android fonts on linux so we always request the family from
the font manager and if none is found, we return | 81 // WebFontRendering::setSkiaFontManager. This is used to emulate android fonts |
82 // the LastResort fallback font and avoid using FontCache::getFontForCharacter
which would use sandbox support to | 82 // on linux so we always request the family from the font manager and if none |
83 // query the underlying system for the font family. | 83 // is found, we return the LastResort fallback font and avoid using |
| 84 // FontCache::getFontForCharacter which would use sandbox support to query the |
| 85 // underlying system for the font family. |
84 if (m_fontManager) { | 86 if (m_fontManager) { |
85 AtomicString familyName = getFamilyNameForCharacter( | 87 AtomicString familyName = getFamilyNameForCharacter( |
86 m_fontManager.get(), c, fontDescription, fallbackPriority); | 88 m_fontManager.get(), c, fontDescription, fallbackPriority); |
87 if (familyName.isEmpty()) | 89 if (familyName.isEmpty()) |
88 return getLastResortFallbackFont(fontDescription, DoNotRetain); | 90 return getLastResortFallbackFont(fontDescription, DoNotRetain); |
89 return fontDataFromFontPlatformData( | 91 return fontDataFromFontPlatformData( |
90 getFontPlatformData(fontDescription, | 92 getFontPlatformData(fontDescription, |
91 FontFaceCreationParams(familyName)), | 93 FontFaceCreationParams(familyName)), |
92 DoNotRetain); | 94 DoNotRetain); |
93 } | 95 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 std::unique_ptr<FontPlatformData> platformData( | 151 std::unique_ptr<FontPlatformData> platformData( |
150 new FontPlatformData(*substitutePlatformData)); | 152 new FontPlatformData(*substitutePlatformData)); |
151 platformData->setSyntheticBold(shouldSetSyntheticBold); | 153 platformData->setSyntheticBold(shouldSetSyntheticBold); |
152 platformData->setSyntheticItalic(shouldSetSyntheticItalic); | 154 platformData->setSyntheticItalic(shouldSetSyntheticItalic); |
153 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); | 155 return fontDataFromFontPlatformData(platformData.get(), DoNotRetain); |
154 } | 156 } |
155 | 157 |
156 #endif // !OS(ANDROID) | 158 #endif // !OS(ANDROID) |
157 | 159 |
158 } // namespace blink | 160 } // namespace blink |
OLD | NEW |