| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "app/gfx/font_util.h" |
| 6 |
| 7 #include "app/gfx/font.h" |
| 8 #include "app/l10n_util.h" |
| 9 #include "base/logging.h" |
| 10 |
| 11 namespace gfx { |
| 12 |
| 13 int GetLocalizedContentsWidthForFont(int col_resource_id, |
| 14 const gfx::Font& font) { |
| 15 double chars = 0; |
| 16 StringToDouble(WideToUTF8(l10n_util::GetString(col_resource_id)), &chars); |
| 17 int width = font.GetExpectedTextWidth(static_cast<int>(chars)); |
| 18 DCHECK(width > 0); |
| 19 return width; |
| 20 } |
| 21 |
| 22 int GetLocalizedContentsHeightForFont(int row_resource_id, |
| 23 const gfx::Font& font) { |
| 24 double lines = 0; |
| 25 StringToDouble(WideToUTF8(l10n_util::GetString(row_resource_id)), &lines); |
| 26 int height = static_cast<int>(font.height() * lines); |
| 27 DCHECK(height > 0); |
| 28 return height; |
| 29 } |
| 30 |
| 31 gfx::Size GetLocalizedContentsSizeForFont(int col_resource_id, |
| 32 int row_resource_id, |
| 33 const gfx::Font& font) { |
| 34 return gfx::Size(GetLocalizedContentsWidthForFont(col_resource_id, font), |
| 35 GetLocalizedContentsHeightForFont(row_resource_id, font)); |
| 36 } |
| 37 |
| 38 } // namespace gfx |
| 39 |
| OLD | NEW |