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