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

Unified Diff: ui/gfx/render_text_harfbuzz.h

Issue 738363002: Enable subpixel positioning for UI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: std::round to std::floor(+0.5) Created 6 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
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_harfbuzz.h
diff --git a/ui/gfx/render_text_harfbuzz.h b/ui/gfx/render_text_harfbuzz.h
index e71d50e8ff94973140f63fc6f67c6f85760fcc93..c87ceeb2793f9aa08aded0b77bcb934e66a23881 100644
--- a/ui/gfx/render_text_harfbuzz.h
+++ b/ui/gfx/render_text_harfbuzz.h
@@ -22,6 +22,12 @@ namespace gfx {
namespace internal {
+// TODO(ckocagil): Make Range a template class and RangeF an instance of it.
+typedef std::pair<float, float> RangeF;
+
+// Applies std::round to the start and end values of the given RangeF.
+Range GFX_EXPORT RoundRangeF(const RangeF& range_f);
+
struct GFX_EXPORT TextRunHarfBuzz {
TextRunHarfBuzz();
~TextRunHarfBuzz();
@@ -42,8 +48,8 @@ struct GFX_EXPORT TextRunHarfBuzz {
void GetClusterAt(size_t pos, Range* chars, Range* glyphs) const;
// Returns the grapheme bounds at |text_index|. Handles multi-grapheme glyphs.
- Range GetGraphemeBounds(base::i18n::BreakIterator* grapheme_iterator,
- size_t text_index);
+ RangeF GetGraphemeBounds(base::i18n::BreakIterator* grapheme_iterator,
+ size_t text_index);
// Returns whether the given shaped run contains any missing glyphs.
bool HasMissingGlyphs() const;
@@ -116,7 +122,7 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
// Return the run index that contains the argument; or the length of the
// |runs_| vector if argument exceeds the text length or width.
size_t GetRunContainingCaret(const SelectionModel& caret) const;
- size_t GetRunContainingXCoord(int x, int* offset) const;
+ size_t GetRunContainingXCoord(float x, float* offset) const;
// Given a |run|, returns the SelectionModel that contains the logical first
// or last caret position inside (not at a boundary of) the run.
« no previous file with comments | « ui/gfx/render_text.cc ('k') | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698