Index: ui/gfx/font_list.cc |
diff --git a/ui/gfx/font_list.cc b/ui/gfx/font_list.cc |
index 93bf73e834a0bd5bbeed9c2670e64aaeb7f86add..5a5d6c0205e6cb7c442c6b5d0d494fa6625e73d5 100644 |
--- a/ui/gfx/font_list.cc |
+++ b/ui/gfx/font_list.cc |
@@ -146,6 +146,30 @@ FontList FontList::DeriveFontListWithSize(int size) const { |
return FontList(BuildFontDescription(font_names, font_style, size)); |
} |
+int FontList::GetHeight() const { |
+ 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()); |
+ } |
+ return ascent + descent; |
msw
2013/07/11 22:47:29
Does this meaningfully differ from max(i->GetHeigh
Yuki
2013/07/12 08:25:53
I supposed there could be two fonts.
Spec of Fon
msw
2013/07/12 09:36:04
Perfect example and explanation, thanks! But text
Yuki
2013/07/12 10:29:24
I'm optimistic for that case. Most of Latin fonts
msw
2013/07/12 10:41:58
sgtm, we can just followup if any actual defects a
|
+} |
+ |
+int FontList::GetBaseline() const { |
+ int baseline = 0; |
+ |
msw
2013/07/11 22:47:29
nit: remove blank line.
Yuki
2013/07/12 08:25:53
Done.
|
+ 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()); |
+ } |
+ return baseline; |
+} |
+ |
int FontList::GetFontStyle() const { |
if (!fonts_.empty()) |
return fonts_[0].GetStyle(); |