diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 16:43:03 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-13 16:43:03 +0000 |
commit | c6ac841f51c0b884b38e917ac30b1dfde0dc43a7 (patch) | |
tree | 2b490ffa6795f72e7232d658b766785f0de64e38 /app | |
parent | 6b32b95cff99ee72fd7824237ae5070263e5c496 (diff) | |
download | chromium_src-c6ac841f51c0b884b38e917ac30b1dfde0dc43a7.zip chromium_src-c6ac841f51c0b884b38e917ac30b1dfde0dc43a7.tar.gz chromium_src-c6ac841f51c0b884b38e917ac30b1dfde0dc43a7.tar.bz2 |
Rework gfx::Font by moving platform-specific code into inner classes.
gfx::Font is a platform-neutral API shim that exists as a wrapper object to allow for the creation and lifetime of gfx::Font objects to remain consistent with past usage.
gfx::PlatformFont is an interface implemented by the platform-specific inner classes (gfx::PlatformFontWin,Mac,Gtk).
BUG=none
TEST=existing unittests
Review URL: http://codereview.chromium.org/3083022
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56040 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r-- | app/gfx/font_util.cc | 2 | ||||
-rw-r--r-- | app/resource_bundle.cc | 4 | ||||
-rw-r--r-- | app/resource_bundle_dummy.cc | 10 | ||||
-rw-r--r-- | app/text_elider_unittest.cc | 1 | ||||
-rw-r--r-- | app/win_util.cc | 2 |
5 files changed, 12 insertions, 7 deletions
diff --git a/app/gfx/font_util.cc b/app/gfx/font_util.cc index 61e1b52dd..1c3cfca 100644 --- a/app/gfx/font_util.cc +++ b/app/gfx/font_util.cc @@ -27,7 +27,7 @@ int GetLocalizedContentsHeightForFont(int row_resource_id, double lines = 0; base::StringToDouble(WideToUTF8(l10n_util::GetString(row_resource_id)), &lines); - int height = static_cast<int>(font.height() * lines); + int height = static_cast<int>(font.GetHeight() * lines); DCHECK_GT(height, 0); return height; } diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index 25b0d81..4b97c90 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -172,7 +172,7 @@ void ResourceBundle::LoadFontsIfNecessary() { bold_font_.reset(new gfx::Font()); *bold_font_ = - base_font_->DeriveFont(0, base_font_->style() | gfx::Font::BOLD); + base_font_->DeriveFont(0, base_font_->GetStyle() | gfx::Font::BOLD); small_font_.reset(new gfx::Font()); *small_font_ = base_font_->DeriveFont(-2); @@ -182,7 +182,7 @@ void ResourceBundle::LoadFontsIfNecessary() { medium_bold_font_.reset(new gfx::Font()); *medium_bold_font_ = - base_font_->DeriveFont(3, base_font_->style() | gfx::Font::BOLD); + base_font_->DeriveFont(3, base_font_->GetStyle() | gfx::Font::BOLD); large_font_.reset(new gfx::Font()); *large_font_ = base_font_->DeriveFont(8); diff --git a/app/resource_bundle_dummy.cc b/app/resource_bundle_dummy.cc index 9a22afd..e93df01 100644 --- a/app/resource_bundle_dummy.cc +++ b/app/resource_bundle_dummy.cc @@ -9,6 +9,7 @@ #include "base/lock.h" #include "base/logging.h" #include "gfx/font.h" +#include "gfx/platform_font_win.h" ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; @@ -16,9 +17,12 @@ ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; // files. The font members of ResourceBundle are never initialized in our code // so this destructor is never called. namespace gfx { - Font::HFontRef::~HFontRef() { - NOTREACHED(); - } +Font::~Font() { + NOTREACHED(); +} +PlatformFontWin::HFontRef::~HFontRef() { + NOTREACHED(); +} } diff --git a/app/text_elider_unittest.cc b/app/text_elider_unittest.cc index 253eb13..627c556 100644 --- a/app/text_elider_unittest.cc +++ b/app/text_elider_unittest.cc @@ -5,6 +5,7 @@ #include "app/text_elider.h" #include "base/file_path.h" #include "base/i18n/rtl.h" +#include "base/scoped_ptr.h" #include "base/string_util.h" #include "gfx/font.h" #include "googleurl/src/gurl.h" diff --git a/app/win_util.cc b/app/win_util.cc index e760a24..302f2b8 100644 --- a/app/win_util.cc +++ b/app/win_util.cc @@ -541,7 +541,7 @@ gfx::Font GetWindowTitleFont() { win_util::GetNonClientMetrics(&ncm); l10n_util::AdjustUIFont(&(ncm.lfCaptionFont)); ScopedHFONT caption_font(CreateFontIndirect(&(ncm.lfCaptionFont))); - return gfx::Font::CreateFont(caption_font); + return gfx::Font(caption_font); } void SetAppIdForWindow(const std::wstring& app_id, HWND hwnd) { |