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

Unified Diff: ui/gfx/render_text_win.cc

Issue 10143009: Use font linking based on the original run font in RenderTextWin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 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
===================================================================
--- ui/gfx/render_text_win.cc (revision 133499)
+++ ui/gfx/render_text_win.cc (working copy)
@@ -597,6 +597,7 @@
bool tried_fallback = false;
size_t linked_font_index = 0;
const std::vector<Font>* linked_fonts = NULL;
+ Font original_font = run->font;
// Select the font desired for glyph generation.
SelectObject(cached_hdc_, run->font.GetNativeFont());
@@ -661,9 +662,17 @@
// The meta file approach did not yield a replacement font, try to find
// one using font linking. First time through, get the linked fonts list.
- if (linked_fonts == NULL)
- linked_fonts = GetLinkedFonts(run->font);
+ if (linked_fonts == NULL) {
+ // First, try to get the list for the original font.
+ linked_fonts = GetLinkedFonts(original_font);
+ // If there are no linked fonts for the original font, try querying the
+ // ones for the Uniscribe fallback font. This may happen if the first
+ // font is a custom font that has no linked fonts in the Registry.
msw 2012/04/23 20:20:59 nit: Should registry be capitalized? Are you refer
Alexei Svitkine (slow) 2012/04/23 21:13:14 Yes, the Windows Registry. It's capitalized in the
+ if (linked_fonts->empty())
+ linked_fonts = GetLinkedFonts(run->font);
msw 2012/04/23 20:20:59 Have you considered appending the linked fonts for
Alexei Svitkine (slow) 2012/04/23 21:13:14 I've thought about it, but decided to keep it up m
msw 2012/04/24 00:05:11 Cool, how about a TODO or less directed/actionable
+ }
+
// None of the linked fonts worked, break out of the loop.
if (linked_font_index == linked_fonts->size()) {
// TODO(msw): Don't use SCRIPT_UNDEFINED. Apparently Uniscribe can
« 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