OLD | NEW |
| (Empty) |
1 /* libs/graphics/ports/SkFontHost_fontconfig_impl.h | |
2 ** | |
3 ** Copyright 2009, Google Inc. | |
4 ** | |
5 ** Licensed under the Apache License, Version 2.0 (the "License"); | |
6 ** you may not use this file except in compliance with the License. | |
7 ** You may obtain a copy of the License at | |
8 ** | |
9 ** http://www.apache.org/licenses/LICENSE-2.0 | |
10 ** | |
11 ** Unless required by applicable law or agreed to in writing, software | |
12 ** distributed under the License is distributed on an "AS IS" BASIS, | |
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 ** See the License for the specific language governing permissions and | |
15 ** limitations under the License. | |
16 */ | |
17 | |
18 /* The SkFontHost_fontconfig code requires an implementation of an abstact | |
19 * fontconfig interface. We do this because sometimes fontconfig is not | |
20 * directly availible and this provides an ability to change the fontconfig | |
21 * implementation at run-time. | |
22 */ | |
23 | |
24 #ifndef FontConfigInterface_DEFINED | |
25 #define FontConfigInterface_DEFINED | |
26 | |
27 #include <string> | |
28 | |
29 class FontConfigInterface { | |
30 public: | |
31 virtual ~FontConfigInterface() { } | |
32 | |
33 /** Performs config match | |
34 * | |
35 * @param result_family (optional, set to NULL to ignore, output) | |
36 * on success, set to the resulting family name. | |
37 * @param result_filefaceid (optional, set to NULL to ignore, output) | |
38 * on success, set to the resulting fileface id. | |
39 * @param filefaceid_valid if true, then |filefaceid| is valid | |
40 * @param filefaceid the filefaceid (as returned by this function) | |
41 * which we are trying to match. | |
42 * @param family (optional) the family of the font that we are trying to | |
43 * match. If the length of the |family| is greater then | |
44 * kMaxFontFamilyLength, this function should immediately return false. | |
45 * @param characters (optional) UTF-16 characters the font must cover. | |
46 * @param characters_bytes (optional) number of bytes in |characters| | |
47 * @param is_bold (optional, set to NULL to ignore, in/out) | |
48 * @param is_italic (optional, set to NULL to ignore, in/out) | |
49 * @return true iff successful. | |
50 * Note that |filefaceid| uniquely identifies <font file, face_index) : | |
51 * system font: filefaceid = | |
52 * (fileid(unique per font file) << 4 | face_index) | |
53 * remote font: filefaceid = fileid | |
54 */ | |
55 virtual bool Match( | |
56 std::string* result_family, | |
57 unsigned* result_filefaceid, | |
58 bool filefaceid_valid, | |
59 unsigned filefaceid, | |
60 const std::string& family, | |
61 const void* characters, | |
62 size_t characters_bytes, | |
63 bool* is_bold, | |
64 bool* is_italic) = 0; | |
65 | |
66 /** Open a font file given the filefaceid as returned by Match. | |
67 */ | |
68 virtual int Open(unsigned filefaceid) = 0; | |
69 | |
70 static const unsigned kMaxFontFamilyLength = 2048; | |
71 }; | |
72 | |
73 #endif // FontConfigInterface_DEFINED | |
OLD | NEW |