OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006, 2008, 2011 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008 Holger Hans Peter Freyther | 3 * Copyright (C) 2008 Holger Hans Peter Freyther |
4 * Copyright (C) 2014 Google Inc. All rights reserved. | 4 * Copyright (C) 2014 Google Inc. All rights reserved. |
5 * | 5 * |
6 * This library is free software; you can redistribute it and/or | 6 * This library is free software; you can redistribute it and/or |
7 * modify it under the terms of the GNU Library General Public | 7 * modify it under the terms of the GNU Library General Public |
8 * License as published by the Free Software Foundation; either | 8 * License as published by the Free Software Foundation; either |
9 * version 2 of the License, or (at your option) any later version. | 9 * version 2 of the License, or (at your option) any later version. |
10 * | 10 * |
11 * This library is distributed in the hope that it will be useful, | 11 * This library is distributed in the hope that it will be useful, |
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 * Library General Public License for more details. | 14 * Library General Public License for more details. |
15 * | 15 * |
16 * You should have received a copy of the GNU Library General Public License | 16 * You should have received a copy of the GNU Library General Public License |
17 * along with this library; see the file COPYING.LIB. If not, write to | 17 * along with this library; see the file COPYING.LIB. If not, write to |
18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
19 * Boston, MA 02110-1301, USA. | 19 * Boston, MA 02110-1301, USA. |
20 * | 20 * |
21 */ | 21 */ |
22 | 22 |
23 #ifndef SimpleShaper_h | 23 #ifndef SimpleShaper_h |
24 #define SimpleShaper_h | 24 #define SimpleShaper_h |
25 | 25 |
26 #include "platform/PlatformExport.h" | 26 #include "platform/PlatformExport.h" |
27 #include "platform/fonts/SVGGlyph.h" | |
28 #include "platform/text/TextRun.h" | 27 #include "platform/text/TextRun.h" |
29 #include "wtf/HashSet.h" | 28 #include "wtf/HashSet.h" |
30 #include "wtf/Vector.h" | 29 #include "wtf/Vector.h" |
31 #include "wtf/unicode/Unicode.h" | 30 #include "wtf/unicode/Unicode.h" |
32 | 31 |
33 namespace blink { | 32 namespace blink { |
34 | 33 |
35 class Font; | 34 class Font; |
36 class GlyphBuffer; | 35 class GlyphBuffer; |
37 class SimpleFontData; | 36 class SimpleFontData; |
(...skipping 20 matching lines...) Expand all Loading... |
58 | 57 |
59 SimpleShaper(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fa
llbackFonts = 0, GlyphBounds* = 0, bool forTextEmphasis = false); | 58 SimpleShaper(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fa
llbackFonts = 0, GlyphBounds* = 0, bool forTextEmphasis = false); |
60 | 59 |
61 unsigned advance(unsigned to, GlyphBuffer* = 0); | 60 unsigned advance(unsigned to, GlyphBuffer* = 0); |
62 bool advanceOneCharacter(float& width); | 61 bool advanceOneCharacter(float& width); |
63 | 62 |
64 const TextRun& run() const { return m_run; } | 63 const TextRun& run() const { return m_run; } |
65 float runWidthSoFar() const { return m_runWidthSoFar; } | 64 float runWidthSoFar() const { return m_runWidthSoFar; } |
66 unsigned currentOffset() { return m_currentCharacter; } | 65 unsigned currentOffset() { return m_currentCharacter; } |
67 | 66 |
68 #if ENABLE(SVG_FONTS) | |
69 Vector<SVGGlyph::ArabicForm>& arabicForms() { return m_arabicForms; } | |
70 #endif | |
71 | |
72 private: | 67 private: |
73 const Font* m_font; | 68 const Font* m_font; |
74 const TextRun& m_run; | 69 const TextRun& m_run; |
75 unsigned m_currentCharacter; | 70 unsigned m_currentCharacter; |
76 float m_runWidthSoFar; | 71 float m_runWidthSoFar; |
77 float m_expansion; | 72 float m_expansion; |
78 float m_expansionPerOpportunity; | 73 float m_expansionPerOpportunity; |
79 bool m_isAfterExpansion; | 74 bool m_isAfterExpansion; |
80 | 75 |
81 #if ENABLE(SVG_FONTS) | |
82 Vector<SVGGlyph::ArabicForm> m_arabicForms; | |
83 #endif | |
84 struct CharacterData { | 76 struct CharacterData { |
85 UChar32 character; | 77 UChar32 character; |
86 unsigned clusterLength; | 78 unsigned clusterLength; |
87 int characterOffset; | 79 int characterOffset; |
88 }; | 80 }; |
89 | 81 |
90 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false)
; | 82 GlyphData glyphDataForCharacter(CharacterData&, bool normalizeSpace = false)
; |
91 float characterWidth(UChar32, const GlyphData&) const; | 83 float characterWidth(UChar32, const GlyphData&) const; |
92 void cacheFallbackFont(const SimpleFontData*, const SimpleFontData* primaryF
ont); | 84 void cacheFallbackFont(const SimpleFontData*, const SimpleFontData* primaryF
ont); |
93 float adjustSpacing(float, const CharacterData&, const SimpleFontData&, Glyp
hBuffer*); | 85 float adjustSpacing(float, const CharacterData&, const SimpleFontData&, Glyp
hBuffer*); |
94 void updateGlyphBounds(const GlyphData&, float width, bool firstCharacter); | 86 void updateGlyphBounds(const GlyphData&, float width, bool firstCharacter); |
95 | 87 |
96 template <typename TextIterator> | 88 template <typename TextIterator> |
97 unsigned advanceInternal(TextIterator&, GlyphBuffer*); | 89 unsigned advanceInternal(TextIterator&, GlyphBuffer*); |
98 | 90 |
99 HashSet<const SimpleFontData*>* m_fallbackFonts; | 91 HashSet<const SimpleFontData*>* m_fallbackFonts; |
100 GlyphBounds* m_bounds; | 92 GlyphBounds* m_bounds; |
101 bool m_forTextEmphasis : 1; | 93 bool m_forTextEmphasis : 1; |
102 }; | 94 }; |
103 | 95 |
104 } // namespace blink | 96 } // namespace blink |
105 | 97 |
106 #endif | 98 #endif |
OLD | NEW |