diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 21:01:24 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-24 21:01:24 +0000 |
commit | f3dc6fbc4d1ae9591fb59bdcba591fec5a2e7187 (patch) | |
tree | 0fd4a953e5329d5f2d057c6de4563a1bde403ee5 /ui/gfx/render_text_linux.cc | |
parent | 9862082a9b4cf2affde748b230b2c2e0b3248d38 (diff) | |
download | chromium_src-f3dc6fbc4d1ae9591fb59bdcba591fec5a2e7187.zip chromium_src-f3dc6fbc4d1ae9591fb59bdcba591fec5a2e7187.tar.gz chromium_src-f3dc6fbc4d1ae9591fb59bdcba591fec5a2e7187.tar.bz2 |
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
Diffstat (limited to 'ui/gfx/render_text_linux.cc')
-rw-r--r-- | ui/gfx/render_text_linux.cc | 10 |
1 files changed, 4 insertions, 6 deletions
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<SkTypeface> 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; |