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

Unified Diff: ui/gfx/render_text_harfbuzz.h

Issue 674683003: Avoid extra FontRenderParams queries in RenderTextHarfBuzz. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: restore check that a family was actually found Created 6 years, 2 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
« no previous file with comments | « no previous file | 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 c3508ff258c8da9d247bdb3ad71d4a31000f0344..68da3e837b8c74975c2459b904059b9f995b29f9 100644
--- a/ui/gfx/render_text_harfbuzz.h
+++ b/ui/gfx/render_text_harfbuzz.h
@@ -60,6 +60,7 @@ struct GFX_EXPORT TextRunHarfBuzz {
std::vector<uint32> glyph_to_char;
size_t glyph_count;
+ std::string family;
skia::RefPtr<SkTypeface> skia_face;
FontRenderParams render_params;
int font_size;
@@ -127,10 +128,23 @@ class GFX_EXPORT RenderTextHarfBuzz : public RenderText {
// Break the text into logical runs and populate the visual <-> logical maps.
void ItemizeText();
+ // Helper method for ShapeRun() that calls ShapeRunWithFont() with |run|,
+ // |family|, and |render_params|, returning true if the family provides all
+ // needed glyphs and false otherwise. Additionally updates |best_family|,
+ // |best_render_params|, and |best_missing_glyphs| if |family| has fewer than
+ // |best_missing_glyphs| missing glyphs.
+ bool CompareFamily(internal::TextRunHarfBuzz* run,
+ const std::string& family,
+ const gfx::FontRenderParams& render_params,
+ std::string* best_family,
+ gfx::FontRenderParams* best_render_params,
+ size_t* best_missing_glyphs);
+
// Shape the glyphs needed for the text |run|.
void ShapeRun(internal::TextRunHarfBuzz* run);
bool ShapeRunWithFont(internal::TextRunHarfBuzz* run,
- const std::string& font);
+ const std::string& font_family,
+ const FontRenderParams& params);
// Text runs in logical order.
ScopedVector<internal::TextRunHarfBuzz> runs_;
« no previous file with comments | « no previous file | ui/gfx/render_text_harfbuzz.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698