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

Unified Diff: ui/gfx/render_text_win.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: comments addressed 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
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/render_text_win.cc
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index f68224bd101c46aeb4077c9c398b3ced5d3bcf30..0ca29577399f118ebdb4f0109b480a844d49bf6f 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -1033,8 +1033,10 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
// Try finding a fallback font using a meta file.
// TODO(msw|asvitkine): Support RenderText's font_list()?
Font uniscribe_font;
+ bool got_uniscribe_font = false;
if (GetUniscribeFallbackFont(original_font, run_text, run_length,
&uniscribe_font)) {
+ got_uniscribe_font = true;
current_font = uniscribe_font;
missing_count = CountCharsWithMissingGlyphs(run,
ShapeTextRunWithFont(run, current_font));
@@ -1066,18 +1068,21 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
}
// Try fonts in the fallback list of the Uniscribe font.
- fonts = GetFallbackFontFamilies(uniscribe_font.GetFontName());
- for (size_t i = 1; i < fonts.size(); ++i) {
- current_font = Font(fonts[i], original_font.GetFontSize());
- missing_count = CountCharsWithMissingGlyphs(run,
- ShapeTextRunWithFont(run, current_font));
- if (missing_count == 0) {
- successful_substitute_fonts_[original_font.GetFontName()] = current_font;
- return;
- }
- if (missing_count < best_partial_font_missing_char_count) {
- best_partial_font_missing_char_count = missing_count;
- best_partial_font = current_font;
+ if (got_uniscribe_font) {
+ fonts = GetFallbackFontFamilies(uniscribe_font.GetFontName());
+ for (size_t i = 1; i < fonts.size(); ++i) {
Daniel Erat 2014/10/29 01:18:10 should this also iterate over all families instead
ckocagil 2014/10/29 02:05:16 It doesn't have to, LinkedFontsIterator guarantees
+ current_font = Font(fonts[i], original_font.GetFontSize());
+ missing_count = CountCharsWithMissingGlyphs(run,
+ ShapeTextRunWithFont(run, current_font));
+ if (missing_count == 0) {
+ successful_substitute_fonts_[original_font.GetFontName()] =
+ current_font;
+ return;
+ }
+ if (missing_count < best_partial_font_missing_char_count) {
+ best_partial_font_missing_char_count = missing_count;
+ best_partial_font = current_font;
+ }
}
}
« ui/gfx/render_text_harfbuzz.cc ('K') | « ui/gfx/render_text_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698