Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(98)

Side by Side Diff: Source/platform/fonts/shaping/HarfBuzzShaper.h

Issue 957473003: Optimize complex text shaping (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 float m_width; 116 float m_width;
117 }; 117 };
118 118
119 float nextExpansionPerOpportunity(); 119 float nextExpansionPerOpportunity();
120 // setPadding sets a number of pixels to be distributed across the TextRun. 120 // setPadding sets a number of pixels to be distributed across the TextRun.
121 // WebKit uses this to justify text. 121 // WebKit uses this to justify text.
122 void setExpansion(float); 122 void setExpansion(float);
123 123
124 void setFontFeatures(); 124 void setFontFeatures();
125 125
126 template<typename CharType>
127 bool shapeInternal(GlyphBuffer*);
128 template<typename CharType>
126 bool createHarfBuzzRuns(); 129 bool createHarfBuzzRuns();
127 bool createHarfBuzzRunsForSingleCharacter(); 130 bool createHarfBuzzRunsForSingleCharacter();
131 template<typename CharType>
128 bool shapeHarfBuzzRuns(); 132 bool shapeHarfBuzzRuns();
129 bool fillGlyphBuffer(GlyphBuffer*); 133 bool fillGlyphBuffer(GlyphBuffer*);
130 float fillGlyphBufferFromHarfBuzzRun(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance); 134 float fillGlyphBufferFromHarfBuzzRun(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance);
131 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance); 135 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance);
132 void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, hb_buffer_t*, HarfBuzzRun * previousRun); 136 void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, hb_buffer_t*, HarfBuzzRun * previousRun);
133 float adjustSpacing(HarfBuzzRun*, size_t glyphIndex, unsigned currentCharact erIndex, HarfBuzzRun* previousRun, float& offsetX, float& totalAdvance); 137 float adjustSpacing(HarfBuzzRun*, size_t glyphIndex, unsigned currentCharact erIndex, HarfBuzzRun* previousRun, float& offsetX, float& totalAdvance);
134 void addHarfBuzzRun(unsigned startCharacter, unsigned endCharacter, const Si mpleFontData*, UScriptCode); 138 void addHarfBuzzRun(unsigned startCharacter, unsigned endCharacter, const Si mpleFontData*, UScriptCode);
135 139
136 const Font* m_font; 140 const Font* m_font;
137 OwnPtr<UChar[]> m_normalizedBuffer;
138 unsigned m_normalizedBufferLength;
139 const TextRun& m_run; 141 const TextRun& m_run;
140 142
141 float m_wordSpacingAdjustment; // Delta adjustment (pixels) for each word br eak. 143 float m_wordSpacingAdjustment; // Delta adjustment (pixels) for each word br eak.
142 float m_expansion; // Pixels to be distributed over the line at word breaks. 144 float m_expansion; // Pixels to be distributed over the line at word breaks.
143 float m_letterSpacing; // Pixels to be added after each glyph. 145 float m_letterSpacing; // Pixels to be added after each glyph.
144 float m_expansionPerOpportunity; // Pixels to be added to each expansion opp ortunity. 146 float m_expansionPerOpportunity; // Pixels to be added to each expansion opp ortunity.
145 unsigned m_expansionOpportunityCount; 147 unsigned m_expansionOpportunityCount;
146 bool m_isAfterExpansion; 148 bool m_isAfterExpansion;
147 149
148 Vector<hb_feature_t, 4> m_features; 150 Vector<hb_feature_t, 4> m_features;
149 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; 151 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns;
150 152
151 int m_fromIndex; 153 int m_fromIndex;
152 int m_toIndex; 154 int m_toIndex;
153 155
154 ForTextEmphasisOrNot m_forTextEmphasis; 156 ForTextEmphasisOrNot m_forTextEmphasis;
155 157
156 float m_totalWidth; 158 float m_totalWidth;
157 FloatRect* m_glyphBoundingBox; 159 FloatRect* m_glyphBoundingBox;
158 HashSet<const SimpleFontData*>* m_fallbackFonts; 160 HashSet<const SimpleFontData*>* m_fallbackFonts;
159 161
160 friend struct CachedShapingResults; 162 friend struct CachedShapingResults;
161 }; 163 };
162 164
163 } // namespace blink 165 } // namespace blink
164 166
165 #endif // HarfBuzzShaper_h 167 #endif // HarfBuzzShaper_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698