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 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 #include "wtf/text/CharacterNames.h" | 46 #include "wtf/text/CharacterNames.h" |
47 | 47 |
48 #include <unicode/uscript.h> | 48 #include <unicode/uscript.h> |
49 | 49 |
50 namespace blink { | 50 namespace blink { |
51 | 51 |
52 class Font; | 52 class Font; |
53 class GlyphBuffer; | 53 class GlyphBuffer; |
54 class SimpleFontData; | 54 class SimpleFontData; |
55 class HarfBuzzShaper; | 55 class HarfBuzzShaper; |
| 56 class UnicodeRangeSet; |
56 | 57 |
57 // Shaping text runs is split into several stages: Run segmentation, shaping the | 58 // Shaping text runs is split into several stages: Run segmentation, shaping the |
58 // initial segment, identify shaped and non-shaped sequences of the shaping | 59 // initial segment, identify shaped and non-shaped sequences of the shaping |
59 // result, and processing sub-runs by trying to shape them with a fallback font | 60 // result, and processing sub-runs by trying to shape them with a fallback font |
60 // until the last resort font is reached. | 61 // until the last resort font is reached. |
61 // | 62 // |
62 // Going through one example to illustrate the process: The following is a run o
f | 63 // Going through one example to illustrate the process: The following is a run o
f |
63 // vertical text to be shaped. After run segmentation in RunSegmenter it is spli
t | 64 // vertical text to be shaped. After run segmentation in RunSegmenter it is spli
t |
64 // into 4 segments. The segments indicated by the segementation results showing | 65 // into 4 segments. The segments indicated by the segementation results showing |
65 // the script, orientation information and small caps handling of the individual | 66 // the script, orientation information and small caps handling of the individual |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 private: | 156 private: |
156 void setFontFeatures(); | 157 void setFontFeatures(); |
157 | 158 |
158 void appendToHolesQueue(HolesQueueItemAction, | 159 void appendToHolesQueue(HolesQueueItemAction, |
159 unsigned startIndex, | 160 unsigned startIndex, |
160 unsigned numCharacters); | 161 unsigned numCharacters); |
161 inline bool shapeRange(hb_buffer_t* harfBuzzBuffer, | 162 inline bool shapeRange(hb_buffer_t* harfBuzzBuffer, |
162 unsigned startIndex, | 163 unsigned startIndex, |
163 unsigned numCharacters, | 164 unsigned numCharacters, |
164 const SimpleFontData* currentFont, | 165 const SimpleFontData* currentFont, |
165 unsigned currentFontRangeFrom, | 166 PassRefPtr<UnicodeRangeSet> currentFontRangeSet, |
166 unsigned currentFontRangeTo, | |
167 UScriptCode currentRunScript, | 167 UScriptCode currentRunScript, |
168 hb_language_t); | 168 hb_language_t); |
169 bool extractShapeResults(hb_buffer_t* harfBuzzBuffer, | 169 bool extractShapeResults(hb_buffer_t* harfBuzzBuffer, |
170 ShapeResult*, | 170 ShapeResult*, |
171 bool& fontCycleQueued, | 171 bool& fontCycleQueued, |
172 const HolesQueueItem& currentQueueItem, | 172 const HolesQueueItem& currentQueueItem, |
173 const SimpleFontData* currentFont, | 173 const SimpleFontData* currentFont, |
174 UScriptCode currentRunScript, | 174 UScriptCode currentRunScript, |
175 bool isLastResort); | 175 bool isLastResort); |
176 bool collectFallbackHintChars(Vector<UChar32>& hint, bool needsList); | 176 bool collectFallbackHintChars(Vector<UChar32>& hint, bool needsList); |
177 | 177 |
178 void insertRunIntoShapeResult(ShapeResult*, PassOwnPtr<ShapeResult::RunInfo>
runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); | 178 void insertRunIntoShapeResult(ShapeResult*, PassOwnPtr<ShapeResult::RunInfo>
runToInsert, unsigned startGlyph, unsigned numGlyphs, hb_buffer_t*); |
179 | 179 |
180 OwnPtr<UChar[]> m_normalizedBuffer; | 180 OwnPtr<UChar[]> m_normalizedBuffer; |
181 unsigned m_normalizedBufferLength; | 181 unsigned m_normalizedBufferLength; |
182 | 182 |
183 Vector<hb_feature_t, 4> m_features; | 183 Vector<hb_feature_t, 4> m_features; |
184 Deque<HolesQueueItem> m_holesQueue; | 184 Deque<HolesQueueItem> m_holesQueue; |
185 }; | 185 }; |
186 | 186 |
187 | 187 |
188 } // namespace blink | 188 } // namespace blink |
189 | 189 |
190 #endif // HarfBuzzShaper_h | 190 #endif // HarfBuzzShaper_h |
OLD | NEW |