OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #ifndef CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ | 5 #ifndef CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ |
6 #define CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ | 6 #define CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "third_party/npapi/bindings/npapi_extensions.h" | |
13 | |
14 namespace WebKit { | 12 namespace WebKit { |
15 struct WebFontRenderStyle; | 13 struct WebFontRenderStyle; |
16 } | 14 } |
17 | 15 |
18 namespace renderer_sandbox_support { | 16 namespace renderer_sandbox_support { |
19 | 17 |
20 // Return a font family which provides glyphs for the Unicode code points | 18 // Return a font family which provides glyphs for the Unicode code points |
21 // specified by |utf16| | 19 // specified by |utf16| |
22 // utf16: a native-endian UTF16 string | 20 // utf16: a native-endian UTF16 string |
23 // num_utf16: the number of 16-bit words in |utf16| | 21 // num_utf16: the number of 16-bit words in |utf16| |
24 // | 22 // |
25 // Returns: the font family or an empty string if the request could not be | 23 // Returns: the font family or an empty string if the request could not be |
26 // satisfied. | 24 // satisfied. |
27 std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16); | 25 std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16); |
28 | 26 |
29 void getRenderStyleForStrike(const char* family, int sizeAndStyle, | 27 void getRenderStyleForStrike(const char* family, int sizeAndStyle, |
30 WebKit::WebFontRenderStyle* out); | 28 WebKit::WebFontRenderStyle* out); |
31 | 29 |
32 // Returns a file descriptor for a shared memory segment. | 30 // Returns a file descriptor for a shared memory segment. |
33 int MakeSharedMemorySegmentViaIPC(size_t length); | 31 int MakeSharedMemorySegmentViaIPC(size_t length); |
34 | 32 |
35 // Return a read-only file descriptor to the font which best matches the given | 33 // Return a read-only file descriptor to the font which best matches the given |
36 // properties or -1 on failure. | 34 // properties or -1 on failure. |
37 // charset: specifies the language(s) that the font must cover. See | 35 // charset: specifies the language(s) that the font must cover. See |
38 // render_sandbox_host_linux.cc for more information. | 36 // render_sandbox_host_linux.cc for more information. |
39 int MatchFontWithFallback(const std::string& face, bool bold, | 37 int MatchFontWithFallback(const std::string& face, bool bold, |
40 bool italic, NPCharset charset); | 38 bool italic, int charset); |
41 | 39 |
42 // GetFontTable loads a specified font table from an open SFNT file. | 40 // GetFontTable loads a specified font table from an open SFNT file. |
43 // fd: a file descriptor to the SFNT file. The position doesn't matter. | 41 // fd: a file descriptor to the SFNT file. The position doesn't matter. |
44 // table: the table in *big-endian* format, or 0 for the whole font file. | 42 // table: the table in *big-endian* format, or 0 for the whole font file. |
45 // output: a buffer of size output_length that gets the data. can be 0, in | 43 // output: a buffer of size output_length that gets the data. can be 0, in |
46 // which case output_length will be set to the required size in bytes. | 44 // which case output_length will be set to the required size in bytes. |
47 // output_length: size of output, if it's not 0. | 45 // output_length: size of output, if it's not 0. |
48 // | 46 // |
49 // returns: true on success. | 47 // returns: true on success. |
50 bool GetFontTable(int fd, uint32_t table, uint8_t* output, | 48 bool GetFontTable(int fd, uint32_t table, uint8_t* output, |
51 size_t* output_length); | 49 size_t* output_length); |
52 | 50 |
53 }; // namespace render_sandbox_support | 51 }; // namespace render_sandbox_support |
54 | 52 |
55 #endif // CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ | 53 #endif // CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ |
OLD | NEW |