OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 5 #ifndef CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 6 #define CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
7 | 7 |
8 #include <dwrite.h> | 8 #include <dwrite.h> |
9 #include <wrl.h> | 9 #include <wrl.h> |
10 | 10 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 IDWriteFontFileStream** font_file_stream) override; | 64 IDWriteFontFileStream** font_file_stream) override; |
65 | 65 |
66 HRESULT STDMETHODCALLTYPE | 66 HRESULT STDMETHODCALLTYPE |
67 RuntimeClassInitialize(IDWriteFactory* factory, IPC::Sender* sender_override); | 67 RuntimeClassInitialize(IDWriteFactory* factory, IPC::Sender* sender_override); |
68 | 68 |
69 void Unregister(); | 69 void Unregister(); |
70 | 70 |
71 bool LoadFamily(UINT32 family_index, | 71 bool LoadFamily(UINT32 family_index, |
72 IDWriteFontCollection** containing_collection); | 72 IDWriteFontCollection** containing_collection); |
73 | 73 |
| 74 // Gets the family at the specified index with the expected name. This can be |
| 75 // used to avoid an IPC call when both the index and family name are known. |
| 76 bool GetFontFamily(UINT32 family_index, |
| 77 const base::string16& family_name, |
| 78 IDWriteFontFamily** font_family); |
| 79 |
74 bool LoadFamilyNames(UINT32 family_index, IDWriteLocalizedStrings** strings); | 80 bool LoadFamilyNames(UINT32 family_index, IDWriteLocalizedStrings** strings); |
75 | 81 |
76 bool CreateFamily(UINT32 family_index); | 82 bool CreateFamily(UINT32 family_index); |
77 | 83 |
78 private: | 84 private: |
79 IPC::Sender* GetSender(); | 85 IPC::Sender* GetSender(); |
80 | 86 |
81 Microsoft::WRL::ComPtr<IDWriteFactory> factory_; | 87 Microsoft::WRL::ComPtr<IDWriteFactory> factory_; |
82 std::vector<Microsoft::WRL::ComPtr<DWriteFontFamilyProxy>> families_; | 88 std::vector<Microsoft::WRL::ComPtr<DWriteFontFamilyProxy>> families_; |
83 std::map<base::string16, UINT32> family_names_; | 89 std::map<base::string16, UINT32> family_names_; |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 DWRITE_FONT_STYLE style, | 123 DWRITE_FONT_STYLE style, |
118 IDWriteFontList** matching_fonts) override; | 124 IDWriteFontList** matching_fonts) override; |
119 | 125 |
120 HRESULT STDMETHODCALLTYPE | 126 HRESULT STDMETHODCALLTYPE |
121 RuntimeClassInitialize(DWriteFontCollectionProxy* collection, UINT32 index); | 127 RuntimeClassInitialize(DWriteFontCollectionProxy* collection, UINT32 index); |
122 | 128 |
123 bool GetFontFromFontFace(IDWriteFontFace* font_face, IDWriteFont** font); | 129 bool GetFontFromFontFace(IDWriteFontFace* font_face, IDWriteFont** font); |
124 | 130 |
125 void SetName(const base::string16& family_name); | 131 void SetName(const base::string16& family_name); |
126 | 132 |
| 133 const base::string16& GetName(); |
| 134 |
127 bool IsLoaded(); | 135 bool IsLoaded(); |
128 | 136 |
129 protected: | 137 protected: |
130 bool LoadFamily(); | 138 bool LoadFamily(); |
131 | 139 |
132 private: | 140 private: |
133 UINT32 family_index_; | 141 UINT32 family_index_; |
134 base::string16 family_name_; | 142 base::string16 family_name_; |
135 Microsoft::WRL::ComPtr<DWriteFontCollectionProxy> proxy_collection_; | 143 Microsoft::WRL::ComPtr<DWriteFontCollectionProxy> proxy_collection_; |
136 Microsoft::WRL::ComPtr<IDWriteFontFamily> family_; | 144 Microsoft::WRL::ComPtr<IDWriteFontFamily> family_; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 RuntimeClassInitialize(const base::string16& file_name); | 202 RuntimeClassInitialize(const base::string16& file_name); |
195 | 203 |
196 private: | 204 private: |
197 base::MemoryMappedFile data_; | 205 base::MemoryMappedFile data_; |
198 | 206 |
199 DISALLOW_ASSIGN(FontFileStream); | 207 DISALLOW_ASSIGN(FontFileStream); |
200 }; | 208 }; |
201 | 209 |
202 } // namespace content | 210 } // namespace content |
203 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ | 211 #endif // CONTENT_CHILD_DWRITE_FONT_PROXY_DWRITE_FONT_PROXY_WIN_H_ |
OLD | NEW |