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

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: 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_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..33b0349733f3cfc2b312f3d306ed9e750eec01fd 100644
--- a/ui/gfx/render_text_harfbuzz.cc
+++ b/ui/gfx/render_text_harfbuzz.cc
@@ -1104,13 +1104,16 @@ 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|.
@@ -1127,6 +1130,24 @@ void RenderTextHarfBuzz::ShapeRun(internal::TextRunHarfBuzz* run) {
return;
}
+ // Try fonts in the fallback list of the Uniscribe font.
msw 2014/10/27 17:28:51 Shouldn't this be in an #if defined(OS_WIN) block?
ckocagil 2014/10/28 03:24:42 Done.
+ if (got_uniscribe_font) {
+ fallback_families =
+ GetFallbackFontFamilies(uniscribe_font.GetFontName());
+ for (size_t i = 1; i < fallback_families.size(); ++i) {
Daniel Erat 2014/10/27 18:49:24 there's a bunch of duplicated code here. is the Ge
ckocagil 2014/10/28 03:24:42 Done.
+ FontRenderParamsQuery query(false);
+ query.families.push_back(fallback_families[i]);
+ query.pixel_size = run->font_size;
+ query.style = run->font_style;
+ FontRenderParams fallback_render_params =
+ GetFontRenderParams(query, NULL);
+ if (CompareFamily(run, fallback_families[i], fallback_render_params,
+ &best_family, &best_render_params,
+ &best_missing_glyphs))
+ return;
+ }
+ }
+
if (!best_family.empty() &&
(best_family == run->family ||
ShapeRunWithFont(run, best_family, best_render_params)))
« no previous file with comments | « no previous file | ui/gfx/render_text_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698