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

Unified Diff: ui/gfx/render_text_harfbuzz.cc

Issue 674233003: RenderTextHarfBuzz: Try fallback fonts of the Uniscribe font while shaping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: skip first font 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
Index: ui/gfx/render_text_harfbuzz.cc
diff --git a/ui/gfx/render_text_harfbuzz.cc b/ui/gfx/render_text_harfbuzz.cc
index 3ee533290ca729bb9871427740e29c597c6d1489..f27e12add7d0ec00c34e9367bbeaf6f0de7b4950 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1104,18 +1104,33 @@ void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) {
#if defined(OS_WIN)
Font uniscribe_font;
+ bool got_uniscribe_font = false;
const base::char16* run_text = &(GetLayoutText()[run->range.start()]);
if (GetUniscribeFallbackFont(primary_font, run_text, run->range.length(),
- &uniscribe_font) &&
- CompareFamily(run, uniscribe_font.GetFontName(),
- uniscribe_font.GetFontRenderParams(),
- &best_family, &best_render_params, &best_missing_glyphs))
- return;
+ &uniscribe_font)) {
+ got_uniscribe_font = true;
+ if (CompareFamily(run, uniscribe_font.GetFontName(),
+ uniscribe_font.GetFontRenderParams(),
+ &best_family, &best_render_params, &best_missing_glyphs))
+ return;
+ }
#endif
- // Skip the first fallback font, which is |primary_font|.
std::vector<std::string> fallback_families =
GetFallbackFontFamilies(primary_font.GetFontName());
+
+#if defined(OS_WIN)
+ // Append fonts in the fallback list of the Uniscribe font.
+ if (got_uniscribe_font) {
+ std::vector<std::string> uniscribe_fallbacks =
+ GetFallbackFontFamilies(uniscribe_font.GetFontName());
+ // Skip the first fallback font, which is |uniscribe_font|.
+ fallback_families.insert(fallback_families.end(),
+ uniscribe_fallbacks.begin() + 1, uniscribe_fallbacks.end());
Daniel Erat 2014/10/28 18:00:36 can the returned vector ever be empty? if so, you
msw 2014/10/28 18:17:56 It looks like all impls should return at least one
ckocagil 2014/10/29 01:07:20 We now add all fonts and skip if it's primary_font
+ }
+#endif
+
+ // Skip the first fallback font, which is |primary_font|.
msw 2014/10/28 18:17:56 I'm trying to determine if this is true for font_f
Daniel Erat 2014/10/28 18:20:53 yeah, you're right -- this seems wrong. i don't th
ckocagil 2014/10/29 01:07:20 Done.
for (size_t i = 1; i < fallback_families.size(); ++i) {
FontRenderParamsQuery query(false);
query.families.push_back(fallback_families[i]);

Powered by Google App Engine
This is Rietveld 408576698