summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorckocagil <ckocagil@chromium.org>2014-10-20 15:13:19 -0700
committerCommit bot <commit-bot@chromium.org>2014-10-20 22:13:45 +0000
commitf9fd2e2129b8dc0542c76744666a2a1cd06775f2 (patch)
tree78333fbbf67845dfc88505d2fb7120242c0ee995
parent8e84bfcc1c33fc0b63392d48ee8288d73f4a7675 (diff)
downloadchromium_src-f9fd2e2129b8dc0542c76744666a2a1cd06775f2.zip
chromium_src-f9fd2e2129b8dc0542c76744666a2a1cd06775f2.tar.gz
chromium_src-f9fd2e2129b8dc0542c76744666a2a1cd06775f2.tar.bz2
RenderText: Try fallback fonts of the Uniscribe font while shaping
BUG=422142 R=asvitkine Review URL: https://codereview.chromium.org/637953010 Cr-Commit-Position: refs/heads/master@{#300351}
-rw-r--r--ui/gfx/render_text_win.cc23
1 files changed, 21 insertions, 2 deletions
diff --git a/ui/gfx/render_text_win.cc b/ui/gfx/render_text_win.cc
index e76e6db..4a9848e 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());
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));
if (missing_count == 0) {
successful_substitute_fonts_[original_font.GetFontName()] = current_font;
return;