Use font linking based on the original run font in RenderTextWin.

BUG=105550
TEST=On a Windows 7 system, go to a Japanese website and check that
the Japanese characters in the tab title are rendered using Meiryo
font and not MS UI Gothic. (Which matches the GDI path.)

Review URL: http://codereview.chromium.org/10143009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133692 0039d316-1c4b-4281-b951-d872f2087c98
parent 2aa48133
...@@ -597,6 +597,7 @@ void RenderTextWin::LayoutVisualText() { ...@@ -597,6 +597,7 @@ void RenderTextWin::LayoutVisualText() {
bool tried_fallback = false; bool tried_fallback = false;
size_t linked_font_index = 0; size_t linked_font_index = 0;
const std::vector<Font>* linked_fonts = NULL; const std::vector<Font>* linked_fonts = NULL;
Font original_font = run->font;
// Select the font desired for glyph generation. // Select the font desired for glyph generation.
SelectObject(cached_hdc_, run->font.GetNativeFont()); SelectObject(cached_hdc_, run->font.GetNativeFont());
...@@ -661,8 +662,20 @@ void RenderTextWin::LayoutVisualText() { ...@@ -661,8 +662,20 @@ void RenderTextWin::LayoutVisualText() {
// The meta file approach did not yield a replacement font, try to find // 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. // one using font linking. First time through, get the linked fonts list.
if (linked_fonts == NULL) if (linked_fonts == NULL) {
linked_fonts = GetLinkedFonts(run->font); // 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.
//
// Note: One possibility would be to always merge both lists of fonts,
// but it is not clear whether there are any real world scenarios
// where this would actually help.
if (linked_fonts->empty())
linked_fonts = GetLinkedFonts(run->font);
}
// None of the linked fonts worked, break out of the loop. // None of the linked fonts worked, break out of the loop.
if (linked_font_index == linked_fonts->size()) { if (linked_font_index == linked_fonts->size()) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment