Chromium Code Reviews| 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "content/common/content_export.h" | 11 #include "content/common/content_export.h" |
| 12 #include "ipc/ipc_message_macros.h" | 12 #include "ipc/ipc_message_macros.h" |
| 13 | 13 |
| 14 #undef IPC_MESSAGE_EXPORT | 14 #undef IPC_MESSAGE_EXPORT |
| 15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT | 15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
| 16 #define IPC_MESSAGE_START DWriteFontProxyMsgStart | 16 #define IPC_MESSAGE_START DWriteFontProxyMsgStart |
| 17 | 17 |
| 18 #ifndef CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ | 18 #ifndef CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ |
| 19 #define CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ | 19 #define CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ |
| 20 | 20 |
| 21 // The macros can't handle a complex template declaration, so we typedef it. | 21 // The macros can't handle a complex template declaration, so we typedef it. |
| 22 typedef std::pair<base::string16, base::string16> DWriteStringPair; | 22 typedef std::pair<base::string16, base::string16> DWriteStringPair; |
| 23 | 23 |
| 24 #endif // CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ | 24 #endif // CONTENT_COMMON_DWRITE_FONT_PROXY_MESSAGES_H_ |
| 25 | 25 |
| 26 IPC_STRUCT_BEGIN(DWriteFontStyle) | |
| 27 IPC_STRUCT_MEMBER(uint16_t, font_weight) | |
| 28 IPC_STRUCT_MEMBER(uint8_t, font_slant) | |
| 29 IPC_STRUCT_MEMBER(uint8_t, font_stretch) | |
| 30 IPC_STRUCT_END() | |
| 31 | |
| 32 IPC_STRUCT_BEGIN(MapCharactersResult) | |
| 33 IPC_STRUCT_MEMBER(uint32_t, family_index) | |
| 34 IPC_STRUCT_MEMBER(base::string16, family_name) | |
| 35 IPC_STRUCT_MEMBER(uint32_t, mapped_length) | |
| 36 IPC_STRUCT_MEMBER(float, scale) | |
| 37 IPC_STRUCT_MEMBER(DWriteFontStyle, font_style) | |
|
scottmg
2016/04/13 21:23:16
font_style doesn't seem to be used in OnMapCharact
Ilya Kulshin
2016/04/13 22:31:29
Nice catch! Apparently DirectWrite doesn't care if
| |
| 38 IPC_STRUCT_END() | |
| 39 | |
| 26 // Locates the index of the specified font family within the system collection. | 40 // Locates the index of the specified font family within the system collection. |
| 27 IPC_SYNC_MESSAGE_CONTROL1_1(DWriteFontProxyMsg_FindFamily, | 41 IPC_SYNC_MESSAGE_CONTROL1_1(DWriteFontProxyMsg_FindFamily, |
| 28 base::string16 /* family_name */, | 42 base::string16 /* family_name */, |
| 29 uint32_t /* out index */) | 43 uint32_t /* out index */) |
| 30 | 44 |
| 31 // Returns the number of font families in the system collection. | 45 // Returns the number of font families in the system collection. |
| 32 IPC_SYNC_MESSAGE_CONTROL0_1(DWriteFontProxyMsg_GetFamilyCount, | 46 IPC_SYNC_MESSAGE_CONTROL0_1(DWriteFontProxyMsg_GetFamilyCount, |
| 33 uint32_t /* out count */) | 47 uint32_t /* out count */) |
| 34 | 48 |
| 35 // Returns the list of locale and family name pairs for the font family at the | 49 // Returns the list of locale and family name pairs for the font family at the |
| 36 // specified index. | 50 // specified index. |
| 37 IPC_SYNC_MESSAGE_CONTROL1_1( | 51 IPC_SYNC_MESSAGE_CONTROL1_1( |
| 38 DWriteFontProxyMsg_GetFamilyNames, | 52 DWriteFontProxyMsg_GetFamilyNames, |
| 39 uint32_t /* family_index */, | 53 uint32_t /* family_index */, |
| 40 std::vector<DWriteStringPair> /* out family_names */) | 54 std::vector<DWriteStringPair> /* out family_names */) |
| 41 | 55 |
| 42 // Returns the list of font file paths in the system font directory that contain | 56 // Returns the list of font file paths in the system font directory that contain |
| 43 // font data for the font family at the specified index. | 57 // font data for the font family at the specified index. |
| 44 IPC_SYNC_MESSAGE_CONTROL1_1(DWriteFontProxyMsg_GetFontFiles, | 58 IPC_SYNC_MESSAGE_CONTROL1_1(DWriteFontProxyMsg_GetFontFiles, |
| 45 uint32_t /* family_index */, | 59 uint32_t /* family_index */, |
| 46 std::vector<base::string16> /* out file_paths */) | 60 std::vector<base::string16> /* out file_paths */) |
| 61 | |
| 62 // Locates a font family that is able to render the specified text using the | |
| 63 // specified style. If successful, the family_index and family_name will | |
| 64 // indicate which family in the system font collection can render the requested | |
| 65 // text and the mapped_length will indicate how many characters can be | |
| 66 // rendered. If no font exists that can render the text, family_index will be | |
| 67 // UINT32_MAX and mapped_length will indicate how many characters cannot be | |
| 68 // rendered by any installed font. | |
| 69 IPC_SYNC_MESSAGE_CONTROL5_1(DWriteFontProxyMsg_MapCharacters, | |
| 70 base::string16 /* text */, | |
| 71 DWriteFontStyle /* font_style */, | |
| 72 base::string16 /* locale_name */, | |
| 73 uint32_t /* reading_direction */, | |
| 74 base::string16 /* base_family_name - optional */, | |
| 75 MapCharactersResult /* out */) | |
| OLD | NEW |