Index: trunk/src/ui/gfx/font_list.cc |
=================================================================== |
--- trunk/src/ui/gfx/font_list.cc (revision 211668) |
+++ trunk/src/ui/gfx/font_list.cc (working copy) |
@@ -69,21 +69,19 @@ |
namespace gfx { |
-FontList::FontList() : common_height_(-1), common_baseline_(-1) { |
+FontList::FontList() { |
fonts_.push_back(Font()); |
} |
FontList::FontList(const std::string& font_description_string) |
- : font_description_string_(font_description_string), |
- common_height_(-1), |
- common_baseline_(-1) { |
+ : font_description_string_(font_description_string) { |
DCHECK(!font_description_string.empty()); |
// DCHECK description string ends with "px" for size in pixel. |
DCHECK(EndsWith(font_description_string, "px", true)); |
} |
FontList::FontList(const std::vector<Font>& fonts) |
- : fonts_(fonts), common_height_(-1), common_baseline_(-1) { |
+ : fonts_(fonts) { |
DCHECK(!fonts.empty()); |
if (DCHECK_IS_ON()) { |
int style = fonts[0].GetStyle(); |
@@ -95,8 +93,7 @@ |
} |
} |
-FontList::FontList(const Font& font) |
- : common_height_(-1), common_baseline_(-1) { |
+FontList::FontList(const Font& font) { |
fonts_.push_back(font); |
} |
@@ -149,34 +146,6 @@ |
return FontList(BuildFontDescription(font_names, font_style, size)); |
} |
-int FontList::GetHeight() const { |
- if (common_height_ < 0) { |
- int ascent = 0; |
- int descent = 0; |
- const std::vector<Font>& fonts = GetFonts(); |
- for (std::vector<Font>::const_iterator i = fonts.begin(); |
- i != fonts.end(); ++i) { |
- ascent = std::max(ascent, i->GetBaseline()); |
- descent = std::max(descent, i->GetHeight() - i->GetBaseline()); |
- } |
- common_height_ = ascent + descent; |
- } |
- return common_height_; |
-} |
- |
-int FontList::GetBaseline() const { |
- if (common_baseline_ < 0) { |
- int baseline = 0; |
- const std::vector<Font>& fonts = GetFonts(); |
- for (std::vector<Font>::const_iterator i = fonts.begin(); |
- i != fonts.end(); ++i) { |
- baseline = std::max(baseline, i->GetBaseline()); |
- } |
- common_baseline_ = baseline; |
- } |
- return common_baseline_; |
-} |
- |
int FontList::GetFontStyle() const { |
if (!fonts_.empty()) |
return fonts_[0].GetStyle(); |