summaryrefslogtreecommitdiffstats
path: root/views/view_text_utils.cc
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 16:43:03 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-13 16:43:03 +0000
commitc6ac841f51c0b884b38e917ac30b1dfde0dc43a7 (patch)
tree2b490ffa6795f72e7232d658b766785f0de64e38 /views/view_text_utils.cc
parent6b32b95cff99ee72fd7824237ae5070263e5c496 (diff)
downloadchromium_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 'views/view_text_utils.cc')
-rw-r--r--views/view_text_utils.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/views/view_text_utils.cc b/views/view_text_utils.cc
index c42472a..9b4442d 100644
--- a/views/view_text_utils.cc
+++ b/views/view_text_utils.cc
@@ -62,7 +62,7 @@ void DrawTextAndPositionUrl(gfx::Canvas* canvas,
if (link && rect) {
gfx::Size sz = link->GetPreferredSize();
gfx::Insets insets = link->GetInsets();
- WrapIfWordDoesntFit(sz.width(), font.height(), position, bounds);
+ WrapIfWordDoesntFit(sz.width(), font.GetHeight(), position, bounds);
int x = position->width();
int y = position->height();
@@ -116,11 +116,11 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
else
word = text; // Draw the whole text at once.
- int w = font.GetStringWidth(word), h = font.height();
+ int w = font.GetStringWidth(word), h = font.GetHeight();
gfx::CanvasSkia::SizeStringInt(word, font, &w, &h, flags);
// If we exceed the boundaries, we need to wrap.
- WrapIfWordDoesntFit(w, font.height(), position, bounds);
+ WrapIfWordDoesntFit(w, font.GetHeight(), position, bounds);
int x = label->MirroredXCoordinateInsideView(position->width()) +
bounds.x();
@@ -130,7 +130,7 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
// draw the trailing space (if one exists after the LTR text) to the
// left of the LTR string.
if (ltr_within_rtl && word[word.size() - 1] == L' ') {
- int space_w = font.GetStringWidth(L" "), space_h = font.height();
+ int space_w = font.GetStringWidth(L" "), space_h = font.GetHeight();
gfx::CanvasSkia::SizeStringInt(L" ", font, &space_w, &space_h, flags);
x += space_w;
}
@@ -138,13 +138,13 @@ void DrawTextStartingFrom(gfx::Canvas* canvas,
int y = position->height() + bounds.y();
// Draw the text on the screen (mirrored, if RTL run).
- canvas->DrawStringInt(word, font, text_color, x, y, w, font.height(),
+ canvas->DrawStringInt(word, font, text_color, x, y, w, font.GetHeight(),
flags);
if (word.size() > 0 && word[word.size() - 1] == L'\x0a') {
// When we come across '\n', we move to the beginning of the next line.
position->set_width(0);
- position->Enlarge(0, font.height());
+ position->Enlarge(0, font.GetHeight());
} else {
// Otherwise, we advance position to the next word.
position->Enlarge(w, 0);