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

Side by Side Diff: ui/gfx/font_list.h

Issue 18848002: Shows Japanese and English mixed queries correctly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disables the test on Android. Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « build/android/pylib/gtest/filter/ui_unittests_disabled ('k') | ui/gfx/font_list.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GFX_FONT_LIST_H_ 5 #ifndef UI_GFX_FONT_LIST_H_
6 #define UI_GFX_FONT_LIST_H_ 6 #define UI_GFX_FONT_LIST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/gtest_prod_util.h"
11 #include "ui/base/ui_export.h" 12 #include "ui/base/ui_export.h"
12 #include "ui/gfx/font.h" 13 #include "ui/gfx/font.h"
13 14
14 namespace gfx { 15 namespace gfx {
15 16
16 // FontList represents a list of fonts either in the form of Font vector or in 17 // FontList represents a list of fonts either in the form of Font vector or in
17 // the form of a string representing font names, styles, and size. 18 // the form of a string representing font names, styles, and size.
18 // 19 //
19 // The string representation is in the form "FAMILY_LIST [STYLE_OPTIONS] SIZE", 20 // The string representation is in the form "FAMILY_LIST [STYLE_OPTIONS] SIZE",
20 // where FAMILY_LIST is a comma separated list of families terminated by a 21 // where FAMILY_LIST is a comma separated list of families terminated by a
(...skipping 29 matching lines...) Expand all
50 51
51 ~FontList(); 52 ~FontList();
52 53
53 // Returns a new FontList with the given |font_style| flags. 54 // Returns a new FontList with the given |font_style| flags.
54 FontList DeriveFontList(int font_style) const; 55 FontList DeriveFontList(int font_style) const;
55 56
56 // Returns a new FontList with the same font names and style but with the 57 // Returns a new FontList with the same font names and style but with the
57 // given font |size| in pixels. 58 // given font |size| in pixels.
58 FontList DeriveFontListWithSize(int size) const; 59 FontList DeriveFontListWithSize(int size) const;
59 60
61 // Returns the height of this font list, which is max(ascent) + max(descent)
62 // for all the fonts in the font list.
63 int GetHeight() const;
64
65 // Returns the baseline of this font list, which is max(baseline) for all the
66 // fonts in the font list.
67 int GetBaseline() const;
68
60 // Returns the |gfx::Font::FontStyle| style flags for this font list. 69 // Returns the |gfx::Font::FontStyle| style flags for this font list.
61 int GetFontStyle() const; 70 int GetFontStyle() const;
62 71
63 // Returns a string representing font names, styles, and size. If the FontList 72 // Returns a string representing font names, styles, and size. If the FontList
64 // is initialized by a vector of Font, use the first font's style and size 73 // is initialized by a vector of Font, use the first font's style and size
65 // for the description. 74 // for the description.
66 const std::string& GetFontDescriptionString() const; 75 const std::string& GetFontDescriptionString() const;
67 76
68 // Returns the Font vector. 77 // Returns the Font vector.
69 const std::vector<Font>& GetFonts() const; 78 const std::vector<Font>& GetFonts() const;
70 79
71 private: 80 private:
81 FRIEND_TEST_ALL_PREFIXES(FontListTest, Fonts_GetHeight_GetBaseline);
82
72 // A vector of Font. If FontList is constructed with font description string, 83 // A vector of Font. If FontList is constructed with font description string,
73 // |fonts_| is not initialized during construction. Instead, it is computed 84 // |fonts_| is not initialized during construction. Instead, it is computed
74 // lazily when user asked to get the font vector. 85 // lazily when user asked to get the font vector.
75 mutable std::vector<Font> fonts_; 86 mutable std::vector<Font> fonts_;
76 87
77 // A string representing font names, styles, and sizes. 88 // A string representing font names, styles, and sizes.
78 // Please refer to the comments before class declaration for details on string 89 // Please refer to the comments before class declaration for details on string
79 // format. 90 // format.
80 // If FontList is constructed with a vector of font, 91 // If FontList is constructed with a vector of font,
81 // |font_description_string_| is not initialized during construction. Instead, 92 // |font_description_string_| is not initialized during construction. Instead,
82 // it is computed lazily when user asked to get the font description string. 93 // it is computed lazily when user asked to get the font description string.
83 mutable std::string font_description_string_; 94 mutable std::string font_description_string_;
95
96 // The cached common height and baseline of the fonts in the font list.
97 mutable int common_height_;
98 mutable int common_baseline_;
84 }; 99 };
85 100
86 } // namespace gfx 101 } // namespace gfx
87 102
88 #endif // UI_GFX_FONT_LIST_H_ 103 #endif // UI_GFX_FONT_LIST_H_
OLDNEW
« no previous file with comments | « build/android/pylib/gtest/filter/ui_unittests_disabled ('k') | ui/gfx/font_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698