From f3dc6fbc4d1ae9591fb59bdcba591fec5a2e7187 Mon Sep 17 00:00:00 2001 From: "xiyuan@chromium.org" Date: Sat, 24 Mar 2012 21:01:24 +0000 Subject: Add a SkiaTextRenderer::SetFontFamilyWithStyle RenderTextLinux::DrawVisualText use it to stick with one font familty and avoid bad glyph index problem; BUG=119680 TEST=Verify fix for 119680 and other text should look the same as before. Review URL: https://chromiumcodereview.appspot.com/9808098 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128774 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/gfx/render_text_linux.cc | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ui/gfx/render_text_linux.cc') diff --git a/ui/gfx/render_text_linux.cc b/ui/gfx/render_text_linux.cc index 16bf386..f5c3a9b 100644 --- a/ui/gfx/render_text_linux.cc +++ b/ui/gfx/render_text_linux.cc @@ -410,10 +410,8 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) { PangoFontDescription* native_font = pango_font_describe(run->item->analysis.font); - const char* family_name = pango_font_description_get_family(native_font); - SkAutoTUnref typeface( - SkTypeface::CreateFromName(family_name, SkTypeface::kNormal)); - renderer.SetTypeface(typeface.get()); + const std::string family_name = + pango_font_description_get_family(native_font); renderer.SetTextSize(GetPangoFontSizeInPixels(native_font)); pango_font_description_free(native_font); @@ -443,7 +441,7 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) { // styles evenly over the glyph. We can do this too by // clipping and drawing the glyph several times. renderer.SetForegroundColor(styles[style].foreground); - renderer.SetFontStyle(styles[style].font_style); + renderer.SetFontFamilyWithStyle(family_name, styles[style].font_style); renderer.DrawPosText(&pos[start], &glyphs[start], i - start); renderer.DrawDecorations(start_x, y, glyph_x - start_x, styles[style]); @@ -459,7 +457,7 @@ void RenderTextLinux::DrawVisualText(Canvas* canvas) { // Draw the remaining glyphs. renderer.SetForegroundColor(styles[style].foreground); - renderer.SetFontStyle(styles[style].font_style); + renderer.SetFontFamilyWithStyle(family_name, styles[style].font_style); renderer.DrawPosText(&pos[start], &glyphs[start], glyph_count - start); renderer.DrawDecorations(start_x, y, glyph_x - start_x, styles[style]); x = glyph_x; -- cgit v1.1