diff options
author | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 03:56:16 +0000 |
---|---|---|
committer | tony@chromium.org <tony@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-23 03:56:16 +0000 |
commit | f2a13d89ca22cdbe3808bcb14e02d5baee8d33b3 (patch) | |
tree | d0a3a2e14e9dd79db4530037a3d54f894df9e29c /app/gfx/font_skia.cc | |
parent | 685ee3378b45f9da9f506cb370a7c5c13b2aaa0e (diff) | |
download | chromium_src-f2a13d89ca22cdbe3808bcb14e02d5baee8d33b3.zip chromium_src-f2a13d89ca22cdbe3808bcb14e02d5baee8d33b3.tar.gz chromium_src-f2a13d89ca22cdbe3808bcb14e02d5baee8d33b3.tar.bz2 |
Clamp the max size of fonts used by skia/chrome canvas.
This forces us to ignore dpi sizes > 96., like we do in other
places. It does allow smaller DPIs to work since that mostly
just makes fonts smaller.
BUG=26354
Review URL: http://codereview.chromium.org/1095004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42311 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app/gfx/font_skia.cc')
-rw-r--r-- | app/gfx/font_skia.cc | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/app/gfx/font_skia.cc b/app/gfx/font_skia.cc index eee1238..3499caa 100644 --- a/app/gfx/font_skia.cc +++ b/app/gfx/font_skia.cc @@ -22,28 +22,6 @@ namespace { // IsFallbackFontAllowed function in skia/ext/SkFontHost_fontconfig_direct.cpp. const char* kFallbackFontFamilyName = "sans"; -// Pango scales font sizes. This returns the scale factor. See -// pango_cairo_context_set_resolution for details. -// NOTE: this isn't entirely accurate, in that Pango also consults the -// FC_PIXEL_SIZE first (see get_font_size in pangocairo-fcfont), but this -// seems to give us the same sizes as used by Pango for all our fonts in both -// English and Thia. -static double GetPangoScaleFactor() { - static float scale_factor = 0; - static bool determined_scale = false; - if (!determined_scale) { - PangoContext* context = gdk_pango_context_get(); - scale_factor = pango_cairo_context_get_resolution(context); - g_object_unref(context); - if (scale_factor <= 0) - scale_factor = 1; - else - scale_factor /= 72.0; - determined_scale = true; - } - return scale_factor; -} - // Retrieves the pango metrics for a pango font description. Caches the metrics // and never frees them. The metrics objects are relatively small and // very expensive to look up. @@ -190,7 +168,7 @@ Font Font::DeriveFont(int size_delta, int style) const { void Font::PaintSetup(SkPaint* paint) const { paint->setAntiAlias(false); paint->setSubpixelText(false); - paint->setTextSize(SkFloatToScalar(font_size_ * GetPangoScaleFactor())); + paint->setTextSize(SkFloatToScalar(font_size_ * Font::GetPangoScaleFactor())); paint->setTypeface(typeface_); paint->setFakeBoldText((BOLD & style_) && !typeface_->isBold()); paint->setTextSkewX((ITALIC & style_) && !typeface_->isItalic() ? |