OLD | NEW |
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_FALLBACK_WIN_H_ | 5 #ifndef UI_GFX_FONT_FALLBACK_WIN_H_ |
6 #define UI_GFX_FONT_FALLBACK_WIN_H_ | 6 #define UI_GFX_FONT_FALLBACK_WIN_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "ui/gfx/font.h" | 11 #include "ui/gfx/font.h" |
12 | 12 |
13 namespace gfx { | 13 namespace gfx { |
14 | 14 |
15 // Internals of font_fallback_win.cc exposed for testing. | 15 // Internals of font_fallback_win.cc exposed for testing. |
16 namespace internal { | 16 namespace internal { |
17 | 17 |
18 // Parses comma separated SystemLink |entry|, per the format described here: | 18 // Parses comma separated SystemLink |entry|, per the format described here: |
19 // http://msdn.microsoft.com/en-us/goglobal/bb688134.aspx | 19 // http://msdn.microsoft.com/en-us/goglobal/bb688134.aspx |
20 // | 20 // |
21 // Sets |filename| and |font_name| respectively. If a field is not present | 21 // Sets |filename| and |font_name| respectively. If a field is not present |
22 // or could not be parsed, the corresponding parameter will be cleared. | 22 // or could not be parsed, the corresponding parameter will be cleared. |
23 void UI_EXPORT ParseFontLinkEntry(const std::string& entry, | 23 void GFX_EXPORT ParseFontLinkEntry(const std::string& entry, |
24 std::string* filename, | 24 std::string* filename, |
25 std::string* font_name); | 25 std::string* font_name); |
26 | 26 |
27 // Parses a font |family| in the format "FamilyFoo & FamilyBar (TrueType)". | 27 // Parses a font |family| in the format "FamilyFoo & FamilyBar (TrueType)". |
28 // Splits by '&' and strips off the trailing parenthesized expression. | 28 // Splits by '&' and strips off the trailing parenthesized expression. |
29 void UI_EXPORT ParseFontFamilyString(const std::string& family, | 29 void GFX_EXPORT ParseFontFamilyString(const std::string& family, |
30 std::vector<std::string>* font_names); | 30 std::vector<std::string>* font_names); |
31 | 31 |
32 } // namespace internal | 32 } // namespace internal |
33 | 33 |
34 // Iterator over linked fallback fonts for a given font. The linked font chain | 34 // Iterator over linked fallback fonts for a given font. The linked font chain |
35 // comes from the Windows registry, but gets cached between uses. | 35 // comes from the Windows registry, but gets cached between uses. |
36 class UI_EXPORT LinkedFontsIterator { | 36 class GFX_EXPORT LinkedFontsIterator { |
37 public: | 37 public: |
38 // Instantiates the iterator over the linked font chain for |font|. The first | 38 // Instantiates the iterator over the linked font chain for |font|. The first |
39 // item will be |font| itself. | 39 // item will be |font| itself. |
40 explicit LinkedFontsIterator(Font font); | 40 explicit LinkedFontsIterator(Font font); |
41 virtual ~LinkedFontsIterator(); | 41 virtual ~LinkedFontsIterator(); |
42 | 42 |
43 // Sets the font that would be returned by the next call to |NextFont()|, | 43 // Sets the font that would be returned by the next call to |NextFont()|, |
44 // useful for inserting one-time entries into the iterator chain. | 44 // useful for inserting one-time entries into the iterator chain. |
45 void SetNextFont(Font font); | 45 void SetNextFont(Font font); |
46 | 46 |
(...skipping 26 matching lines...) Expand all Loading... |
73 | 73 |
74 // Index of the current entry in the |linked_fonts_| list. | 74 // Index of the current entry in the |linked_fonts_| list. |
75 size_t linked_font_index_; | 75 size_t linked_font_index_; |
76 | 76 |
77 DISALLOW_COPY_AND_ASSIGN(LinkedFontsIterator); | 77 DISALLOW_COPY_AND_ASSIGN(LinkedFontsIterator); |
78 }; | 78 }; |
79 | 79 |
80 } // namespace gfx | 80 } // namespace gfx |
81 | 81 |
82 #endif // UI_GFX_FONT_FALLBACK_WIN_H_ | 82 #endif // UI_GFX_FONT_FALLBACK_WIN_H_ |
OLD | NEW |