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

Unified Diff: third_party/WebKit/Source/platform/fonts/GlyphBuffer.h

Issue 2598393002: Do not skip ink for ideographic scripts (Closed)
Patch Set: Fix not to compute twice Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/fonts/GlyphBuffer.h
diff --git a/third_party/WebKit/Source/platform/fonts/GlyphBuffer.h b/third_party/WebKit/Source/platform/fonts/GlyphBuffer.h
index f05a0d5ad37ac87f4aa576a7161b1a416c8aaee5..b52bd1d58ed49b4a0fe3bbc814ad2fbcb0bdf8bc 100644
--- a/third_party/WebKit/Source/platform/fonts/GlyphBuffer.h
+++ b/third_party/WebKit/Source/platform/fonts/GlyphBuffer.h
@@ -92,16 +92,24 @@ class GlyphBuffer {
return m_offsets[index * 2 + 1];
}
- void add(Glyph glyph, const SimpleFontData* font, float x) {
+ void add(Glyph glyph,
+ const SimpleFontData* font,
+ float x,
+ unsigned characterIndex = 0) {
// cannot mix x-only/xy offsets
ASSERT(!hasVerticalOffsets());
m_fontData.append(font);
m_glyphs.append(glyph);
m_offsets.append(x);
+ if (m_characterIndexes)
+ m_characterIndexes->append(characterIndex);
}
- void add(Glyph glyph, const SimpleFontData* font, const FloatPoint& offset) {
+ void add(Glyph glyph,
+ const SimpleFontData* font,
+ const FloatPoint& offset,
+ unsigned characterIndex = 0) {
// cannot mix x-only/xy offsets
ASSERT(isEmpty() || hasVerticalOffsets());
@@ -109,6 +117,8 @@ class GlyphBuffer {
m_glyphs.append(glyph);
m_offsets.append(offset.x());
m_offsets.append(offset.y());
+ if (m_characterIndexes)
+ m_characterIndexes->append(characterIndex);
}
void reverseForSimpleRTL(float afterOffset, float totalWidth) {
@@ -141,6 +151,15 @@ class GlyphBuffer {
m_offsets.reverse();
}
+ void saveCharacterIndexes() {
+ m_characterIndexes.reset(new Vector<unsigned, 2048>());
+ }
+
+ unsigned characterIndex(unsigned index) const {
+ DCHECK(m_characterIndexes);
+ return (*m_characterIndexes)[index];
+ }
+
protected:
Vector<const SimpleFontData*, 2048> m_fontData;
Vector<Glyph, 2048> m_glyphs;
@@ -149,6 +168,8 @@ class GlyphBuffer {
// (depending on the buffer-wide positioning mode). This matches the
// glyph positioning format used by Skia.
Vector<float, 2048> m_offsets;
+
+ std::unique_ptr<Vector<unsigned, 2048>> m_characterIndexes;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698