├── .gitignore ├── .travis.yml ├── COPYRIGHT ├── Cargo.toml ├── LICENSE-APACHE ├── LICENSE-MIT ├── Makefile.in ├── README.md ├── configure └── src ├── fontconfig.rs └── lib.rs /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | /doc 3 | /target 4 | /Cargo.lock 5 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: rust 2 | sudo: false 3 | rust: 4 | - nightly 5 | notifications: 6 | webhooks: http://build.servo.org:54856/travis 7 | -------------------------------------------------------------------------------- /COPYRIGHT: -------------------------------------------------------------------------------- 1 | Licensed under the Apache License, Version 2.0 or the MIT license 3 | , at your 4 | option. All files in the project carrying such notice may not be 5 | copied, modified, or distributed except according to those terms. 6 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "servo-fontconfig" 3 | version = "0.5.1" 4 | authors = ["The Servo Project Developers"] 5 | repository = "https://github.com/servo/rust-fontconfig/" 6 | documentation = "https://docs.rs/servo-fontconfig" 7 | description = "Rust bindings for fontconfig" 8 | license= "MIT / Apache-2.0" 9 | 10 | [lib] 11 | name = "fontconfig" 12 | 13 | [dependencies] 14 | servo-fontconfig-sys = "5.1.0" 15 | libc = "0.2" 16 | 17 | [features] 18 | force_system_lib = ["servo-fontconfig-sys/force_system_lib"] 19 | -------------------------------------------------------------------------------- /LICENSE-APACHE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "[]" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright [yyyy] [name of copyright owner] 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012-2020 Mozilla Foundation 2 | Copyright (c) 2012-2020 The Servo Project Developers 3 | 4 | Permission is hereby granted, free of charge, to any 5 | person obtaining a copy of this software and associated 6 | documentation files (the "Software"), to deal in the 7 | Software without restriction, including without 8 | limitation the rights to use, copy, modify, merge, 9 | publish, distribute, sublicense, and/or sell copies of 10 | the Software, and to permit persons to whom the Software 11 | is furnished to do so, subject to the following 12 | conditions: 13 | 14 | The above copyright notice and this permission notice 15 | shall be included in all copies or substantial portions 16 | of the Software. 17 | 18 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF 19 | ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 20 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A 21 | PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT 22 | SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 23 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 24 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR 25 | IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 26 | DEALINGS IN THE SOFTWARE. 27 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | VPATH=%VPATH% 2 | 3 | CC ?= gcc 4 | CXX ?= g++ 5 | CXXFLAGS ?= 6 | AR ?= ar 7 | RUSTC ?= rustc 8 | RUSTFLAGS ?= 9 | EXT_DEPS ?= 10 | RUSTDOC ?= rustdoc 11 | RUSTDOC_FLAGS ?= 12 | RUSTDOC_TARGET ?= doc 13 | 14 | ifeq ($(CFG_OSTYPE),linux-androideabi) 15 | RUSTFLAGS += -L./../../android/fontconfig/src/.libs 16 | else ifeq ($(CFG_OSTYPE),unknown-linux-gnu) 17 | RUSTFLAGS += -L./../../linux/fontconfig/src/.libs 18 | endif 19 | 20 | RUST_SRC=$(shell find $(VPATH)/src -type f -name '*.rs') 21 | 22 | .PHONY: all 23 | all: libfontconfig-servo.dummy 24 | 25 | %.o: %.c 26 | $(CC) $< -o $@ -c $(CFLAGS) 27 | 28 | libfontconfig-servo.dummy: src/lib.rs $(RUST_SRC) $(EXT_DEPS) 29 | $(RUSTC) $(RUSTFLAGS) $< --out-dir . -C extra-filename=-servo 30 | touch $@ 31 | 32 | fontconfig-test: src/lib.rs $(RUST_SRC) 33 | $(RUSTC) $(RUSTFLAGS) $< -o $@ --test 34 | 35 | .PHONY: check 36 | check: fontconfig-test 37 | ./fontconfig-test 38 | 39 | .PHONY: doc 40 | doc: $(RUSTDOC_TARGET)/fontconfig/index.html 41 | 42 | $(RUSTDOC_TARGET)/fontconfig/index.html: src/lib.rs $(RUST_SRC) $(EXT_DEPS) 43 | $(RUSTDOC) $(RUSTDOC_FLAGS) $< -o $(RUSTDOC_TARGET) 44 | 45 | .PHONY: clean 46 | clean: 47 | rm -f *.o *.a *.so *.dylib *.rlib *.dll *.dummy *-test 48 | 49 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # servo-fontconfig 2 | 3 | Rust bindings to [Fontconfig](http://fontconfig.org/). 4 | 5 | * [Documentation](https://docs.rs/servo-fontconfig) 6 | * [crates.io](https://crates.io/crates/servo-fontconfig) 7 | 8 | ## Release notes 9 | 10 | ### 0.3.0 11 | 12 | * [breaking change] Fixed pointer types in some function signatures (#33). 13 | 14 | ### 0.2.1 15 | 16 | * Updated dependencies 17 | 18 | ### 0.2.0 19 | 20 | * [breaking change] Changed crate name to `fontconfig` 21 | 22 | ### 0.1.0 23 | 24 | * Initial release 25 | -------------------------------------------------------------------------------- /configure: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SRCDIR="$(cd $(dirname $0) && pwd)" 4 | sed "s#%VPATH%#${SRCDIR}#" ${SRCDIR}/Makefile.in > Makefile 5 | 6 | -------------------------------------------------------------------------------- /src/fontconfig.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT 2 | // file at the top-level directory of this distribution. 3 | // 4 | // Licensed under the Apache License, Version 2.0 or the MIT license 6 | // , at your 7 | // option. This file may not be copied, modified, or distributed 8 | // except according to those terms. 9 | 10 | #![allow(non_upper_case_globals)] 11 | #![allow(non_camel_case_types)] 12 | 13 | use libc::*; 14 | 15 | pub type FcChar8 = c_uchar; 16 | pub type FcChar16 = c_ushort; 17 | pub type FcChar32 = c_uint; 18 | pub type FcBool = c_int; 19 | 20 | pub type enum__FcType = c_uint; 21 | pub const FcTypeVoid: u32 = 0_u32; 22 | pub const FcTypeInteger: u32 = 1_u32; 23 | pub const FcTypeDouble: u32 = 2_u32; 24 | pub const FcTypeString: u32 = 3_u32; 25 | pub const FcTypeBool: u32 = 4_u32; 26 | pub const FcTypeMatrix: u32 = 5_u32; 27 | pub const FcTypeCharSet: u32 = 6_u32; 28 | pub const FcTypeFTFace: u32 = 7_u32; 29 | pub const FcTypeLangSet: u32 = 8_u32; 30 | 31 | pub type FcType = enum__FcType; 32 | 33 | pub const FC_WEIGHT_THIN: c_int = 0; 34 | pub const FC_WEIGHT_EXTRALIGHT: c_int = 40; 35 | pub const FC_WEIGHT_ULTRALIGHT: c_int = FC_WEIGHT_EXTRALIGHT; 36 | pub const FC_WEIGHT_LIGHT: c_int = 50; 37 | pub const FC_WEIGHT_BOOK: c_int = 75; 38 | pub const FC_WEIGHT_REGULAR: c_int = 80; 39 | pub const FC_WEIGHT_NORMAL: c_int = FC_WEIGHT_REGULAR; 40 | pub const FC_WEIGHT_MEDIUM: c_int = 100; 41 | pub const FC_WEIGHT_DEMIBOLD: c_int = 180; 42 | pub const FC_WEIGHT_SEMIBOLD: c_int = FC_WEIGHT_DEMIBOLD; 43 | pub const FC_WEIGHT_BOLD: c_int = 200; 44 | pub const FC_WEIGHT_EXTRABOLD: c_int = 205; 45 | pub const FC_WEIGHT_ULTRABOLD: c_int = FC_WEIGHT_EXTRABOLD; 46 | pub const FC_WEIGHT_BLACK: c_int = 210; 47 | pub const FC_WEIGHT_HEAVY: c_int = FC_WEIGHT_BLACK; 48 | pub const FC_WEIGHT_EXTRABLACK: c_int = 215; 49 | pub const FC_WEIGHT_ULTRABLACK: c_int = FC_WEIGHT_EXTRABLACK; 50 | 51 | pub const FC_SLANT_ROMAN: c_int = 0; 52 | pub const FC_SLANT_ITALIC: c_int = 100; 53 | pub const FC_SLANT_OBLIQUE: c_int = 110; 54 | 55 | #[repr(C)] 56 | #[derive(Copy, Clone)] 57 | pub struct struct__FcMatrix { 58 | pub xx: c_double, 59 | pub xy: c_double, 60 | pub yx: c_double, 61 | pub yy: c_double, 62 | } 63 | 64 | pub type FcMatrix = struct__FcMatrix; 65 | 66 | pub type struct__FcCharSet = c_void; 67 | 68 | pub type FcCharSet = struct__FcCharSet; 69 | 70 | #[repr(C)] 71 | #[allow(missing_copy_implementations)] 72 | pub struct struct__FcObjectType { 73 | pub object: *mut c_char, 74 | pub _type: FcType, 75 | } 76 | 77 | pub type FcObjectType = struct__FcObjectType; 78 | 79 | #[repr(C)] 80 | #[allow(missing_copy_implementations)] 81 | pub struct struct__FcConstant { 82 | pub name: *mut FcChar8, 83 | pub object: *mut c_char, 84 | pub value: c_int, 85 | } 86 | 87 | pub type FcConstant = struct__FcConstant; 88 | 89 | pub type enum__FcResult = c_uint; 90 | pub const FcResultMatch: u32 = 0_u32; 91 | pub const FcResultNoMatch: u32 = 1_u32; 92 | pub const FcResultTypeMismatch: u32 = 2_u32; 93 | pub const FcResultNoId: u32 = 3_u32; 94 | pub const FcResultOutOfMemory: u32 = 4_u32; 95 | 96 | pub type FcResult = enum__FcResult; 97 | 98 | pub type struct__FcPattern = c_void; 99 | 100 | pub type FcPattern = struct__FcPattern; 101 | 102 | pub type struct__FcLangSet = c_void; 103 | 104 | pub type FcLangSet = struct__FcLangSet; 105 | 106 | #[repr(C)] 107 | #[allow(missing_copy_implementations)] 108 | pub struct struct__FcValue { 109 | pub _type: FcType, 110 | pub u: union_unnamed1, 111 | } 112 | 113 | pub type FcValue = struct__FcValue; 114 | 115 | #[repr(C)] 116 | #[allow(missing_copy_implementations)] 117 | pub struct struct__FcFontSet { 118 | pub nfont: c_int, 119 | pub sfont: c_int, 120 | pub fonts: *mut *mut FcPattern, 121 | } 122 | 123 | pub type FcFontSet = struct__FcFontSet; 124 | 125 | #[repr(C)] 126 | #[allow(missing_copy_implementations)] 127 | pub struct struct__FcObjectSet { 128 | pub nobject: c_int, 129 | pub sobject: c_int, 130 | pub objects: *mut *mut c_char, 131 | } 132 | 133 | pub type FcObjectSet = struct__FcObjectSet; 134 | 135 | pub type enum__FcMatchKind = c_uint; 136 | pub const FcMatchPattern: u32 = 0_u32; 137 | pub const FcMatchFont: u32 = 1_u32; 138 | pub const FcMatchScan: u32 = 2_u32; 139 | 140 | pub type FcMatchKind = enum__FcMatchKind; 141 | 142 | pub type enum__FcLangResult = c_uint; 143 | pub const FcLangEqual: u32 = 0_u32; 144 | pub const FcLangDifferentCountry: u32 = 1_u32; 145 | pub const FcLangDifferentTerritory: u32 = 1_u32; 146 | pub const FcLangDifferentLang: u32 = 2_u32; 147 | 148 | pub type FcLangResult = enum__FcLangResult; 149 | 150 | pub type enum__FcSetName = c_uint; 151 | pub const FcSetSystem: u32 = 0_u32; 152 | pub const FcSetApplication: u32 = 1_u32; 153 | 154 | pub type FcSetName = enum__FcSetName; 155 | 156 | pub type struct__FcAtomic = c_void; 157 | 158 | pub type FcAtomic = struct__FcAtomic; 159 | 160 | 161 | pub type FcEndian = c_uint; 162 | pub const FcEndianBig: u32 = 0_u32; 163 | pub const FcEndianLittle: u32 = 1_u32; 164 | 165 | pub type struct__FcConfig = c_void; 166 | 167 | pub type FcConfig = struct__FcConfig; 168 | 169 | pub type struct__FcGlobalCache = c_void; 170 | 171 | pub type FcFileCache = struct__FcGlobalCache; 172 | 173 | pub type struct__FcBlanks = c_void; 174 | 175 | pub type FcBlanks = struct__FcBlanks; 176 | 177 | pub type struct__FcStrList = c_void; 178 | 179 | pub type FcStrList = struct__FcStrList; 180 | 181 | pub type struct__FcStrSet = c_void; 182 | 183 | pub type FcStrSet = struct__FcStrSet; 184 | 185 | pub type struct__FcCache = c_void; 186 | 187 | pub type FcCache = struct__FcCache; 188 | 189 | pub type union_unnamed1 = c_void /* FIXME: union type */; 190 | 191 | 192 | 193 | extern { 194 | 195 | pub fn FcBlanksCreate() -> *mut FcBlanks; 196 | 197 | pub fn FcBlanksDestroy(b: *mut FcBlanks); 198 | 199 | pub fn FcBlanksAdd(b: *mut FcBlanks, ucs4: FcChar32) -> FcBool; 200 | 201 | pub fn FcBlanksIsMember(b: *mut FcBlanks, ucs4: FcChar32) -> FcBool; 202 | 203 | pub fn FcCacheDir(c: *mut FcCache) -> *const FcChar8; 204 | 205 | pub fn FcCacheCopySet(c: *const FcCache) -> *mut FcFontSet; 206 | 207 | pub fn FcCacheSubdir(c: *const FcCache, i: c_int) -> *const FcChar8; 208 | 209 | pub fn FcCacheNumSubdir(c: *const FcCache) -> c_int; 210 | 211 | pub fn FcCacheNumFont(c: *const FcCache) -> c_int; 212 | 213 | pub fn FcDirCacheUnlink(dir: *const FcChar8, config: *mut FcConfig) -> FcBool; 214 | 215 | pub fn FcDirCacheValid(cache_file: *const FcChar8) -> FcBool; 216 | 217 | pub fn FcConfigHome() -> *mut FcChar8; 218 | 219 | pub fn FcConfigEnableHome(enable: FcBool) -> FcBool; 220 | 221 | pub fn FcConfigFilename(url: *const FcChar8) -> *mut FcChar8; 222 | 223 | pub fn FcConfigCreate() -> *mut FcConfig; 224 | 225 | pub fn FcConfigReference(config: *mut FcConfig) -> *mut FcConfig; 226 | 227 | pub fn FcConfigDestroy(config: *mut FcConfig); 228 | 229 | pub fn FcConfigSetCurrent(config: *mut FcConfig) -> FcBool; 230 | 231 | pub fn FcConfigGetCurrent() -> *mut FcConfig; 232 | 233 | pub fn FcConfigUptoDate(config: *mut FcConfig) -> FcBool; 234 | 235 | pub fn FcConfigBuildFonts(config: *mut FcConfig) -> FcBool; 236 | 237 | pub fn FcConfigGetFontDirs(config: *mut FcConfig) -> *mut FcStrList; 238 | 239 | pub fn FcConfigGetConfigDirs(config: *mut FcConfig) -> *mut FcStrList; 240 | 241 | pub fn FcConfigGetConfigFiles(config: *mut FcConfig) -> *mut FcStrList; 242 | 243 | pub fn FcConfigGetCache(config: *mut FcConfig) -> *mut FcChar8; 244 | 245 | pub fn FcConfigGetBlanks(config: *mut FcConfig) -> *mut FcBlanks; 246 | 247 | pub fn FcConfigGetCacheDirs(config: *const FcConfig) -> *mut FcStrList; 248 | 249 | pub fn FcConfigGetRescanInterval(config: *mut FcConfig) -> c_int; 250 | 251 | pub fn FcConfigSetRescanInterval(config: *mut FcConfig, rescanInterval: c_int) -> FcBool; 252 | 253 | pub fn FcConfigGetFonts(config: *mut FcConfig, set: FcSetName) -> *mut FcFontSet; 254 | 255 | pub fn FcConfigAppFontAddFile(config: *mut FcConfig, file: *const FcChar8) -> FcBool; 256 | 257 | pub fn FcConfigAppFontAddDir(config: *mut FcConfig, dir: *const FcChar8) -> FcBool; 258 | 259 | pub fn FcConfigAppFontClear(config: *mut FcConfig); 260 | 261 | pub fn FcConfigSubstituteWithPat(config: *mut FcConfig, p: *mut FcPattern, p_pat: *mut FcPattern, kind: FcMatchKind) -> FcBool; 262 | 263 | pub fn FcConfigSubstitute(config: *mut FcConfig, p: *mut FcPattern, kind: FcMatchKind) -> FcBool; 264 | 265 | pub fn FcCharSetCreate() -> *mut FcCharSet; 266 | 267 | pub fn FcCharSetNew() -> *mut FcCharSet; 268 | 269 | pub fn FcCharSetDestroy(fcs: *mut FcCharSet); 270 | 271 | pub fn FcCharSetAddChar(fcs: *mut FcCharSet, ucs4: FcChar32) -> FcBool; 272 | 273 | pub fn FcCharSetCopy(src: *mut FcCharSet) -> *mut FcCharSet; 274 | 275 | pub fn FcCharSetEqual(a: *const FcCharSet, b: *const FcCharSet) -> FcBool; 276 | 277 | pub fn FcCharSetIntersect(a: *const FcCharSet, b: *const FcCharSet) -> *mut FcCharSet; 278 | 279 | pub fn FcCharSetUnion(a: *const FcCharSet, b: *const FcCharSet) -> *mut FcCharSet; 280 | 281 | pub fn FcCharSetSubtract(a: *const FcCharSet, b: *const FcCharSet) -> *mut FcCharSet; 282 | 283 | pub fn FcCharSetMerge(a: *mut FcCharSet, b: *const FcCharSet, changed: *mut FcBool) -> FcBool; 284 | 285 | pub fn FcCharSetHasChar(fcs: *const FcCharSet, ucs4: FcChar32) -> FcBool; 286 | 287 | pub fn FcCharSetCount(a: *const FcCharSet) -> FcChar32; 288 | 289 | pub fn FcCharSetIntersectCount(a: *const FcCharSet, b: *const FcCharSet) -> FcChar32; 290 | 291 | pub fn FcCharSetSubtractCount(a: *const FcCharSet, b: *const FcCharSet) -> FcChar32; 292 | 293 | pub fn FcCharSetIsSubset(a: *const FcCharSet, bi: *const FcCharSet) -> FcBool; 294 | 295 | pub fn FcCharSetFirstPage(a: *const FcCharSet, map: *mut FcChar32, next: *mut FcChar32) -> FcChar32; 296 | 297 | pub fn FcCharSetNextPage(a: *const FcCharSet, map: *mut FcChar32, next: *mut FcChar32) -> FcChar32; 298 | 299 | pub fn FcCharSetCoverage(a: *const FcCharSet, page: FcChar32, result: *mut FcChar32) -> FcChar32; 300 | 301 | pub fn FcValuePrint(v: FcValue); 302 | 303 | pub fn FcPatternPrint(p: *const FcPattern); 304 | 305 | pub fn FcFontSetPrint(s: *mut FcFontSet); 306 | 307 | pub fn FcDefaultSubstitute(pattern: *mut FcPattern); 308 | 309 | pub fn FcFileIsDir(file: *const FcChar8) -> FcBool; 310 | 311 | pub fn FcFileScan(set: *mut FcFontSet, dirs: *mut FcStrSet, cache: *mut FcFileCache, blanks: *mut FcBlanks, file: *const FcChar8, force: FcBool) -> FcBool; 312 | 313 | pub fn FcDirScan(set: *mut FcFontSet, dirs: *mut FcStrSet, cache: *mut FcFileCache, blanks: *mut FcBlanks, dir: *const FcChar8, force: FcBool) -> FcBool; 314 | 315 | pub fn FcDirSave(set: *mut FcFontSet, dirs: *const FcStrSet, dir: *mut FcChar8) -> FcBool; 316 | 317 | pub fn FcDirCacheLoad(dir: *const FcChar8, config: *mut FcConfig, cache_file: *mut *mut FcChar8) -> *mut FcCache; 318 | 319 | pub fn FcDirCacheRead(dir: *const FcChar8, force: FcBool, config: *mut FcConfig) -> *mut FcCache; 320 | 321 | //pub fn FcDirCacheLoadFile(cache_file: *mut FcChar8, file_stat: *mut struct_stat) -> *mut FcCache; 322 | 323 | pub fn FcDirCacheUnload(cache: *mut FcCache); 324 | 325 | pub fn FcFreeTypeQuery(file: *const FcChar8, id: c_int, blanks: *mut FcBlanks, count: *mut c_int) -> *mut FcPattern; 326 | 327 | pub fn FcFontSetCreate() -> *mut FcFontSet; 328 | 329 | pub fn FcFontSetDestroy(s: *mut FcFontSet); 330 | 331 | pub fn FcFontSetAdd(s: *mut FcFontSet, font: *mut FcPattern) -> FcBool; 332 | 333 | pub fn FcInitLoadConfig() -> *mut FcConfig; 334 | 335 | pub fn FcInitLoadConfigAndFonts() -> *mut FcConfig; 336 | 337 | pub fn FcInit() -> FcBool; 338 | 339 | pub fn FcFini(); 340 | 341 | pub fn FcGetVersion() -> c_int; 342 | 343 | pub fn FcInitReinitialize() -> FcBool; 344 | 345 | pub fn FcInitBringUptoDate() -> FcBool; 346 | 347 | pub fn FcGetLangs() -> *mut FcStrSet; 348 | 349 | pub fn FcLangGetCharSet(lang: *const FcChar8) -> *mut FcCharSet; 350 | 351 | pub fn FcLangSetCreate() -> *mut FcLangSet; 352 | 353 | pub fn FcLangSetDestroy(ls: *mut FcLangSet); 354 | 355 | pub fn FcLangSetCopy(ls: *const FcLangSet) -> *mut FcLangSet; 356 | 357 | pub fn FcLangSetAdd(ls: *mut FcLangSet, lang: *const FcChar8) -> FcBool; 358 | 359 | pub fn FcLangSetHasLang(ls: *const FcLangSet, lang: *const FcChar8) -> FcLangResult; 360 | 361 | pub fn FcLangSetCompare(lsa: *const FcLangSet, lsb: *const FcLangSet) -> FcLangResult; 362 | 363 | pub fn FcLangSetContains(lsa: *const FcLangSet, lsb: *const FcLangSet) -> FcBool; 364 | 365 | pub fn FcLangSetEqual(lsa: *const FcLangSet, lsb: *const FcLangSet) -> FcBool; 366 | 367 | pub fn FcLangSetHash(ls: *const FcLangSet) -> FcChar32; 368 | 369 | pub fn FcLangSetGetLangs(ls: *const FcLangSet) -> *mut FcStrSet; 370 | 371 | pub fn FcObjectSetCreate() -> *mut FcObjectSet; 372 | 373 | pub fn FcObjectSetAdd(os: *mut FcObjectSet, object: *const c_char) -> FcBool; 374 | 375 | pub fn FcObjectSetDestroy(os: *mut FcObjectSet); 376 | 377 | //pub fn FcObjectSetVaBuild(first: *mut c_char, va: *mut __va_list_tag) -> *mut FcObjectSet; 378 | 379 | pub fn FcObjectSetBuild(first: *mut c_char, ...) -> *mut FcObjectSet; 380 | 381 | pub fn FcFontSetList(config: *mut FcConfig, sets: *mut *mut FcFontSet, nsets: c_int, p: *mut FcPattern, os: *mut FcObjectSet) -> *mut FcFontSet; 382 | 383 | pub fn FcFontList(config: *mut FcConfig, p: *mut FcPattern, os: *mut FcObjectSet) -> *mut FcFontSet; 384 | 385 | pub fn FcAtomicCreate(file: *const FcChar8) -> *mut FcAtomic; 386 | 387 | pub fn FcAtomicLock(atomic: *mut FcAtomic) -> FcBool; 388 | 389 | pub fn FcAtomicNewFile(atomic: *mut FcAtomic) -> *mut FcChar8; 390 | 391 | pub fn FcAtomicOrigFile(atomic: *mut FcAtomic) -> *mut FcChar8; 392 | 393 | pub fn FcAtomicReplaceOrig(atomic: *mut FcAtomic) -> FcBool; 394 | 395 | pub fn FcAtomicDeleteNew(atomic: *mut FcAtomic); 396 | 397 | pub fn FcAtomicUnlock(atomic: *mut FcAtomic); 398 | 399 | pub fn FcAtomicDestroy(atomic: *mut FcAtomic); 400 | 401 | pub fn FcFontSetMatch(config: *mut FcConfig, sets: *mut *mut FcFontSet, nsets: c_int, p: *mut FcPattern, result: *mut FcResult) -> *mut FcPattern; 402 | 403 | pub fn FcFontMatch(config: *mut FcConfig, p: *mut FcPattern, result: *mut FcResult) -> *mut FcPattern; 404 | 405 | pub fn FcFontRenderPrepare(config: *mut FcConfig, pat: *mut FcPattern, font: *mut FcPattern) -> *mut FcPattern; 406 | 407 | pub fn FcFontSetSort(config: *mut FcConfig, sets: *mut *mut FcFontSet, nsets: c_int, p: *mut FcPattern, trim: FcBool, csp: *mut *mut FcCharSet, result: *mut FcResult) -> *mut FcFontSet; 408 | 409 | pub fn FcFontSort(config: *mut FcConfig, p: *mut FcPattern, trim: FcBool, csp: *mut *mut FcCharSet, result: *mut FcResult) -> *mut FcFontSet; 410 | 411 | pub fn FcFontSetSortDestroy(fs: *mut FcFontSet); 412 | 413 | pub fn FcMatrixCopy(mat: *const FcMatrix) -> *mut FcMatrix; 414 | 415 | pub fn FcMatrixEqual(mat1: *const FcMatrix, mat2: *const FcMatrix) -> FcBool; 416 | 417 | pub fn FcMatrixMultiply(result: *mut FcMatrix, a: *const FcMatrix, b: *const FcMatrix); 418 | 419 | pub fn FcMatrixRotate(m: *mut FcMatrix, c: c_double, s: c_double); 420 | 421 | pub fn FcMatrixScale(m: *mut FcMatrix, sx: c_double, sy: c_double); 422 | 423 | pub fn FcMatrixShear(m: *mut FcMatrix, sh: c_double, sv: c_double); 424 | 425 | pub fn FcNameRegisterObjectTypes(types: *const FcObjectType, ntype: c_int) -> FcBool; 426 | 427 | pub fn FcNameUnregisterObjectTypes(types: *const FcObjectType, ntype: c_int) -> FcBool; 428 | 429 | pub fn FcNameGetObjectType(object: *const c_char) -> *const FcObjectType; 430 | 431 | pub fn FcNameRegisterConstants(consts: *const FcConstant, nconsts: c_int) -> FcBool; 432 | 433 | pub fn FcNameUnregisterConstants(consts: *const FcConstant, nconsts: c_int) -> FcBool; 434 | 435 | pub fn FcNameGetConstant(string: *mut FcChar8) -> *const FcConstant; 436 | 437 | pub fn FcNameConstant(string: *mut FcChar8, result: *mut c_int) -> FcBool; 438 | 439 | pub fn FcNameParse(name: *const FcChar8) -> *mut FcPattern; 440 | 441 | pub fn FcNameUnparse(pat: *mut FcPattern) -> *mut FcChar8; 442 | 443 | pub fn FcPatternCreate() -> *mut FcPattern; 444 | 445 | pub fn FcPatternDuplicate(p: *const FcPattern) -> *mut FcPattern; 446 | 447 | pub fn FcPatternReference(p: *mut FcPattern); 448 | 449 | pub fn FcPatternFilter(p: *mut FcPattern, os: *const FcObjectSet) -> *mut FcPattern; 450 | 451 | pub fn FcValueDestroy(v: FcValue); 452 | 453 | pub fn FcValueEqual(va: FcValue, vb: FcValue) -> FcBool; 454 | 455 | pub fn FcValueSave(v: FcValue) -> FcValue; 456 | 457 | pub fn FcPatternDestroy(p: *mut FcPattern); 458 | 459 | pub fn FcPatternEqual(pa: *const FcPattern, pb: *const FcPattern) -> FcBool; 460 | 461 | pub fn FcPatternEqualSubset(pa: *const FcPattern, pb: *const FcPattern, os: *const FcObjectSet) -> FcBool; 462 | 463 | pub fn FcPatternHash(p: *const FcPattern) -> FcChar32; 464 | 465 | pub fn FcPatternAdd(p: *mut FcPattern, object: *const c_char, value: FcValue, append: FcBool) -> FcBool; 466 | 467 | pub fn FcPatternAddWeak(p: *mut FcPattern, object: *const c_char, value: FcValue, append: FcBool) -> FcBool; 468 | 469 | pub fn FcPatternGet(p: *mut FcPattern, object: *const c_char, id: c_int, v: *mut FcValue) -> FcResult; 470 | 471 | pub fn FcPatternDel(p: *mut FcPattern, object: *const c_char) -> FcBool; 472 | 473 | pub fn FcPatternRemove(p: *mut FcPattern, object: *const c_char, id: c_int) -> FcBool; 474 | 475 | pub fn FcPatternAddInteger(p: *mut FcPattern, object: *const c_char, i: c_int) -> FcBool; 476 | 477 | pub fn FcPatternAddDouble(p: *mut FcPattern, object: *const c_char, d: c_double) -> FcBool; 478 | 479 | pub fn FcPatternAddString(p: *mut FcPattern, object: *const c_char, s: *const FcChar8) -> FcBool; 480 | 481 | pub fn FcPatternAddMatrix(p: *mut FcPattern, object: *const c_char, s: *const FcMatrix) -> FcBool; 482 | 483 | pub fn FcPatternAddCharSet(p: *mut FcPattern, object: *const c_char, c: *const FcCharSet) -> FcBool; 484 | 485 | pub fn FcPatternAddBool(p: *mut FcPattern, object: *const c_char, b: FcBool) -> FcBool; 486 | 487 | pub fn FcPatternAddLangSet(p: *mut FcPattern, object: *const c_char, ls: *const FcLangSet) -> FcBool; 488 | 489 | pub fn FcPatternGetInteger(p: *mut FcPattern, object: *const c_char, n: c_int, i: *mut c_int) -> FcResult; 490 | 491 | pub fn FcPatternGetDouble(p: *mut FcPattern, object: *const c_char, n: c_int, d: *mut c_double) -> FcResult; 492 | 493 | pub fn FcPatternGetString(p: *mut FcPattern, object: *const c_char, n: c_int, s: *mut *mut FcChar8) -> FcResult; 494 | 495 | pub fn FcPatternGetMatrix(p: *mut FcPattern, object: *const c_char, n: c_int, s: *mut *mut FcMatrix) -> FcResult; 496 | 497 | pub fn FcPatternGetCharSet(p: *mut FcPattern, object: *const c_char, n: c_int, c: *mut *mut FcCharSet) -> FcResult; 498 | 499 | pub fn FcPatternGetBool(p: *mut FcPattern, object: *const c_char, n: c_int, b: *mut FcBool) -> FcResult; 500 | 501 | pub fn FcPatternGetLangSet(p: *mut FcPattern, object: *const c_char, n: c_int, ls: *mut *mut FcLangSet) -> FcResult; 502 | 503 | //pub fn FcPatternVaBuild(p: *mut FcPattern, va: *mut __va_list_tag) -> *mut FcPattern; 504 | 505 | pub fn FcPatternBuild(p: *mut FcPattern, ...) -> *mut FcPattern; 506 | 507 | pub fn FcPatternFormat(pat: *mut FcPattern, format: *const FcChar8) -> *mut FcChar8; 508 | 509 | pub fn FcStrCopy(s: *const FcChar8) -> *mut FcChar8; 510 | 511 | pub fn FcStrCopyFilename(s: *const FcChar8) -> *mut FcChar8; 512 | 513 | pub fn FcStrPlus(s1: *const FcChar8, s2: *const FcChar8) -> *mut FcChar8; 514 | 515 | pub fn FcStrFree(s: *mut FcChar8); 516 | 517 | pub fn FcStrDowncase(s: *const FcChar8) -> *mut FcChar8; 518 | 519 | pub fn FcStrCmpIgnoreCase(s1: *const FcChar8, s2: *const FcChar8) -> c_int; 520 | 521 | pub fn FcStrCmp(s1: *const FcChar8, s2: *const FcChar8) -> c_int; 522 | 523 | pub fn FcStrStrIgnoreCase(s1: *const FcChar8, s2: *const FcChar8) -> *mut FcChar8; 524 | 525 | pub fn FcStrStr(s1: *const FcChar8, s2: *const FcChar8) -> *mut FcChar8; 526 | 527 | pub fn FcUtf8ToUcs4(src_orig: *mut FcChar8, dst: *mut FcChar32, len: c_int) -> c_int; 528 | 529 | pub fn FcUtf8Len(string: *mut FcChar8, len: c_int, nchar: *mut c_int, wchar: *mut c_int) -> FcBool; 530 | 531 | pub fn FcUcs4ToUtf8(ucs4: FcChar32, dest: *mut FcChar8) -> c_int; 532 | 533 | pub fn FcUtf16ToUcs4(src_orig: *mut FcChar8, endian: FcEndian, dst: *mut FcChar32, len: c_int) -> c_int; 534 | 535 | pub fn FcUtf16Len(string: *mut FcChar8, endian: FcEndian, len: c_int, nchar: *mut c_int, wchar: *mut c_int) -> FcBool; 536 | 537 | pub fn FcStrDirname(file: *const FcChar8) -> *mut FcChar8; 538 | 539 | pub fn FcStrBasename(file: *const FcChar8) -> *mut FcChar8; 540 | 541 | pub fn FcStrSetCreate() -> *mut FcStrSet; 542 | 543 | pub fn FcStrSetMember(set: *mut FcStrSet, s: *const FcChar8) -> FcBool; 544 | 545 | pub fn FcStrSetEqual(sa: *mut FcStrSet, sb: *mut FcStrSet) -> FcBool; 546 | 547 | pub fn FcStrSetAdd(set: *mut FcStrSet, s: *const FcChar8) -> FcBool; 548 | 549 | pub fn FcStrSetAddFilename(set: *mut FcStrSet, s: *const FcChar8) -> FcBool; 550 | 551 | pub fn FcStrSetDel(set: *mut FcStrSet, s: *const FcChar8) -> FcBool; 552 | 553 | pub fn FcStrSetDestroy(set: *mut FcStrSet); 554 | 555 | pub fn FcStrListCreate(set: *mut FcStrSet) -> *mut FcStrList; 556 | 557 | pub fn FcStrListNext(list: *mut FcStrList) -> *mut FcChar8; 558 | 559 | pub fn FcStrListDone(list: *mut FcStrList); 560 | 561 | pub fn FcConfigParseAndLoad(config: *mut FcConfig, file: *const FcChar8, complain: FcBool) -> FcBool; 562 | 563 | } 564 | -------------------------------------------------------------------------------- /src/lib.rs: -------------------------------------------------------------------------------- 1 | // Copyright 2013 The Servo Project Developers. See the COPYRIGHT 2 | // file at the top-level directory of this distribution. 3 | // 4 | // Licensed under the Apache License, Version 2.0 or the MIT license 6 | // , at your 7 | // option. This file may not be copied, modified, or distributed 8 | // except according to those terms. 9 | 10 | #![crate_type = "lib"] 11 | #![crate_type = "dylib"] 12 | #![crate_type = "rlib"] 13 | 14 | extern crate libc; 15 | extern crate fontconfig_sys; 16 | 17 | pub mod fontconfig; 18 | --------------------------------------------------------------------------------