summaryrefslogtreecommitdiffstats
path: root/chrome/common/gfx
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 01:52:29 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-12-12 01:52:29 +0000
commit335db8d0ed06b83f44831b9684f8ab9132cfc3e9 (patch)
treeb42c4d9ed2fba7f5b3cadc5082295cce73021ea8 /chrome/common/gfx
parent7f4bfe196f0976c7151de206601860b47f913fcb (diff)
downloadchromium_src-335db8d0ed06b83f44831b9684f8ab9132cfc3e9.zip
chromium_src-335db8d0ed06b83f44831b9684f8ab9132cfc3e9.tar.gz
chromium_src-335db8d0ed06b83f44831b9684f8ab9132cfc3e9.tar.bz2
...
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6872 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/gfx')
-rw-r--r--chrome/common/gfx/chrome_font.cc2
-rw-r--r--chrome/common/gfx/chrome_font.h20
-rw-r--r--chrome/common/gfx/chrome_font_skia.cc10
3 files changed, 21 insertions, 11 deletions
diff --git a/chrome/common/gfx/chrome_font.cc b/chrome/common/gfx/chrome_font.cc
index 6600abe..062b578 100644
--- a/chrome/common/gfx/chrome_font.cc
+++ b/chrome/common/gfx/chrome_font.cc
@@ -51,7 +51,7 @@ int ChromeFont::style() const {
return font_ref_->style();
}
-gfx::NativeFont ChromeFont::nativeFont() const {
+NativeFont ChromeFont::nativeFont() const {
return hfont();
}
diff --git a/chrome/common/gfx/chrome_font.h b/chrome/common/gfx/chrome_font.h
index a26ceaf..cac7499 100644
--- a/chrome/common/gfx/chrome_font.h
+++ b/chrome/common/gfx/chrome_font.h
@@ -6,7 +6,6 @@
#define CHROME_COMMON_GFX_CHROME_FONT_H_
#include "build/build_config.h"
-#include "base/gfx/native_widget_types.h"
#include <string>
@@ -18,6 +17,17 @@ class SkPaint;
class SkTypeface;
#endif
+#if defined(OS_WIN)
+typedef struct HFONT__* NativeFont;
+#elif defined(OS_MACOSX)
+typedef void* NativeFont; // TODO(port): set the correct type here
+#elif defined(OS_LINUX)
+class SkTypeface;
+typedef SkTypeface* NativeFont;
+#else // null port.
+#error No known OS defined
+#endif
+
#include "base/basictypes.h"
#include "base/ref_counted.h"
@@ -31,7 +41,7 @@ class ChromeFont {
BOLD = 1,
ITALIC = 2,
UNDERLINED = 4,
- WEB = 8, // TODO: what does this mean?
+ WEB = 8, // TODO(agl): what does this mean?
};
// Creates a ChromeFont given font name (e.g. arial), font size (e.g. 12).
@@ -81,7 +91,7 @@ class ChromeFont {
// Font Size.
int FontSize();
- gfx::NativeFont nativeFont() const;
+ NativeFont nativeFont() const;
#if defined(OS_WIN)
// Creates a font with the default name and style.
@@ -104,7 +114,7 @@ class ChromeFont {
return dlus * font_ref_->height() / 8;
}
#elif defined(OS_LINUX)
- // We need a copy constructor to deal with the Skia reference counting
+ // We need a copy constructor to deal with the Skia reference counting.
ChromeFont(const ChromeFont& other);
#endif
@@ -172,7 +182,7 @@ class ChromeFont {
explicit ChromeFont(SkTypeface* typeface, const std::wstring& name,
int size, int style);
// Setup a Skia context to use the current typeface
- void setupPaint(SkPaint* paint) const;
+ void PaintSetup(SkPaint* paint) const;
// Calculate and cache the font metrics
void calculateMetrics();
diff --git a/chrome/common/gfx/chrome_font_skia.cc b/chrome/common/gfx/chrome_font_skia.cc
index 17e5fdf..77a9661 100644
--- a/chrome/common/gfx/chrome_font_skia.cc
+++ b/chrome/common/gfx/chrome_font_skia.cc
@@ -35,7 +35,7 @@ void ChromeFont::calculateMetrics() {
SkPaint paint;
SkPaint::FontMetrics metrics;
- setupPaint(&paint);
+ PaintSetup(&paint);
paint.getFontMetrics(&metrics);
if (metrics.fVDMXMetricsValid) {
@@ -47,7 +47,7 @@ void ChromeFont::calculateMetrics() {
}
if (metrics.fAvgCharWidth) {
- avg_width_ = SkScalarRound(metrics.fAvgCharWidth);
+ avg_width_ = SkScalarRound(metrics.fAvgCharWidth);
} else {
static const char x_char = 'x';
paint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
@@ -104,7 +104,7 @@ ChromeFont ChromeFont::DeriveFont(int size_delta, int style) const {
return ChromeFont(tf, font_name_, font_size_ + size_delta, skstyle);
}
-void ChromeFont::setupPaint(SkPaint* paint) const {
+void ChromeFont::PaintSetup(SkPaint* paint) const {
paint->setAntiAlias(false);
paint->setSubpixelText(false);
paint->setTextSize(SkFloatToScalar(font_size_));
@@ -118,7 +118,7 @@ int ChromeFont::GetStringWidth(const std::wstring& text) const {
const std::string utf8(base::SysWideToUTF8(text));
SkPaint paint;
- setupPaint(&paint);
+ PaintSetup(&paint);
paint.setTextEncoding(SkPaint::kUTF8_TextEncoding);
SkScalar width = paint.measureText(utf8.data(), utf8.size());
@@ -142,6 +142,6 @@ int ChromeFont::FontSize() {
return font_size_;
}
-gfx::NativeFont ChromeFont::nativeFont() const {
+NativeFont ChromeFont::nativeFont() const {
return typeface_;
}