summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/app_base.gypi4
-rw-r--r--app/gfx/canvas.cc1
-rw-r--r--app/gfx/canvas_mac.mm1
-rw-r--r--app/gfx/font.h13
-rw-r--r--app/gfx/font_win.cc17
-rw-r--r--chrome/browser/browser_main.cc20
6 files changed, 44 insertions, 12 deletions
diff --git a/app/app_base.gypi b/app/app_base.gypi
index 0f6f363..578701f 100644
--- a/app/app_base.gypi
+++ b/app/app_base.gypi
@@ -93,10 +93,10 @@
},
'sources': [
# Files that are not required for Win64 Native Client loader
- 'animation.cc',
- 'animation.h',
'active_window_watcher_x.cc',
'active_window_watcher_x.h',
+ 'animation.cc',
+ 'animation.h',
'bidi_line_iterator.cc',
'clipboard/clipboard.cc',
'clipboard/clipboard.h',
diff --git a/app/gfx/canvas.cc b/app/gfx/canvas.cc
index 75ec0a1..11cf3d5 100644
--- a/app/gfx/canvas.cc
+++ b/app/gfx/canvas.cc
@@ -7,7 +7,6 @@
#include <limits>
#include "app/gfx/font.h"
-#include "app/l10n_util.h"
#include "base/i18n/rtl.h"
#include "base/logging.h"
#include "gfx/rect.h"
diff --git a/app/gfx/canvas_mac.mm b/app/gfx/canvas_mac.mm
index acc2d71..37d97db 100644
--- a/app/gfx/canvas_mac.mm
+++ b/app/gfx/canvas_mac.mm
@@ -7,7 +7,6 @@
#include "app/gfx/canvas.h"
#include "app/gfx/font.h"
-#include "app/l10n_util.h"
#include "base/scoped_cftyperef.h"
#include "base/sys_string_conversions.h"
#include "gfx/rect.h"
diff --git a/app/gfx/font.h b/app/gfx/font.h
index f79f6d0..8086117 100644
--- a/app/gfx/font.h
+++ b/app/gfx/font.h
@@ -125,6 +125,19 @@ class Font {
int vertical_dlus_to_pixels(int dlus) {
return dlus * font_ref_->height() / 8;
}
+
+ // Callback that returns the minimum height that should be used for
+ // gfx::Fonts. Optional. If not specified, the minimum font size is 0.
+ typedef int (*GetMinimumFontSizeCallback)();
+ static GetMinimumFontSizeCallback get_minimum_font_size_callback;
+
+ // Callback that adjusts a LOGFONT to meet suitability requirements of the
+ // embedding application. Optional. If not specified, no adjustments are
+ // performed other than clamping to a minimum font height if
+ // |get_minimum_font_size_callback| is specified.
+ typedef void (*AdjustFontCallback)(LOGFONT* lf);
+ static AdjustFontCallback adjust_font_callback;
+
#elif !defined(OS_MACOSX)
static Font CreateFont(PangoFontDescription* desc);
// We need a copy constructor and assignment operator to deal with
diff --git a/app/gfx/font_win.cc b/app/gfx/font_win.cc
index 1f69afa..cffd417 100644
--- a/app/gfx/font_win.cc
+++ b/app/gfx/font_win.cc
@@ -9,18 +9,19 @@
#include <algorithm>
-#include "app/l10n_util.h"
-#include "app/l10n_util_win.h"
#include "base/logging.h"
#include "base/string_util.h"
#include "base/win_util.h"
-#include "grit/app_locale_settings.h"
namespace gfx {
-/*static*/
+// static
Font::HFontRef* Font::base_font_ref_;
+// static
+Font::AdjustFontCallback Font::adjust_font_callback = NULL;
+Font::GetMinimumFontSizeCallback Font::get_minimum_font_size_callback = NULL;
+
// If the tmWeight field of a TEXTMETRIC structure has a value >= this, the
// font is bold.
static const int kTextMetricWeightBold = 700;
@@ -33,8 +34,9 @@ static int AdjustFontSize(int lf_height, int size_delta) {
} else {
lf_height += size_delta;
}
- int min_font_size =
- StringToInt(l10n_util::GetString(IDS_MINIMUM_UI_FONT_SIZE).c_str());
+ int min_font_size = 0;
+ if (Font::get_minimum_font_size_callback)
+ min_font_size = Font::get_minimum_font_size_callback();
// Make sure lf_height is not smaller than allowed min font size for current
// locale.
if (abs(lf_height) < min_font_size) {
@@ -99,7 +101,8 @@ Font::HFontRef* Font::GetBaseFontRef() {
NONCLIENTMETRICS metrics;
win_util::GetNonClientMetrics(&metrics);
- l10n_util::AdjustUIFont(&metrics.lfMessageFont);
+ if (adjust_font_callback)
+ adjust_font_callback(&metrics.lfMessageFont);
metrics.lfMessageFont.lfHeight =
AdjustFontSize(metrics.lfMessageFont.lfHeight, 0);
HFONT font = CreateFontIndirect(&metrics.lfMessageFont);
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index abf9cb5..c160379 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -60,6 +60,7 @@
#include "chrome/common/result_codes.h"
#include "chrome/installer/util/google_update_settings.h"
#include "chrome/installer/util/master_preferences.h"
+#include "grit/app_locale_settings.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "net/base/cookie_monster.h"
@@ -97,6 +98,7 @@
#include <commctrl.h>
#include <shellapi.h>
+#include "app/l10n_util_win.h"
#include "app/win_util.h"
#include "base/nss_util.h"
#include "base/registry.h"
@@ -331,6 +333,19 @@ class GetLinuxDistroTask : public Task {
DISALLOW_COPY_AND_ASSIGN(GetLinuxDistroTask);
};
#endif // USE_LINUX_BREAKPAD
+
+#if defined(OS_WIN)
+
+// gfx::Font callbacks
+void AdjustUIFont(LOGFONT* logfont) {
+ l10n_util::AdjustUIFont(logfont);
+}
+
+int GetMinimumFontSize() {
+ return StringToInt(l10n_util::GetString(IDS_MINIMUM_UI_FONT_SIZE).c_str());
+}
+
+#endif
} // namespace
// Main routine for running as the Browser process.
@@ -548,7 +563,10 @@ int BrowserMain(const MainFunctionParams& parameters) {
if (!views::ViewsDelegate::views_delegate)
views::ViewsDelegate::views_delegate = new ChromeViewsDelegate;
#endif
-
+#if defined(OS_WIN)
+ gfx::Font::adjust_font_callback = &AdjustUIFont;
+ gfx::Font::get_minimum_font_size_callback = &GetMinimumFontSize;
+#endif
if (is_first_run) {
#if defined(OS_WIN)