Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: app/gfx/font_util.cc

Issue 279004: Made sync code build and pass unit tests on OS X. (Closed)
Patch Set: Fixed uninitialized var error. Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « app/gfx/font_util.h ('k') | chrome/browser/browser_window.h » ('j') | chrome/chrome.gyp » ('J')

Powered by Google App Engine
This is Rietveld 408576698