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

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

Issue 331713003: RenderTextHarfBuzz: Implement font fallback for Win and Linux (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gyp -> gn Created 6 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
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_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 #include "ui/gfx/font_fallback.h"
12 13
13 namespace gfx { 14 namespace gfx {
14 15
15 // Internals of font_fallback_win.cc exposed for testing. 16 // Internals of font_fallback_win.cc exposed for testing.
16 namespace internal { 17 namespace internal {
17 18
18 // Parses comma separated SystemLink |entry|, per the format described here: 19 // Parses comma separated SystemLink |entry|, per the format described here:
19 // http://msdn.microsoft.com/en-us/goglobal/bb688134.aspx 20 // http://msdn.microsoft.com/en-us/goglobal/bb688134.aspx
20 // 21 //
21 // Sets |filename| and |font_name| respectively. If a field is not present 22 // Sets |filename| and |font_name| respectively. If a field is not present
22 // or could not be parsed, the corresponding parameter will be cleared. 23 // or could not be parsed, the corresponding parameter will be cleared.
23 void GFX_EXPORT ParseFontLinkEntry(const std::string& entry, 24 void GFX_EXPORT ParseFontLinkEntry(const std::string& entry,
24 std::string* filename, 25 std::string* filename,
25 std::string* font_name); 26 std::string* font_name);
26 27
27 // Parses a font |family| in the format "FamilyFoo & FamilyBar (TrueType)". 28 // Parses a font |family| in the format "FamilyFoo & FamilyBar (TrueType)".
28 // Splits by '&' and strips off the trailing parenthesized expression. 29 // Splits by '&' and strips off the trailing parenthesized expression.
29 void GFX_EXPORT ParseFontFamilyString(const std::string& family, 30 void GFX_EXPORT ParseFontFamilyString(const std::string& family,
30 std::vector<std::string>* font_names); 31 std::vector<std::string>* font_names);
31 32
32 } // namespace internal
33
34 // Iterator over linked fallback fonts for a given font. The linked font chain 33 // Iterator over linked fallback fonts for a given font. The linked font chain
35 // comes from the Windows registry, but gets cached between uses. 34 // comes from the Windows registry, but gets cached between uses.
36 class GFX_EXPORT LinkedFontsIterator { 35 class GFX_EXPORT LinkedFontsIterator {
37 public: 36 public:
38 // Instantiates the iterator over the linked font chain for |font|. The first 37 // Instantiates the iterator over the linked font chain for |font|. The first
39 // item will be |font| itself. 38 // item will be |font| itself.
40 explicit LinkedFontsIterator(Font font); 39 explicit LinkedFontsIterator(Font font);
41 virtual ~LinkedFontsIterator(); 40 virtual ~LinkedFontsIterator();
42 41
43 // Sets the font that would be returned by the next call to |NextFont()|, 42 // Sets the font that would be returned by the next call to |NextFont()|,
(...skipping 26 matching lines...) Expand all
70 69
71 // List of linked fonts; weak pointer. 70 // List of linked fonts; weak pointer.
72 const std::vector<Font>* linked_fonts_; 71 const std::vector<Font>* linked_fonts_;
73 72
74 // Index of the current entry in the |linked_fonts_| list. 73 // Index of the current entry in the |linked_fonts_| list.
75 size_t linked_font_index_; 74 size_t linked_font_index_;
76 75
77 DISALLOW_COPY_AND_ASSIGN(LinkedFontsIterator); 76 DISALLOW_COPY_AND_ASSIGN(LinkedFontsIterator);
78 }; 77 };
79 78
79 } // namespace internal
80
81 // Finds a fallback font to render the specified |text| with respect to an
82 // initial |font|. Returns the resulting font via out param |result|. Returns
83 // |true| if a fallback font was found.
84 bool GetUniscribeFallbackFont(const Font& font,
85 const wchar_t* text,
86 int text_length,
87 Font* result);
88
80 } // namespace gfx 89 } // namespace gfx
81 90
82 #endif // UI_GFX_FONT_FALLBACK_WIN_H_ 91 #endif // UI_GFX_FONT_FALLBACK_WIN_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698