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

Unified Diff: ui/gfx/render_text_win.cc

Issue 637953010: RenderText: 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 | 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 e76e6db39e8a55af31a8b1a0a1e0ad349bd86953..4a9848eaeb6eab6e2f3df0b63133ae4567f154ca 100644
--- a/ui/gfx/render_text_win.cc
+++ b/ui/gfx/render_text_win.cc
@@ -1032,8 +1032,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;
if (GetUniscribeFallbackFont(original_font, run_text, run_length,
- &current_font)) {
+ &uniscribe_font)) {
+ current_font = uniscribe_font;
missing_count = CountCharsWithMissingGlyphs(run,
ShapeTextRunWithFont(run, current_font));
if (missing_count == 0) {
@@ -1050,8 +1052,25 @@ void RenderTextWin::LayoutTextRun(internal::TextRun* run) {
std::vector<std::string> fonts =
GetFallbackFontFamilies(original_font.GetFontName());
for (size_t i = 1; i < fonts.size(); ++i) {
+ current_font = Font(fonts[i], original_font.GetFontSize());
msw 2014/10/20 20:12:03 The entire defect may just be that |current_font|
Alexei Svitkine (slow) 2014/10/20 20:21:20 From my recollection of the original motivation fo
Alexei Svitkine (slow) 2014/10/20 20:25:06 Although yeah, it looks like the code without the
missing_count = CountCharsWithMissingGlyphs(run,
- ShapeTextRunWithFont(run, Font(fonts[i], original_font.GetFontSize())));
+ 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;
+ }
+ }
+
+ // 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));
Alexei Svitkine (slow) 2014/10/20 20:14:04 Nit: Indent 2 more.
if (missing_count == 0) {
successful_substitute_fonts_[original_font.GetFontName()] = current_font;
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698