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 |
12 namespace WebKit { | 14 namespace WebKit { |
13 struct WebFontRenderStyle; | 15 struct WebFontRenderStyle; |
14 } | 16 } |
15 | 17 |
16 namespace renderer_sandbox_support { | 18 namespace renderer_sandbox_support { |
17 | 19 |
18 // Return a font family which provides glyphs for the Unicode code points | 20 // Return a font family which provides glyphs for the Unicode code points |
19 // specified by |utf16| | 21 // specified by |utf16| |
20 // utf16: a native-endian UTF16 string | 22 // utf16: a native-endian UTF16 string |
21 // num_utf16: the number of 16-bit words in |utf16| | 23 // num_utf16: the number of 16-bit words in |utf16| |
22 // | 24 // |
23 // Returns: the font family or an empty string if the request could not be | 25 // Returns: the font family or an empty string if the request could not be |
24 // satisfied. | 26 // satisfied. |
25 std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16); | 27 std::string getFontFamilyForCharacters(const uint16_t* utf16, size_t num_utf16); |
26 | 28 |
27 void getRenderStyleForStrike(const char* family, int sizeAndStyle, | 29 void getRenderStyleForStrike(const char* family, int sizeAndStyle, |
28 WebKit::WebFontRenderStyle* out); | 30 WebKit::WebFontRenderStyle* out); |
29 | 31 |
30 // Returns a file descriptor for a shared memory segment. | 32 // Returns a file descriptor for a shared memory segment. |
31 int MakeSharedMemorySegmentViaIPC(size_t length); | 33 int MakeSharedMemorySegmentViaIPC(size_t length); |
32 | 34 |
| 35 // Return a read-only file descriptor to the font which best matches the given |
| 36 // properties or -1 on failure. |
| 37 // charset: specifies the language(s) that the font must cover. See |
| 38 // render_sandbox_host_linux.cc for more information. |
| 39 int MatchFontWithFallback(const std::string& face, bool bold, |
| 40 bool italic, NPCharset charset); |
| 41 |
| 42 // 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. |
| 44 // 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 |
| 46 // which case output_length will be set to the required size in bytes. |
| 47 // output_length: size of output, if it's not 0. |
| 48 // |
| 49 // returns: true on success. |
| 50 bool GetFontTable(int fd, uint32_t table, uint8_t* output, |
| 51 size_t* output_length); |
| 52 |
33 }; // namespace render_sandbox_support | 53 }; // namespace render_sandbox_support |
34 | 54 |
35 #endif // CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ | 55 #endif // CHROME_RENDERER_RENDERER_SANDBOX_SUPPORT_LINUX_H_ |
OLD | NEW |