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

Unified Diff: ui/gfx/render_text_harfbuzz.h

Issue 351963002: RenderTextHarfBuzz: Allow mid-glyph cursors in multi-grapheme clusters (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: reuse breakiterator Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/render_text_harfbuzz.h
diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h
index 59ce92f21c31398eace9628103e883f332ace9f1..b96961595e884e432f4e813fcba23ae16d5a0a8e 100644
--- a/ui/gfx/render_text_harfbuzz.h
+++ b/ui/gfx/render_text_harfbuzz.h
@@ -5,6 +5,7 @@
#ifndef UI_GFX_RENDER_TEXT_HARFBUZZ_H_
#define UI_GFX_RENDER_TEXT_HARFBUZZ_H_
+#include "base/i18n/break_iterator.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
#include "third_party/harfbuzz-ng/src/hb.h"
@@ -29,12 +30,17 @@ struct GFX_EXPORT TextRunHarfBuzz {
// value is in run-space (0 corresponds to the first glyph in the run).
Range CharRangeToGlyphRange(const Range& range) const;
+ // Writes the character and glyph ranges of the cluster containing |pos|.
+ void GetClusterAt(size_t pos, Range* chars, Range* glyphs) const;
+
+ // Returns bounds of the grapheme at |text_index|. Handles multi-grapheme
msw 2014/06/29 22:29:10 nit: s/bounds of the grapheme/the grapheme bounds/
ckocagil 2014/07/24 21:46:56 Done.
+ // glyphs.
+ Range GetGraphemeBounds(const base::string16& text, size_t text_index);
+
// Returns whether the given shaped run contains any missing glyphs.
bool HasMissingGlyphs() const;
- // Returns the X coordinate of the leading or |trailing| edge of the glyph
- // starting at |text_index|, relative to the left of the text (not the view).
- int GetGlyphXBoundary(size_t text_index, bool trailing) const;
+ base::i18n::BreakIterator* GetGraphemeIterator(const base::string16& text);
int width;
int preceding_run_widths;
@@ -42,10 +48,11 @@ struct GFX_EXPORT TextRunHarfBuzz {
bool is_rtl;
UBiDiLevel level;
UScriptCode script;
+ scoped_ptr<base::i18n::BreakIterator> grapheme_iterator;
scoped_ptr<uint16[]> glyphs;
scoped_ptr<SkPoint[]> positions;
- scoped_ptr<uint32[]> glyph_to_char;
+ std::vector<uint32> glyph_to_char;
size_t glyph_count;
skia::RefPtr<SkTypeface> skia_face;

Powered by Google App Engine
This is Rietveld 408576698