| 1 | // Copyright 2013 The Servo Project Developers. See the LICENSE |
| 2 | // file at the top-level directory of this distribution. |
| 3 | // |
| 4 | // Licensed under the the MIT license. This file may not be |
| 5 | // copied, modified, or distributed except according to those terms. |
| 6 | |
| 7 | #![allow (non_upper_case_globals)] |
| 8 | #![allow (non_camel_case_types)] |
| 9 | #![allow (non_snake_case)] |
| 10 | |
| 11 | use std::os::raw::{c_char, c_double, c_int, c_uchar, c_uint, c_ushort, c_void}; |
| 12 | |
| 13 | pub use dlib::ffi_dispatch; |
| 14 | |
| 15 | #[cfg (feature = "dlopen" )] |
| 16 | pub mod statics { |
| 17 | use super::Fc; |
| 18 | use once_cell::sync::Lazy; |
| 19 | |
| 20 | static SONAME: &str = if cfg!(windows) { |
| 21 | "libfontconfig.dll" |
| 22 | } else if cfg!(target_vendor = "apple" ) { |
| 23 | "libfontconfig.dylib.1" |
| 24 | } else { |
| 25 | "libfontconfig.so.1" |
| 26 | }; |
| 27 | |
| 28 | pub static LIB_RESULT: Lazy<Result<Fc, dlib::DlError>> = |
| 29 | Lazy::new(|| unsafe { Fc::open(name:SONAME) }); |
| 30 | |
| 31 | pub static LIB: Lazy<&'static Fc> = Lazy::new(|| LIB_RESULT.as_ref().unwrap()); |
| 32 | } |
| 33 | |
| 34 | pub type FcChar8 = c_uchar; |
| 35 | pub type FcChar16 = c_ushort; |
| 36 | pub type FcChar32 = c_uint; |
| 37 | pub type FcBool = c_int; |
| 38 | |
| 39 | pub type enum__FcType = c_uint; |
| 40 | pub const FcTypeVoid: u32 = 0_u32; |
| 41 | pub const FcTypeInteger: u32 = 1_u32; |
| 42 | pub const FcTypeDouble: u32 = 2_u32; |
| 43 | pub const FcTypeString: u32 = 3_u32; |
| 44 | pub const FcTypeBool: u32 = 4_u32; |
| 45 | pub const FcTypeMatrix: u32 = 5_u32; |
| 46 | pub const FcTypeCharSet: u32 = 6_u32; |
| 47 | pub const FcTypeFTFace: u32 = 7_u32; |
| 48 | pub const FcTypeLangSet: u32 = 8_u32; |
| 49 | |
| 50 | pub type FcType = enum__FcType; |
| 51 | |
| 52 | pub mod constants { |
| 53 | use std::ffi::CStr; |
| 54 | |
| 55 | use super::c_int; |
| 56 | |
| 57 | pub const FC_WEIGHT_THIN: c_int = 0; |
| 58 | pub const FC_WEIGHT_EXTRALIGHT: c_int = 40; |
| 59 | pub const FC_WEIGHT_ULTRALIGHT: c_int = FC_WEIGHT_EXTRALIGHT; |
| 60 | pub const FC_WEIGHT_LIGHT: c_int = 50; |
| 61 | pub const FC_WEIGHT_BOOK: c_int = 75; |
| 62 | pub const FC_WEIGHT_REGULAR: c_int = 80; |
| 63 | pub const FC_WEIGHT_NORMAL: c_int = FC_WEIGHT_REGULAR; |
| 64 | pub const FC_WEIGHT_MEDIUM: c_int = 100; |
| 65 | pub const FC_WEIGHT_DEMIBOLD: c_int = 180; |
| 66 | pub const FC_WEIGHT_SEMIBOLD: c_int = FC_WEIGHT_DEMIBOLD; |
| 67 | pub const FC_WEIGHT_BOLD: c_int = 200; |
| 68 | pub const FC_WEIGHT_EXTRABOLD: c_int = 205; |
| 69 | pub const FC_WEIGHT_ULTRABOLD: c_int = FC_WEIGHT_EXTRABOLD; |
| 70 | pub const FC_WEIGHT_BLACK: c_int = 210; |
| 71 | pub const FC_WEIGHT_HEAVY: c_int = FC_WEIGHT_BLACK; |
| 72 | pub const FC_WEIGHT_EXTRABLACK: c_int = 215; |
| 73 | pub const FC_WEIGHT_ULTRABLACK: c_int = FC_WEIGHT_EXTRABLACK; |
| 74 | |
| 75 | pub const FC_SLANT_ROMAN: c_int = 0; |
| 76 | pub const FC_SLANT_ITALIC: c_int = 100; |
| 77 | pub const FC_SLANT_OBLIQUE: c_int = 110; |
| 78 | |
| 79 | pub const FC_WIDTH_ULTRACONDENSED: c_int = 50; |
| 80 | pub const FC_WIDTH_EXTRACONDENSED: c_int = 63; |
| 81 | pub const FC_WIDTH_CONDENSED: c_int = 75; |
| 82 | pub const FC_WIDTH_SEMICONDENSED: c_int = 87; |
| 83 | pub const FC_WIDTH_NORMAL: c_int = 100; |
| 84 | pub const FC_WIDTH_SEMIEXPANDED: c_int = 113; |
| 85 | pub const FC_WIDTH_EXPANDED: c_int = 125; |
| 86 | pub const FC_WIDTH_EXTRAEXPANDED: c_int = 150; |
| 87 | pub const FC_WIDTH_ULTRAEXPANDED: c_int = 200; |
| 88 | |
| 89 | pub const FC_PROPORTIONAL: c_int = 0; |
| 90 | pub const FC_DUAL: c_int = 90; |
| 91 | pub const FC_MONO: c_int = 100; |
| 92 | pub const FC_CHARCELL: c_int = 110; |
| 93 | |
| 94 | pub const FC_RGBA_UNKNOWN: c_int = 0; |
| 95 | pub const FC_RGBA_RGB: c_int = 1; |
| 96 | pub const FC_RGBA_BGR: c_int = 2; |
| 97 | pub const FC_RGBA_VRGB: c_int = 3; |
| 98 | pub const FC_RGBA_VBGR: c_int = 4; |
| 99 | pub const FC_RGBA_NONE: c_int = 5; |
| 100 | |
| 101 | pub const FC_HINT_NONE: c_int = 0; |
| 102 | pub const FC_HINT_SLIGHT: c_int = 1; |
| 103 | pub const FC_HINT_MEDIUM: c_int = 2; |
| 104 | pub const FC_HINT_FULL: c_int = 3; |
| 105 | |
| 106 | pub const FC_LCD_NONE: c_int = 0; |
| 107 | pub const FC_LCD_DEFAULT: c_int = 1; |
| 108 | pub const FC_LCD_LIGHT: c_int = 2; |
| 109 | pub const FC_LCD_LEGACY: c_int = 3; |
| 110 | |
| 111 | pub const FC_CHARSET_MAP_SIZE: c_int = 8; |
| 112 | pub const FC_CHARSET_DONE: u32 = u32::MAX; |
| 113 | pub const FC_UTF8_MAX_LEN: c_int = 6; |
| 114 | |
| 115 | pub const FC_FAMILY: &CStr = c"family" ; |
| 116 | pub const FC_STYLE: &CStr = c"style" ; |
| 117 | pub const FC_SLANT: &CStr = c"slant" ; |
| 118 | pub const FC_WEIGHT: &CStr = c"weight" ; |
| 119 | pub const FC_SIZE: &CStr = c"size" ; |
| 120 | pub const FC_ASPECT: &CStr = c"aspect" ; |
| 121 | pub const FC_PIXEL_SIZE: &CStr = c"pixelsize" ; |
| 122 | pub const FC_SPACING: &CStr = c"spacing" ; |
| 123 | pub const FC_FOUNDRY: &CStr = c"foundry" ; |
| 124 | pub const FC_ANTIALIAS: &CStr = c"antialias" ; |
| 125 | pub const FC_HINTING: &CStr = c"hinting" ; |
| 126 | pub const FC_HINT_STYLE: &CStr = c"hintstyle" ; |
| 127 | pub const FC_VERTICAL_LAYOUT: &CStr = c"verticallayout" ; |
| 128 | pub const FC_AUTOHINT: &CStr = c"autohint" ; |
| 129 | pub const FC_GLOBAL_ADVANCE: &CStr = c"globaladvance" ; |
| 130 | pub const FC_WIDTH: &CStr = c"width" ; |
| 131 | pub const FC_FILE: &CStr = c"file" ; |
| 132 | pub const FC_INDEX: &CStr = c"index" ; |
| 133 | pub const FC_FT_FACE: &CStr = c"ftface" ; |
| 134 | pub const FC_RASTERIZER: &CStr = c"rasterizer" ; |
| 135 | pub const FC_OUTLINE: &CStr = c"outline" ; |
| 136 | pub const FC_SCALABLE: &CStr = c"scalable" ; |
| 137 | pub const FC_COLOR: &CStr = c"color" ; |
| 138 | pub const FC_VARIABLE: &CStr = c"variable" ; |
| 139 | pub const FC_SCALE: &CStr = c"scale" ; |
| 140 | pub const FC_SYMBOL: &CStr = c"symbol" ; |
| 141 | pub const FC_DPI: &CStr = c"dpi" ; |
| 142 | pub const FC_RGBA: &CStr = c"rgba" ; |
| 143 | pub const FC_MINSPACE: &CStr = c"minspace" ; |
| 144 | pub const FC_SOURCE: &CStr = c"source" ; |
| 145 | pub const FC_CHARSET: &CStr = c"charset" ; |
| 146 | pub const FC_LANG: &CStr = c"lang" ; |
| 147 | pub const FC_FONTVERSION: &CStr = c"fontversion" ; |
| 148 | pub const FC_FULLNAME: &CStr = c"fullname" ; |
| 149 | pub const FC_FAMILYLANG: &CStr = c"familylang" ; |
| 150 | pub const FC_STYLELANG: &CStr = c"stylelang" ; |
| 151 | pub const FC_FULLNAMELANG: &CStr = c"fullnamelang" ; |
| 152 | pub const FC_CAPABILITY: &CStr = c"capability" ; |
| 153 | pub const FC_FONTFORMAT: &CStr = c"fontformat" ; |
| 154 | pub const FC_EMBOLDEN: &CStr = c"embolden" ; |
| 155 | pub const FC_EMBEDDED_BITMAP: &CStr = c"embeddedbitmap" ; |
| 156 | pub const FC_DECORATIVE: &CStr = c"decorative" ; |
| 157 | pub const FC_LCD_FILTER: &CStr = c"lcdfilter" ; |
| 158 | pub const FC_FONT_FEATURES: &CStr = c"fontfeatures" ; |
| 159 | pub const FC_FONT_VARIATIONS: &CStr = c"fontvariations" ; |
| 160 | pub const FC_NAMELANG: &CStr = c"namelang" ; |
| 161 | pub const FC_PRGNAME: &CStr = c"prgname" ; |
| 162 | pub const FC_HASH: &CStr = c"hash" ; |
| 163 | pub const FC_POSTSCRIPT_NAME: &CStr = c"postscriptname" ; |
| 164 | pub const FC_FONT_HAS_HINT: &CStr = c"fonthashint" ; |
| 165 | pub const FC_CACHE_SUFFIX: &CStr = c".cache-" ; |
| 166 | pub const FC_DIR_CACHE_FILE: &CStr = c"fonts.cache-" ; |
| 167 | pub const FC_USER_CACHE_FILE: &CStr = c".fonts.cache-" ; |
| 168 | pub const FC_CHARWIDTH: &CStr = c"charwidth" ; |
| 169 | pub const FC_CHAR_WIDTH: &CStr = c"charwidth" ; |
| 170 | pub const FC_CHAR_HEIGHT: &CStr = c"charheight" ; |
| 171 | pub const FC_MATRIX: &CStr = c"matrix" ; |
| 172 | pub const FC_ORDER: &CStr = c"order" ; |
| 173 | } |
| 174 | |
| 175 | #[repr (C)] |
| 176 | #[derive (Copy, Clone)] |
| 177 | pub struct struct__FcMatrix { |
| 178 | pub xx: c_double, |
| 179 | pub xy: c_double, |
| 180 | pub yx: c_double, |
| 181 | pub yy: c_double, |
| 182 | } |
| 183 | |
| 184 | pub type FcMatrix = struct__FcMatrix; |
| 185 | |
| 186 | pub type struct__FcCharSet = c_void; |
| 187 | |
| 188 | pub type FcCharSet = struct__FcCharSet; |
| 189 | |
| 190 | #[repr (C)] |
| 191 | #[allow (missing_copy_implementations)] |
| 192 | pub struct struct__FcObjectType { |
| 193 | pub object: *mut c_char, |
| 194 | pub _type: FcType, |
| 195 | } |
| 196 | |
| 197 | pub type FcObjectType = struct__FcObjectType; |
| 198 | |
| 199 | #[repr (C)] |
| 200 | #[allow (missing_copy_implementations)] |
| 201 | pub struct struct__FcConstant { |
| 202 | pub name: *mut FcChar8, |
| 203 | pub object: *mut c_char, |
| 204 | pub value: c_int, |
| 205 | } |
| 206 | |
| 207 | pub type FcConstant = struct__FcConstant; |
| 208 | |
| 209 | pub type enum__FcResult = c_uint; |
| 210 | pub const FcResultMatch: u32 = 0_u32; |
| 211 | pub const FcResultNoMatch: u32 = 1_u32; |
| 212 | pub const FcResultTypeMismatch: u32 = 2_u32; |
| 213 | pub const FcResultNoId: u32 = 3_u32; |
| 214 | pub const FcResultOutOfMemory: u32 = 4_u32; |
| 215 | |
| 216 | pub type FcResult = enum__FcResult; |
| 217 | |
| 218 | pub type struct__FcPattern = c_void; |
| 219 | |
| 220 | pub type FcPattern = struct__FcPattern; |
| 221 | |
| 222 | pub type struct__FcLangSet = c_void; |
| 223 | |
| 224 | pub type FcLangSet = struct__FcLangSet; |
| 225 | |
| 226 | #[repr (C)] |
| 227 | #[allow (missing_copy_implementations)] |
| 228 | pub struct struct__FcValue { |
| 229 | pub _type: FcType, |
| 230 | pub u: union_unnamed1, |
| 231 | } |
| 232 | |
| 233 | pub type FcValue = struct__FcValue; |
| 234 | |
| 235 | #[repr (C)] |
| 236 | #[allow (missing_copy_implementations)] |
| 237 | pub struct struct__FcFontSet { |
| 238 | pub nfont: c_int, |
| 239 | pub sfont: c_int, |
| 240 | pub fonts: *mut *mut FcPattern, |
| 241 | } |
| 242 | |
| 243 | pub type FcFontSet = struct__FcFontSet; |
| 244 | |
| 245 | #[repr (C)] |
| 246 | #[allow (missing_copy_implementations)] |
| 247 | pub struct struct__FcObjectSet { |
| 248 | pub nobject: c_int, |
| 249 | pub sobject: c_int, |
| 250 | pub objects: *mut *mut c_char, |
| 251 | } |
| 252 | |
| 253 | pub type FcObjectSet = struct__FcObjectSet; |
| 254 | |
| 255 | pub type enum__FcMatchKind = c_uint; |
| 256 | pub const FcMatchPattern: u32 = 0_u32; |
| 257 | pub const FcMatchFont: u32 = 1_u32; |
| 258 | pub const FcMatchScan: u32 = 2_u32; |
| 259 | |
| 260 | pub type FcMatchKind = enum__FcMatchKind; |
| 261 | |
| 262 | pub type enum__FcLangResult = c_uint; |
| 263 | pub const FcLangEqual: u32 = 0_u32; |
| 264 | pub const FcLangDifferentCountry: u32 = 1_u32; |
| 265 | pub const FcLangDifferentTerritory: u32 = 1_u32; |
| 266 | pub const FcLangDifferentLang: u32 = 2_u32; |
| 267 | |
| 268 | pub type FcLangResult = enum__FcLangResult; |
| 269 | |
| 270 | pub type enum__FcSetName = c_uint; |
| 271 | pub const FcSetSystem: u32 = 0_u32; |
| 272 | pub const FcSetApplication: u32 = 1_u32; |
| 273 | |
| 274 | pub type FcSetName = enum__FcSetName; |
| 275 | |
| 276 | pub type struct__FcAtomic = c_void; |
| 277 | |
| 278 | pub type FcAtomic = struct__FcAtomic; |
| 279 | |
| 280 | pub type FcEndian = c_uint; |
| 281 | pub const FcEndianBig: u32 = 0_u32; |
| 282 | pub const FcEndianLittle: u32 = 1_u32; |
| 283 | |
| 284 | pub type struct__FcConfig = c_void; |
| 285 | |
| 286 | pub type FcConfig = struct__FcConfig; |
| 287 | |
| 288 | pub type struct__FcGlobalCache = c_void; |
| 289 | |
| 290 | pub type FcFileCache = struct__FcGlobalCache; |
| 291 | |
| 292 | pub type struct__FcBlanks = c_void; |
| 293 | |
| 294 | pub type FcBlanks = struct__FcBlanks; |
| 295 | |
| 296 | pub type struct__FcStrList = c_void; |
| 297 | |
| 298 | pub type FcStrList = struct__FcStrList; |
| 299 | |
| 300 | pub type struct__FcStrSet = c_void; |
| 301 | |
| 302 | pub type FcStrSet = struct__FcStrSet; |
| 303 | |
| 304 | pub type struct__FcCache = c_void; |
| 305 | |
| 306 | pub type FcCache = struct__FcCache; |
| 307 | |
| 308 | pub type union_unnamed1 = c_void; |
| 309 | |
| 310 | dlib::external_library!(Fc, "fontconfig" , |
| 311 | functions: |
| 312 | fn FcBlanksCreate() -> *mut FcBlanks, |
| 313 | |
| 314 | fn FcBlanksDestroy(*mut FcBlanks) -> (), |
| 315 | |
| 316 | fn FcBlanksAdd(*mut FcBlanks, FcChar32) -> FcBool, |
| 317 | |
| 318 | fn FcBlanksIsMember(*mut FcBlanks, FcChar32) -> FcBool, |
| 319 | |
| 320 | fn FcCacheDir(*mut FcCache) -> *const FcChar8, |
| 321 | |
| 322 | fn FcCacheCopySet(*const FcCache) -> *mut FcFontSet, |
| 323 | |
| 324 | fn FcCacheSubdir(*const FcCache, c_int) -> *const FcChar8, |
| 325 | |
| 326 | fn FcCacheNumSubdir(*const FcCache) -> c_int, |
| 327 | |
| 328 | fn FcCacheNumFont(*const FcCache) -> c_int, |
| 329 | |
| 330 | fn FcDirCacheUnlink(*const FcChar8, *mut FcConfig) -> FcBool, |
| 331 | |
| 332 | fn FcDirCacheValid(*const FcChar8) -> FcBool, |
| 333 | |
| 334 | fn FcConfigHome() -> *mut FcChar8, |
| 335 | |
| 336 | fn FcConfigEnableHome(FcBool) -> FcBool, |
| 337 | |
| 338 | fn FcConfigFilename(*const FcChar8) -> *mut FcChar8, |
| 339 | |
| 340 | fn FcConfigCreate() -> *mut FcConfig, |
| 341 | |
| 342 | fn FcConfigReference(*mut FcConfig) -> *mut FcConfig, |
| 343 | |
| 344 | fn FcConfigDestroy(*mut FcConfig) -> (), |
| 345 | |
| 346 | fn FcConfigSetCurrent(*mut FcConfig) -> FcBool, |
| 347 | |
| 348 | fn FcConfigGetCurrent() -> *mut FcConfig, |
| 349 | |
| 350 | fn FcConfigUptoDate(*mut FcConfig) -> FcBool, |
| 351 | |
| 352 | fn FcConfigBuildFonts(*mut FcConfig) -> FcBool, |
| 353 | |
| 354 | fn FcConfigGetFontDirs(*mut FcConfig) -> *mut FcStrList, |
| 355 | |
| 356 | fn FcConfigGetConfigDirs(*mut FcConfig) -> *mut FcStrList, |
| 357 | |
| 358 | fn FcConfigGetConfigFiles(*mut FcConfig) -> *mut FcStrList, |
| 359 | |
| 360 | fn FcConfigGetCache(*mut FcConfig) -> *mut FcChar8, |
| 361 | |
| 362 | fn FcConfigGetBlanks(*mut FcConfig) -> *mut FcBlanks, |
| 363 | |
| 364 | fn FcConfigGetCacheDirs(*const FcConfig) -> *mut FcStrList, |
| 365 | |
| 366 | fn FcConfigGetRescanInterval(*mut FcConfig) -> c_int, |
| 367 | |
| 368 | fn FcConfigSetRescanInterval(*mut FcConfig, c_int) -> FcBool, |
| 369 | |
| 370 | fn FcConfigGetFonts(*mut FcConfig, FcSetName) -> *mut FcFontSet, |
| 371 | |
| 372 | fn FcConfigAppFontAddFile(*mut FcConfig, *const FcChar8) -> FcBool, |
| 373 | |
| 374 | fn FcConfigAppFontAddDir(*mut FcConfig, *const FcChar8) -> FcBool, |
| 375 | |
| 376 | fn FcConfigAppFontClear(*mut FcConfig) -> (), |
| 377 | |
| 378 | fn FcConfigSubstituteWithPat( |
| 379 | *mut FcConfig, |
| 380 | *mut FcPattern, |
| 381 | *mut FcPattern, |
| 382 | FcMatchKind |
| 383 | ) -> FcBool, |
| 384 | |
| 385 | fn FcConfigSubstitute( |
| 386 | *mut FcConfig, |
| 387 | *mut FcPattern, |
| 388 | FcMatchKind |
| 389 | ) -> FcBool, |
| 390 | |
| 391 | fn FcCharSetCreate() -> *mut FcCharSet, |
| 392 | |
| 393 | fn FcCharSetNew() -> *mut FcCharSet, |
| 394 | |
| 395 | fn FcCharSetDestroy(*mut FcCharSet) -> (), |
| 396 | |
| 397 | fn FcCharSetAddChar(*mut FcCharSet, FcChar32) -> FcBool, |
| 398 | |
| 399 | fn FcCharSetDelChar(*mut FcCharSet, FcChar32) -> FcBool, |
| 400 | |
| 401 | fn FcCharSetCopy(*mut FcCharSet) -> *mut FcCharSet, |
| 402 | |
| 403 | fn FcCharSetEqual(*const FcCharSet, *const FcCharSet) -> FcBool, |
| 404 | |
| 405 | fn FcCharSetIntersect(*const FcCharSet, *const FcCharSet) -> *mut FcCharSet, |
| 406 | |
| 407 | fn FcCharSetUnion(*const FcCharSet, *const FcCharSet) -> *mut FcCharSet, |
| 408 | |
| 409 | fn FcCharSetSubtract(*const FcCharSet, *const FcCharSet) -> *mut FcCharSet, |
| 410 | |
| 411 | fn FcCharSetMerge(*mut FcCharSet, *const FcCharSet, *mut FcBool) -> FcBool, |
| 412 | |
| 413 | fn FcCharSetHasChar(*const FcCharSet, FcChar32) -> FcBool, |
| 414 | |
| 415 | fn FcCharSetCount(*const FcCharSet) -> FcChar32, |
| 416 | |
| 417 | fn FcCharSetIntersectCount(*const FcCharSet, *const FcCharSet) -> FcChar32, |
| 418 | |
| 419 | fn FcCharSetSubtractCount(*const FcCharSet, *const FcCharSet) -> FcChar32, |
| 420 | |
| 421 | fn FcCharSetIsSubset(*const FcCharSet, *const FcCharSet) -> FcBool, |
| 422 | |
| 423 | fn FcCharSetFirstPage( |
| 424 | *const FcCharSet, |
| 425 | *mut FcChar32, |
| 426 | *mut FcChar32 |
| 427 | ) -> FcChar32, |
| 428 | |
| 429 | fn FcCharSetNextPage( |
| 430 | *const FcCharSet, |
| 431 | *mut FcChar32, |
| 432 | *mut FcChar32 |
| 433 | ) -> FcChar32, |
| 434 | |
| 435 | fn FcCharSetCoverage( |
| 436 | *const FcCharSet, |
| 437 | FcChar32, |
| 438 | *mut FcChar32 |
| 439 | ) -> FcChar32, |
| 440 | |
| 441 | fn FcValuePrint(FcValue) -> (), |
| 442 | |
| 443 | fn FcPatternPrint(*const FcPattern) -> (), |
| 444 | |
| 445 | fn FcFontSetPrint(*mut FcFontSet) -> (), |
| 446 | |
| 447 | fn FcDefaultSubstitute(*mut FcPattern) -> (), |
| 448 | |
| 449 | fn FcFileIsDir(*const FcChar8) -> FcBool, |
| 450 | |
| 451 | fn FcFileScan( |
| 452 | *mut FcFontSet, |
| 453 | *mut FcStrSet, |
| 454 | *mut FcFileCache, |
| 455 | *mut FcBlanks, |
| 456 | *const FcChar8, |
| 457 | FcBool |
| 458 | ) -> FcBool, |
| 459 | |
| 460 | fn FcDirScan( |
| 461 | *mut FcFontSet, |
| 462 | *mut FcStrSet, |
| 463 | *mut FcFileCache, |
| 464 | *mut FcBlanks, |
| 465 | *const FcChar8, |
| 466 | FcBool |
| 467 | ) -> FcBool, |
| 468 | |
| 469 | fn FcDirSave(*mut FcFontSet, *const FcStrSet, *mut FcChar8) -> FcBool, |
| 470 | |
| 471 | fn FcDirCacheLoad( |
| 472 | *const FcChar8, |
| 473 | *mut FcConfig, |
| 474 | *mut *mut FcChar8 |
| 475 | ) -> *mut FcCache, |
| 476 | |
| 477 | fn FcDirCacheRead( |
| 478 | *const FcChar8, |
| 479 | FcBool, |
| 480 | *mut FcConfig |
| 481 | ) -> *mut FcCache, |
| 482 | |
| 483 | // fn FcDirCacheLoadFile(*mut FcChar8, *mut struct_stat) -> *mut FcCache, |
| 484 | |
| 485 | fn FcDirCacheUnload(*mut FcCache) -> (), |
| 486 | |
| 487 | fn FcFreeTypeQuery( |
| 488 | *const FcChar8, |
| 489 | c_int, |
| 490 | *mut FcBlanks, |
| 491 | *mut c_int |
| 492 | ) -> *mut FcPattern, |
| 493 | |
| 494 | fn FcFontSetCreate() -> *mut FcFontSet, |
| 495 | |
| 496 | fn FcFontSetDestroy(*mut FcFontSet) -> (), |
| 497 | |
| 498 | fn FcFontSetAdd(*mut FcFontSet, *mut FcPattern) -> FcBool, |
| 499 | |
| 500 | fn FcInitLoadConfig() -> *mut FcConfig, |
| 501 | |
| 502 | fn FcInitLoadConfigAndFonts() -> *mut FcConfig, |
| 503 | |
| 504 | fn FcInit() -> FcBool, |
| 505 | |
| 506 | fn FcFini() -> (), |
| 507 | |
| 508 | fn FcGetVersion() -> c_int, |
| 509 | |
| 510 | fn FcInitReinitialize() -> FcBool, |
| 511 | |
| 512 | fn FcInitBringUptoDate() -> FcBool, |
| 513 | |
| 514 | fn FcGetLangs() -> *mut FcStrSet, |
| 515 | |
| 516 | fn FcLangGetCharSet(*const FcChar8) -> *mut FcCharSet, |
| 517 | |
| 518 | fn FcLangSetCreate() -> *mut FcLangSet, |
| 519 | |
| 520 | fn FcLangSetDestroy(*mut FcLangSet) -> (), |
| 521 | |
| 522 | fn FcLangSetCopy(*const FcLangSet) -> *mut FcLangSet, |
| 523 | |
| 524 | fn FcLangSetAdd(*mut FcLangSet, *const FcChar8) -> FcBool, |
| 525 | |
| 526 | fn FcLangSetHasLang(*const FcLangSet, *const FcChar8) -> FcLangResult, |
| 527 | |
| 528 | fn FcLangSetCompare(*const FcLangSet, *const FcLangSet) -> FcLangResult, |
| 529 | |
| 530 | fn FcLangSetContains(*const FcLangSet, *const FcLangSet) -> FcBool, |
| 531 | |
| 532 | fn FcLangSetEqual(*const FcLangSet, *const FcLangSet) -> FcBool, |
| 533 | |
| 534 | fn FcLangSetHash(*const FcLangSet) -> FcChar32, |
| 535 | |
| 536 | fn FcLangSetGetLangs(*const FcLangSet) -> *mut FcStrSet, |
| 537 | |
| 538 | fn FcObjectSetCreate() -> *mut FcObjectSet, |
| 539 | |
| 540 | fn FcObjectSetAdd(*mut FcObjectSet, *const c_char) -> FcBool, |
| 541 | |
| 542 | fn FcObjectSetDestroy(*mut FcObjectSet) -> (), |
| 543 | |
| 544 | // fn FcObjectSetVaBuild(*mut c_char, *mut __va_list_tag) -> *mut FcObjectSet, |
| 545 | |
| 546 | fn FcFontSetList( |
| 547 | *mut FcConfig, |
| 548 | *mut *mut FcFontSet, |
| 549 | c_int, |
| 550 | *mut FcPattern, |
| 551 | *mut FcObjectSet |
| 552 | ) -> *mut FcFontSet, |
| 553 | |
| 554 | fn FcFontList( |
| 555 | *mut FcConfig, |
| 556 | *mut FcPattern, |
| 557 | *mut FcObjectSet |
| 558 | ) -> *mut FcFontSet, |
| 559 | |
| 560 | fn FcAtomicCreate(*const FcChar8) -> *mut FcAtomic, |
| 561 | |
| 562 | fn FcAtomicLock(*mut FcAtomic) -> FcBool, |
| 563 | |
| 564 | fn FcAtomicNewFile(*mut FcAtomic) -> *mut FcChar8, |
| 565 | |
| 566 | fn FcAtomicOrigFile(*mut FcAtomic) -> *mut FcChar8, |
| 567 | |
| 568 | fn FcAtomicReplaceOrig(*mut FcAtomic) -> FcBool, |
| 569 | |
| 570 | fn FcAtomicDeleteNew(*mut FcAtomic) -> (), |
| 571 | |
| 572 | fn FcAtomicUnlock(*mut FcAtomic) -> (), |
| 573 | |
| 574 | fn FcAtomicDestroy(*mut FcAtomic) -> (), |
| 575 | |
| 576 | fn FcFontSetMatch( |
| 577 | *mut FcConfig, |
| 578 | *mut *mut FcFontSet, |
| 579 | c_int, |
| 580 | *mut FcPattern, |
| 581 | *mut FcResult |
| 582 | ) -> *mut FcPattern, |
| 583 | |
| 584 | fn FcFontMatch( |
| 585 | *mut FcConfig, |
| 586 | *mut FcPattern, |
| 587 | *mut FcResult |
| 588 | ) -> *mut FcPattern, |
| 589 | |
| 590 | fn FcFontRenderPrepare( |
| 591 | *mut FcConfig, |
| 592 | *mut FcPattern, |
| 593 | *mut FcPattern |
| 594 | ) -> *mut FcPattern, |
| 595 | |
| 596 | fn FcFontSetSort( |
| 597 | *mut FcConfig, |
| 598 | *mut *mut FcFontSet, |
| 599 | c_int, |
| 600 | *mut FcPattern, |
| 601 | FcBool, |
| 602 | *mut *mut FcCharSet, |
| 603 | *mut FcResult |
| 604 | ) -> *mut FcFontSet, |
| 605 | |
| 606 | fn FcFontSort( |
| 607 | *mut FcConfig, |
| 608 | *mut FcPattern, |
| 609 | FcBool, |
| 610 | *mut *mut FcCharSet, |
| 611 | *mut FcResult |
| 612 | ) -> *mut FcFontSet, |
| 613 | |
| 614 | fn FcFontSetSortDestroy(*mut FcFontSet) -> (), |
| 615 | |
| 616 | fn FcMatrixCopy(*const FcMatrix) -> *mut FcMatrix, |
| 617 | |
| 618 | fn FcMatrixEqual(*const FcMatrix, *const FcMatrix) -> FcBool, |
| 619 | |
| 620 | fn FcMatrixMultiply(*mut FcMatrix, *const FcMatrix, *const FcMatrix) -> (), |
| 621 | |
| 622 | fn FcMatrixRotate(*mut FcMatrix, c_double, c_double) -> (), |
| 623 | |
| 624 | fn FcMatrixScale(*mut FcMatrix, c_double, c_double) -> (), |
| 625 | |
| 626 | fn FcMatrixShear(*mut FcMatrix, c_double, c_double) -> (), |
| 627 | |
| 628 | fn FcNameRegisterObjectTypes(*const FcObjectType, c_int) -> FcBool, |
| 629 | |
| 630 | fn FcNameUnregisterObjectTypes(*const FcObjectType, c_int) -> FcBool, |
| 631 | |
| 632 | fn FcNameGetObjectType(*const c_char) -> *const FcObjectType, |
| 633 | |
| 634 | fn FcNameRegisterConstants(*const FcConstant, c_int) -> FcBool, |
| 635 | |
| 636 | fn FcNameUnregisterConstants(*const FcConstant, c_int) -> FcBool, |
| 637 | |
| 638 | fn FcNameGetConstant(*mut FcChar8) -> *const FcConstant, |
| 639 | |
| 640 | fn FcNameConstant(*mut FcChar8, *mut c_int) -> FcBool, |
| 641 | |
| 642 | fn FcNameParse(*const FcChar8) -> *mut FcPattern, |
| 643 | |
| 644 | fn FcNameUnparse(*mut FcPattern) -> *mut FcChar8, |
| 645 | |
| 646 | fn FcPatternCreate() -> *mut FcPattern, |
| 647 | |
| 648 | fn FcPatternDuplicate(*const FcPattern) -> *mut FcPattern, |
| 649 | |
| 650 | fn FcPatternReference(*mut FcPattern) -> (), |
| 651 | |
| 652 | fn FcPatternFilter(*mut FcPattern, *const FcObjectSet) -> *mut FcPattern, |
| 653 | |
| 654 | fn FcValueDestroy(FcValue) -> (), |
| 655 | |
| 656 | fn FcValueEqual(FcValue, FcValue) -> FcBool, |
| 657 | |
| 658 | fn FcValueSave(FcValue) -> FcValue, |
| 659 | |
| 660 | fn FcPatternDestroy(*mut FcPattern) -> (), |
| 661 | |
| 662 | fn FcPatternEqual(*const FcPattern, *const FcPattern) -> FcBool, |
| 663 | |
| 664 | fn FcPatternEqualSubset( |
| 665 | *const FcPattern, |
| 666 | *const FcPattern, |
| 667 | *const FcObjectSet |
| 668 | ) -> FcBool, |
| 669 | |
| 670 | fn FcPatternHash(*const FcPattern) -> FcChar32, |
| 671 | |
| 672 | fn FcPatternAdd( |
| 673 | *mut FcPattern, |
| 674 | *const c_char, |
| 675 | FcValue, |
| 676 | FcBool |
| 677 | ) -> FcBool, |
| 678 | |
| 679 | fn FcPatternAddWeak( |
| 680 | *mut FcPattern, |
| 681 | *const c_char, |
| 682 | FcValue, |
| 683 | FcBool |
| 684 | ) -> FcBool, |
| 685 | |
| 686 | fn FcPatternGet( |
| 687 | *mut FcPattern, |
| 688 | *const c_char, |
| 689 | c_int, |
| 690 | *mut FcValue |
| 691 | ) -> FcResult, |
| 692 | |
| 693 | fn FcPatternDel(*mut FcPattern, *const c_char) -> FcBool, |
| 694 | |
| 695 | fn FcPatternRemove(*mut FcPattern, *const c_char, c_int) -> FcBool, |
| 696 | |
| 697 | fn FcPatternAddInteger(*mut FcPattern, *const c_char, c_int) -> FcBool, |
| 698 | |
| 699 | fn FcPatternAddDouble(*mut FcPattern, *const c_char, c_double) -> FcBool, |
| 700 | |
| 701 | fn FcPatternAddString( |
| 702 | *mut FcPattern, |
| 703 | *const c_char, |
| 704 | *const FcChar8 |
| 705 | ) -> FcBool, |
| 706 | |
| 707 | fn FcPatternAddMatrix( |
| 708 | *mut FcPattern, |
| 709 | *const c_char, |
| 710 | *const FcMatrix |
| 711 | ) -> FcBool, |
| 712 | |
| 713 | fn FcPatternAddCharSet( |
| 714 | *mut FcPattern, |
| 715 | *const c_char, |
| 716 | *const FcCharSet |
| 717 | ) -> FcBool, |
| 718 | |
| 719 | fn FcPatternAddBool(*mut FcPattern, *const c_char, FcBool) -> FcBool, |
| 720 | |
| 721 | fn FcPatternAddLangSet( |
| 722 | *mut FcPattern, |
| 723 | *const c_char, |
| 724 | *const FcLangSet |
| 725 | ) -> FcBool, |
| 726 | |
| 727 | fn FcPatternGetInteger( |
| 728 | *mut FcPattern, |
| 729 | *const c_char, |
| 730 | c_int, |
| 731 | *mut c_int |
| 732 | ) -> FcResult, |
| 733 | |
| 734 | fn FcPatternGetDouble( |
| 735 | *mut FcPattern, |
| 736 | *const c_char, |
| 737 | c_int, |
| 738 | *mut c_double |
| 739 | ) -> FcResult, |
| 740 | |
| 741 | fn FcPatternGetString( |
| 742 | *mut FcPattern, |
| 743 | *const c_char, |
| 744 | c_int, |
| 745 | *mut *mut FcChar8 |
| 746 | ) -> FcResult, |
| 747 | |
| 748 | fn FcPatternGetMatrix( |
| 749 | *mut FcPattern, |
| 750 | *const c_char, |
| 751 | c_int, |
| 752 | *mut *mut FcMatrix |
| 753 | ) -> FcResult, |
| 754 | |
| 755 | fn FcPatternGetCharSet( |
| 756 | *mut FcPattern, |
| 757 | *const c_char, |
| 758 | c_int, |
| 759 | *mut *mut FcCharSet |
| 760 | ) -> FcResult, |
| 761 | |
| 762 | fn FcPatternGetBool( |
| 763 | *mut FcPattern, |
| 764 | *const c_char, |
| 765 | c_int, |
| 766 | *mut FcBool |
| 767 | ) -> FcResult, |
| 768 | |
| 769 | fn FcPatternGetLangSet( |
| 770 | *mut FcPattern, |
| 771 | *const c_char, |
| 772 | c_int, |
| 773 | *mut *mut FcLangSet |
| 774 | ) -> FcResult, |
| 775 | |
| 776 | // The last argument is a pointer to a FreeType Face object (`FT_Face *`) |
| 777 | // |
| 778 | // <https://freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_face> |
| 779 | fn FcPatternGetFTFace(*mut FcPattern, *const c_char, c_int, *mut *mut c_void) -> FcResult, |
| 780 | |
| 781 | // fn FcPatternVaBuild(*mut FcPattern, *mut __va_list_tag) -> *mut FcPattern, |
| 782 | |
| 783 | fn FcPatternFormat(*mut FcPattern, *const FcChar8) -> *mut FcChar8, |
| 784 | |
| 785 | fn FcStrCopy(*const FcChar8) -> *mut FcChar8, |
| 786 | |
| 787 | fn FcStrCopyFilename(*const FcChar8) -> *mut FcChar8, |
| 788 | |
| 789 | fn FcStrPlus(*const FcChar8, *const FcChar8) -> *mut FcChar8, |
| 790 | |
| 791 | fn FcStrFree(*mut FcChar8) -> (), |
| 792 | |
| 793 | fn FcStrDowncase(*const FcChar8) -> *mut FcChar8, |
| 794 | |
| 795 | fn FcStrCmpIgnoreCase(*const FcChar8, *const FcChar8) -> c_int, |
| 796 | |
| 797 | fn FcStrCmp(*const FcChar8, *const FcChar8) -> c_int, |
| 798 | |
| 799 | fn FcStrStrIgnoreCase(*const FcChar8, *const FcChar8) -> *mut FcChar8, |
| 800 | |
| 801 | fn FcStrStr(*const FcChar8, *const FcChar8) -> *mut FcChar8, |
| 802 | |
| 803 | fn FcUtf8ToUcs4(*mut FcChar8, *mut FcChar32, c_int) -> c_int, |
| 804 | |
| 805 | fn FcUtf8Len( |
| 806 | *mut FcChar8, |
| 807 | c_int, |
| 808 | *mut c_int, |
| 809 | *mut c_int |
| 810 | ) -> FcBool, |
| 811 | |
| 812 | fn FcUcs4ToUtf8(FcChar32, *mut FcChar8) -> c_int, |
| 813 | |
| 814 | fn FcUtf16ToUcs4( |
| 815 | *mut FcChar8, |
| 816 | FcEndian, |
| 817 | *mut FcChar32, |
| 818 | c_int |
| 819 | ) -> c_int, |
| 820 | |
| 821 | fn FcUtf16Len( |
| 822 | *mut FcChar8, |
| 823 | FcEndian, |
| 824 | c_int, |
| 825 | *mut c_int, |
| 826 | *mut c_int |
| 827 | ) -> FcBool, |
| 828 | |
| 829 | fn FcStrDirname(*const FcChar8) -> *mut FcChar8, |
| 830 | |
| 831 | fn FcStrBasename(*const FcChar8) -> *mut FcChar8, |
| 832 | |
| 833 | fn FcStrSetCreate() -> *mut FcStrSet, |
| 834 | |
| 835 | fn FcStrSetMember(*mut FcStrSet, *const FcChar8) -> FcBool, |
| 836 | |
| 837 | fn FcStrSetEqual(*mut FcStrSet, *mut FcStrSet) -> FcBool, |
| 838 | |
| 839 | fn FcStrSetAdd(*mut FcStrSet, *const FcChar8) -> FcBool, |
| 840 | |
| 841 | fn FcStrSetAddFilename(*mut FcStrSet, *const FcChar8) -> FcBool, |
| 842 | |
| 843 | fn FcStrSetDel(*mut FcStrSet, *const FcChar8) -> FcBool, |
| 844 | |
| 845 | fn FcStrSetDestroy(*mut FcStrSet) -> (), |
| 846 | |
| 847 | fn FcStrListCreate(*mut FcStrSet) -> *mut FcStrList, |
| 848 | |
| 849 | fn FcStrListNext(*mut FcStrList) -> *mut FcChar8, |
| 850 | |
| 851 | fn FcStrListDone(*mut FcStrList) -> (), |
| 852 | |
| 853 | fn FcConfigParseAndLoad( |
| 854 | *mut FcConfig, |
| 855 | *const FcChar8, |
| 856 | FcBool |
| 857 | ) -> FcBool, |
| 858 | |
| 859 | varargs: |
| 860 | fn FcPatternBuild(*mut FcPattern) -> *mut FcPattern, |
| 861 | fn FcObjectSetBuild(*mut c_char) -> *mut FcObjectSet, |
| 862 | ); |
| 863 | |