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

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: Rebase again Created 5 years, 9 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
« no previous file with comments | « Source/platform/fonts/Character.h ('k') | Source/platform/fonts/shaping/HarfBuzzShaper.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 float m_width; 112 float m_width;
113 }; 113 };
114 114
115 float nextExpansionPerOpportunity(); 115 float nextExpansionPerOpportunity();
116 // setPadding sets a number of pixels to be distributed across the TextRun. 116 // setPadding sets a number of pixels to be distributed across the TextRun.
117 // WebKit uses this to justify text. 117 // WebKit uses this to justify text.
118 void setExpansion(float); 118 void setExpansion(float);
119 119
120 void setFontFeatures(); 120 void setFontFeatures();
121 121
122 template<typename CharType>
123 bool shapeInternal(GlyphBuffer*);
124 template<typename CharType>
122 bool createHarfBuzzRuns(); 125 bool createHarfBuzzRuns();
123 bool createHarfBuzzRunsForSingleCharacter(); 126 bool createHarfBuzzRunsForSingleCharacter();
127 template<typename CharType>
124 bool shapeHarfBuzzRuns(); 128 bool shapeHarfBuzzRuns();
125 bool fillGlyphBuffer(GlyphBuffer*); 129 bool fillGlyphBuffer(GlyphBuffer*);
126 float fillGlyphBufferFromHarfBuzzRun(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance); 130 float fillGlyphBufferFromHarfBuzzRun(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance);
127 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance); 131 float fillGlyphBufferForTextEmphasis(GlyphBuffer*, HarfBuzzRun*, float initi alAdvance);
128 void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, hb_buffer_t*, HarfBuzzRun * previousRun); 132 void setGlyphPositionsForHarfBuzzRun(HarfBuzzRun*, hb_buffer_t*, HarfBuzzRun * previousRun);
129 float adjustSpacing(HarfBuzzRun*, size_t glyphIndex, unsigned currentCharact erIndex, HarfBuzzRun* previousRun, float& offsetX, float& totalAdvance); 133 float adjustSpacing(HarfBuzzRun*, size_t glyphIndex, unsigned currentCharact erIndex, HarfBuzzRun* previousRun, float& offsetX, float& totalAdvance);
130 void addHarfBuzzRun(unsigned startCharacter, unsigned endCharacter, const Si mpleFontData*, UScriptCode); 134 void addHarfBuzzRun(unsigned startCharacter, unsigned endCharacter, const Si mpleFontData*, UScriptCode);
131 135
132 OwnPtr<UChar[]> m_normalizedBuffer;
133 unsigned m_normalizedBufferLength;
134
135 float m_wordSpacingAdjustment; // Delta adjustment (pixels) for each word br eak. 136 float m_wordSpacingAdjustment; // Delta adjustment (pixels) for each word br eak.
136 float m_letterSpacing; // Pixels to be added after each glyph. 137 float m_letterSpacing; // Pixels to be added after each glyph.
137 unsigned m_expansionOpportunityCount; 138 unsigned m_expansionOpportunityCount;
138 139
139 Vector<hb_feature_t, 4> m_features; 140 Vector<hb_feature_t, 4> m_features;
140 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns; 141 Vector<OwnPtr<HarfBuzzRun>, 16> m_harfBuzzRuns;
141 142
142 int m_fromIndex; 143 int m_fromIndex;
143 int m_toIndex; 144 int m_toIndex;
144 145
145 float m_totalWidth; 146 float m_totalWidth;
146 147
147 friend struct CachedShapingResults; 148 friend struct CachedShapingResults;
148 }; 149 };
149 150
150 } // namespace blink 151 } // namespace blink
151 152
152 #endif // HarfBuzzShaper_h 153 #endif // HarfBuzzShaper_h
OLDNEW
« no previous file with comments | « Source/platform/fonts/Character.h ('k') | Source/platform/fonts/shaping/HarfBuzzShaper.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698