fontconfig: Branch 'main' - 2 commits

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jun 17 02:18:19 UTC 2025


 Cargo.lock                                   |   13 +++++-
 Cargo.toml                                   |    3 +
 fc-fontations-bindgen/Cargo.lock             |    7 ---
 fc-fontations-bindgen/build.rs               |   40 --------------------
 fc-fontations/attributes.rs                  |   15 ++++---
 fc-fontations/bitmap.rs                      |    2 -
 fc-fontations/fcint-bindings/Cargo.toml      |   10 +++++
 fc-fontations/fcint-bindings/build.rs        |   30 +++++++++++++++
 fc-fontations/fontconfig-bindings/Cargo.toml |    4 +-
 fc-fontations/fontconfig-bindings/build.rs   |   30 +++++++++++++++
 fc-fontations/meson.build                    |   52 ++++++++++++++++-----------
 fc-fontations/mod.rs                         |   28 +++++++-------
 fc-fontations/names.rs                       |    2 -
 fc-fontations/pattern_bindings/fc_wrapper.rs |   14 +++----
 fc-fontations/pattern_bindings/mod.rs        |   25 +++++++-----
 15 files changed, 161 insertions(+), 114 deletions(-)

New commits:
commit f71f39e7da6bccfb5a803a4adcdfe88d382a6eab
Merge: d36de52 7b9f499
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Jun 17 02:18:14 2025 +0000

    Merge branch 'bindingsNames' into 'main'
    
    [Fontations] Do not combine bindings into one crate
    
    See merge request fontconfig/fontconfig!432

commit 7b9f49966f5e81401d1d0f2c0487beb0ea4e572b
Author: Dominik Röttsches <drott at chromium.org>
Date:   Mon Jun 16 12:31:59 2025 +0300

    [Fontations] Do not combine bindings into one crate
    
    When integrating FontConfig with the Chromium build system,
    there it is not easily feasible to compile two generated .rs
    files produced by bindgen into one crate.
    
    Establish two static Rust libraries for the fontconfig.h and
    fcint.h derived Rust bindings.
    
    This cleans up the Rust imports and is more compatible with the
    Chromium bindgen GN targets.
    
    While at it, simplify cargo building by reducing the build.rs
    scripts and moving the bindgen targets.

diff --git a/Cargo.lock b/Cargo.lock
index e067695..6ffb566 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -28,17 +28,19 @@ version = "0.1.0"
 dependencies = [
  "bytemuck",
  "bytemuck_derive",
- "fc-fontations-bindgen",
+ "fcint-bindings",
  "font-types",
+ "fontconfig-bindings",
  "libc",
  "read-fonts",
  "skrifa",
 ]
 
 [[package]]
-name = "fc-fontations-bindgen"
+name = "fcint-bindings"
 version = "0.1.0"
 dependencies = [
+ "fontconfig-bindings",
  "libc",
 ]
 
@@ -51,6 +53,13 @@ dependencies = [
  "bytemuck",
 ]
 
+[[package]]
+name = "fontconfig-bindings"
+version = "0.1.0"
+dependencies = [
+ "libc",
+]
+
 [[package]]
 name = "libc"
 version = "0.2.172"
diff --git a/Cargo.toml b/Cargo.toml
index 15592fa..689c0c0 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,8 @@ version = "0.1.0"
 edition = "2021"
 
 [dependencies]
-fc-fontations-bindgen = { path = "./fc-fontations-bindgen" }
+fontconfig-bindings = { path = "./fc-fontations/fontconfig-bindings" }
+fcint-bindings = { path = "./fc-fontations/fcint-bindings"}
 libc = "0.2.150"
 read-fonts = { version = "0.29", features = [ "experimental_traverse" ]}
 font-types = { version = "0.9", features = ["bytemuck"]}
diff --git a/fc-fontations-bindgen/Cargo.lock b/fc-fontations-bindgen/Cargo.lock
deleted file mode 100644
index 98cf25e..0000000
--- a/fc-fontations-bindgen/Cargo.lock
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file is automatically @generated by Cargo.
-# It is not intended for manual editing.
-version = 3
-
-[[package]]
-name = "fc-fontations-bindgen"
-version = "0.1.0"
diff --git a/fc-fontations-bindgen/build.rs b/fc-fontations-bindgen/build.rs
deleted file mode 100644
index 61877e4..0000000
--- a/fc-fontations-bindgen/build.rs
+++ /dev/null
@@ -1,40 +0,0 @@
-use std::path::PathBuf;
-use std::process::Command;
-
-fn main() {
-    // Directory for the fontconfig build
-    let build_dir = PathBuf::from("build");
-
-    // Configure and build fontconfig using meson
-    let mut meson = Command::new("meson");
-    meson.current_dir("../");
-    meson.arg("setup")
-         .arg(build_dir.to_str().unwrap())
-         .arg("--reconfigure")
-         .arg("--default-library=static")
-         .arg("-Dfontations=enabled");
-
-    let status = meson.status().expect("Failed to execute meson");
-    if !status.success() {
-        panic!("Meson setup failed");
-    }
-
-    let mut ninja = Command::new("ninja");
-    ninja.current_dir("../");
-    ninja.arg("-C").arg(build_dir.to_str().unwrap());
-    let status = ninja.status().expect("Failed to execute ninja");
-    if !status.success() {
-        panic!("Ninja build failed");
-    }
-
-    // Tell cargo to look for fontconfig in the build directory
-    println!("cargo:rustc-link-search=native={}", build_dir.display());
-    println!("cargo:rustc-link-lib=static=fontconfig");
-
-    // FreeType and Expat from the system.
-    println!("cargo:rustc-link-lib=dylib=freetype");
-    println!("cargo:rustc-link-lib=dylib=expat");
-
-    // Rerun this build script if the fontconfig source code changes
-    println!("cargo:rerun-if-changed=src");
-}
diff --git a/fc-fontations/attributes.rs b/fc-fontations/attributes.rs
index 5fd6d7a..f732cb7 100644
--- a/fc-fontations/attributes.rs
+++ b/fc-fontations/attributes.rs
@@ -22,12 +22,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-use fc_fontations_bindgen::{
-    fcint::{
-        FC_DECORATIVE_OBJECT, FC_INDEX_OBJECT, FC_NAMED_INSTANCE_OBJECT, FC_SIZE_OBJECT,
-        FC_SLANT_OBJECT, FC_SPACING_OBJECT, FC_STYLE_OBJECT, FC_VARIABLE_OBJECT, FC_WEIGHT_OBJECT,
-        FC_WIDTH_OBJECT,
-    },
+use fontconfig_bindings::{
     FcWeightFromOpenTypeDouble, FC_DUAL, FC_MONO, FC_SLANT_ITALIC, FC_SLANT_OBLIQUE,
     FC_SLANT_ROMAN, FC_WEIGHT_BLACK, FC_WEIGHT_BOLD, FC_WEIGHT_BOOK, FC_WEIGHT_DEMIBOLD,
     FC_WEIGHT_DEMILIGHT, FC_WEIGHT_EXTRABLACK, FC_WEIGHT_EXTRABOLD, FC_WEIGHT_EXTRALIGHT,
@@ -38,6 +33,12 @@ use fc_fontations_bindgen::{
     FC_WIDTH_SEMIEXPANDED, FC_WIDTH_ULTRACONDENSED, FC_WIDTH_ULTRAEXPANDED,
 };
 
+use fcint_bindings::{
+    FC_DECORATIVE_OBJECT, FC_INDEX_OBJECT, FC_NAMED_INSTANCE_OBJECT, FC_SIZE_OBJECT,
+    FC_SLANT_OBJECT, FC_SPACING_OBJECT, FC_STYLE_OBJECT, FC_VARIABLE_OBJECT, FC_WEIGHT_OBJECT,
+    FC_WIDTH_OBJECT,
+};
+
 use crate::{
     pattern_bindings::{
         fc_wrapper::FcRangeWrapper, FcPatternBuilder, PatternElement, PatternValue,
@@ -661,7 +662,7 @@ pub fn append_style_elements(
 #[cfg(test)]
 mod test {
     use crate::attributes::AttributesToPattern;
-    use fc_fontations_bindgen::{FC_DUAL, FC_MONO};
+    use fontconfig_bindings::{FC_DUAL, FC_MONO};
 
     const THRESHOLD_FACTOR_DOWN: f32 = 1.0 - 1.0 / 33.0;
     const THRESHOLD_FACTOR_UP: f32 = 1.0 + 1.0 / 33.0;
diff --git a/fc-fontations/bitmap.rs b/fc-fontations/bitmap.rs
index 14cc03c..cff0422 100644
--- a/fc-fontations/bitmap.rs
+++ b/fc-fontations/bitmap.rs
@@ -27,7 +27,7 @@ use skrifa::{bitmap::BitmapFormat, FontRef};
 use skrifa::bitmap::BitmapStrikes;
 
 use crate::pattern_bindings::{FcPatternBuilder, PatternElement};
-use fc_fontations_bindgen::fcint::{FC_ANTIALIAS_OBJECT, FC_PIXEL_SIZE_OBJECT};
+use fcint_bindings::{FC_ANTIALIAS_OBJECT, FC_PIXEL_SIZE_OBJECT};
 
 pub fn add_pixel_size(pattern: &mut FcPatternBuilder, font: &FontRef) {
     let strikes = BitmapStrikes::new(font);
diff --git a/fc-fontations/fcint-bindings/Cargo.toml b/fc-fontations/fcint-bindings/Cargo.toml
new file mode 100644
index 0000000..626ad18
--- /dev/null
+++ b/fc-fontations/fcint-bindings/Cargo.toml
@@ -0,0 +1,10 @@
+[package]
+name = "fcint-bindings"
+version = "0.1.0"
+
+[lib]
+path = "../../build/fc-fontations/fcint.rs"
+
+[dependencies]
+libc = "0.2"
+fontconfig-bindings = { path = "../fontconfig-bindings" }
diff --git a/fc-fontations/fcint-bindings/build.rs b/fc-fontations/fcint-bindings/build.rs
new file mode 100644
index 0000000..fb16cc3
--- /dev/null
+++ b/fc-fontations/fcint-bindings/build.rs
@@ -0,0 +1,30 @@
+use std::path::PathBuf;
+use std::fs;
+
+fn main() {
+    // Directory for the fontconfig build
+
+    let cargo_manifest_dir =
+        std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
+
+    let mut build_dir = PathBuf::from(cargo_manifest_dir);
+    build_dir = build_dir.join("../../build");
+    build_dir = fs::canonicalize(build_dir).expect("Failed to canonicalize path.");
+
+    let fontconfig_lib = build_dir.join("libfontconfig.a");
+
+    if !fontconfig_lib.exists() {
+        panic!("{:?} not found, build FontConfig with -Dfontations=enabled into dir build/ first.", fontconfig_lib);
+    }
+
+    // Tell cargo to look for fontconfig in the build directory
+    println!("cargo:rustc-link-search=native={}", build_dir.display());
+    println!("cargo:rustc-link-lib=static=fontconfig");
+
+    // FreeType and Expat from the system.
+    println!("cargo:rustc-link-lib=dylib=freetype");
+    println!("cargo:rustc-link-lib=dylib=expat");
+
+    // Rerun this build script if the fontconfig source code changes
+    println!("cargo:rerun-if-changed=src");
+}
diff --git a/fc-fontations-bindgen/Cargo.toml b/fc-fontations/fontconfig-bindings/Cargo.toml
similarity index 52%
rename from fc-fontations-bindgen/Cargo.toml
rename to fc-fontations/fontconfig-bindings/Cargo.toml
index fafeefc..952483f 100644
--- a/fc-fontations-bindgen/Cargo.toml
+++ b/fc-fontations/fontconfig-bindings/Cargo.toml
@@ -1,10 +1,10 @@
 [package]
-name = "fc-fontations-bindgen"
+name = "fontconfig-bindings"
 version = "0.1.0"
 links = "fontconfig"
 
 [lib]
-path = "../build/fc-fontations/fontconfig.rs"
+path = "../../build/fc-fontations/fontconfig.rs"
 
 [dependencies]
 libc = "0.2"
diff --git a/fc-fontations/fontconfig-bindings/build.rs b/fc-fontations/fontconfig-bindings/build.rs
new file mode 100644
index 0000000..fb16cc3
--- /dev/null
+++ b/fc-fontations/fontconfig-bindings/build.rs
@@ -0,0 +1,30 @@
+use std::path::PathBuf;
+use std::fs;
+
+fn main() {
+    // Directory for the fontconfig build
+
+    let cargo_manifest_dir =
+        std::env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set");
+
+    let mut build_dir = PathBuf::from(cargo_manifest_dir);
+    build_dir = build_dir.join("../../build");
+    build_dir = fs::canonicalize(build_dir).expect("Failed to canonicalize path.");
+
+    let fontconfig_lib = build_dir.join("libfontconfig.a");
+
+    if !fontconfig_lib.exists() {
+        panic!("{:?} not found, build FontConfig with -Dfontations=enabled into dir build/ first.", fontconfig_lib);
+    }
+
+    // Tell cargo to look for fontconfig in the build directory
+    println!("cargo:rustc-link-search=native={}", build_dir.display());
+    println!("cargo:rustc-link-lib=static=fontconfig");
+
+    // FreeType and Expat from the system.
+    println!("cargo:rustc-link-lib=dylib=freetype");
+    println!("cargo:rustc-link-lib=dylib=expat");
+
+    // Rerun this build script if the fontconfig source code changes
+    println!("cargo:rerun-if-changed=src");
+}
diff --git a/fc-fontations/meson.build b/fc-fontations/meson.build
index 5c483f7..0865199 100644
--- a/fc-fontations/meson.build
+++ b/fc-fontations/meson.build
@@ -4,54 +4,64 @@ if (fontations.enabled())
   rust = import('rust')
 
   generated_fontconfig = rust.bindgen(
-    input : fontconfig_h,
-    output : 'fontconfig.rs',
-    include_directories : incbase,
-    args : [
+    input: fontconfig_h,
+    output: 'fontconfig.rs',
+    include_directories: incbase,
+    args: [
       '--merge-extern-blocks',
       '--allowlist-item=(FcCharSet.*|FC_(SLANT|WEIGHT|WIDTH)_.*|FcFontSet(Add|Create|Destroy).*|FcLangSet(Create|Destroy|Copy|Add|HasLang)|FcWeightFromOpenType.*|FC_DUAL|FC_MONO)',
       '--raw-line=#![allow(nonstandard_style,unused)]',
-      '--raw-line= ',
-      '--raw-line=pub mod fcint;',
     ],
     # FC_NO_MT=1 is added here to reduce required headers in bindings generation.
     # It does not mean a functional change in multi-threading behavior.
-    c_args : ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'],
+    c_args: ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'],
   )
 
   generated_fcint = rust.bindgen(
-    input : ['../src/fcint.h', fclang_h],
-    output : 'fcint.rs',
-    include_directories : incbase,
-    args : [
+    input: ['../src/fcint.h', fclang_h],
+    output: 'fcint.rs',
+    include_directories: incbase,
+    args: [
       '--merge-extern-blocks',
       '--allowlist-item=(FcPattern.*|FcRange.*|FC_.*_OBJECT|FcCharSet.*|FcFreeTypeLangSet)',
       '--blocklist-type=(FcCharSet|FcLangSet)',
       '--raw-line=#![allow(nonstandard_style,unused)]',
-      '--raw-line= ',
-      '--raw-line=pub use crate::FcCharSet; pub use crate::FcLangSet;',
+      '--raw-line=extern crate fontconfig_bindings;',
+      '--raw-line=pub use fontconfig_bindings::FcCharSet; pub use fontconfig_bindings::FcLangSet;',
     ],
     # FC_NO_MT=1 is added here to reduce required headers in bindings generation.
     # It does not mean a functional change in multi-threading behavior.
-    c_args : ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'],
+    c_args: ['-DBINDGEN_IGNORE_VISIBILITY=1', '-DFC_NO_MT=1'],
   )
 
-  bindgen_lib = static_library(
-    'fc_fontations_bindgen',
-    sources: [generated_fontconfig, generated_fcint],
-    rust_abi : 'rust',
+  fontations_bindings_lib = static_library(
+    'fontconfig_bindings',
+    sources: [generated_fontconfig],
+    rust_abi: 'rust',
+  )
+
+  fcint_bindings_lib = static_library(
+    'fcint_bindings',
+    sources: [generated_fcint],
+    rust_abi: 'rust',
+    link_with: [fontations_bindings_lib],
   )
 
   fontations_query_lib = static_library(
     'fc_fontations_query',
-    include_directories : incbase,
+    include_directories: incbase,
     sources: ['../src/fcfontations.c', fcstdint_h, fclang_h, alias_headers],
   )
 
   fc_fontations = static_library(
     'fc_fontations',
     sources: ['mod.rs'],
-    link_with: [bindgen_lib, pattern_lib, fontations_query_lib],
+    link_with: [
+      fontations_bindings_lib,
+      fcint_bindings_lib,
+      pattern_lib,
+      fontations_query_lib,
+    ],
     rust_abi: 'c',
     dependencies: [
       dependency('skrifa-0.31-rs'),
@@ -63,4 +73,4 @@ if (fontations.enabled())
 
   )
 
-endif
+endif
\ No newline at end of file
diff --git a/fc-fontations/mod.rs b/fc-fontations/mod.rs
index 8ed2ce3..e55fcd0 100644
--- a/fc-fontations/mod.rs
+++ b/fc-fontations/mod.rs
@@ -40,14 +40,13 @@ use foundries::make_foundry;
 use lang::exclusive_lang;
 use names::add_names;
 
-use fc_fontations_bindgen::{
-    fcint::{
-        FcFreeTypeLangSet, FC_CAPABILITY_OBJECT, FC_CHARSET_OBJECT, FC_COLOR_OBJECT,
-        FC_FILE_OBJECT, FC_FONTFORMAT_OBJECT, FC_FONTVERSION_OBJECT, FC_FONT_HAS_HINT_OBJECT,
-        FC_FONT_WRAPPER_OBJECT, FC_FOUNDRY_OBJECT, FC_LANG_OBJECT, FC_ORDER_OBJECT,
-        FC_OUTLINE_OBJECT, FC_SCALABLE_OBJECT, FC_SYMBOL_OBJECT,
-    },
-    FcFontSet, FcFontSetAdd, FcPattern,
+use fontconfig_bindings::{FcFontSet, FcFontSetAdd, FcPattern};
+
+use fcint_bindings::{
+    FcFreeTypeLangSet, FC_CAPABILITY_OBJECT, FC_CHARSET_OBJECT, FC_COLOR_OBJECT, FC_FILE_OBJECT,
+    FC_FONTFORMAT_OBJECT, FC_FONTVERSION_OBJECT, FC_FONT_HAS_HINT_OBJECT, FC_FONT_WRAPPER_OBJECT,
+    FC_FOUNDRY_OBJECT, FC_LANG_OBJECT, FC_ORDER_OBJECT, FC_OUTLINE_OBJECT, FC_SCALABLE_OBJECT,
+    FC_SYMBOL_OBJECT,
 };
 
 use font_types::Tag;
@@ -86,10 +85,12 @@ pub unsafe extern "C" fn add_patterns_to_fontset(
     let mut patterns_added: u32 = 0;
     for (font, ttc_index) in fonts {
         for pattern in build_patterns_for_font(&font, font_file, ttc_index) {
-            if FcFontSetAdd(font_set, pattern) == 0 {
-                return 0;
+            unsafe {
+                if FcFontSetAdd(font_set, pattern) == 0 {
+                    return 0;
+                }
+                patterns_added += 1;
             }
-            patterns_added += 1;
         }
     }
 
@@ -241,7 +242,8 @@ fn build_patterns_for_font(
 
         unsafe {
             let langset =
-                FcLangSetWrapper::from_raw(FcFreeTypeLangSet(charset.as_ptr(), exclusive_lang));
+                FcLangSetWrapper::from_raw(FcFreeTypeLangSet(charset.as_ptr(), exclusive_lang)
+                    as *mut fontconfig_bindings::_FcLangSet);
 
             pattern.append_element(PatternElement::new(
                 FC_CHARSET_OBJECT as i32,
@@ -307,7 +309,7 @@ fn build_patterns_for_font(
 #[cfg(test)]
 mod test {
     use crate::add_patterns_to_fontset;
-    use fc_fontations_bindgen::{FcFontSetCreate, FcFontSetDestroy};
+    use fontconfig_bindings::{FcFontSetCreate, FcFontSetDestroy};
     use std::ffi::CString;
 
     #[test]
diff --git a/fc-fontations/names.rs b/fc-fontations/names.rs
index 0344db5..c390434 100644
--- a/fc-fontations/names.rs
+++ b/fc-fontations/names.rs
@@ -25,7 +25,7 @@
 use skrifa::string::LocalizedString;
 use skrifa::{string::StringId, MetadataProvider};
 
-use fc_fontations_bindgen::fcint::{
+use fcint_bindings::{
     FC_FAMILYLANG_OBJECT, FC_FAMILY_OBJECT, FC_FULLNAMELANG_OBJECT, FC_FULLNAME_OBJECT,
     FC_INVALID_OBJECT, FC_POSTSCRIPT_NAME_OBJECT, FC_STYLELANG_OBJECT, FC_STYLE_OBJECT,
 };
diff --git a/fc-fontations/pattern_bindings/fc_wrapper.rs b/fc-fontations/pattern_bindings/fc_wrapper.rs
index 0fa727e..317fa7d 100644
--- a/fc-fontations/pattern_bindings/fc_wrapper.rs
+++ b/fc-fontations/pattern_bindings/fc_wrapper.rs
@@ -22,13 +22,11 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-use fc_fontations_bindgen::{
-    fcint::{
-        FcCharSet, FcCharSetCopy, FcCharSetCreate, FcCharSetDestroy, FcLangSet, FcPattern,
-        FcPatternCreate, FcPatternDestroy, FcRange, FcRangeCopy, FcRangeCreateDouble,
-        FcRangeDestroy,
-    },
-    FcCharSetAddChar, FcLangSetCopy, FcLangSetCreate, FcLangSetDestroy,
+use fontconfig_bindings::{FcLangSet, FcLangSetCopy, FcLangSetCreate, FcLangSetDestroy};
+
+use fcint_bindings::{
+    FcCharSet, FcCharSetAddChar, FcCharSetCopy, FcCharSetCreate, FcCharSetDestroy, FcPattern,
+    FcPatternCreate, FcPatternDestroy, FcRange, FcRangeCopy, FcRangeCreateDouble, FcRangeDestroy,
 };
 
 macro_rules! wrap_fc_object {
@@ -169,7 +167,7 @@ wrap_fc_object! {
 impl FcLangSetWrapper {
     #[allow(unused)]
     pub fn new() -> Option<Self> {
-        let created_langset: *mut FcLangSet;
+        let created_langset: *mut fontconfig_bindings::FcLangSet;
         unsafe {
             created_langset = FcLangSetCreate();
         }
diff --git a/fc-fontations/pattern_bindings/mod.rs b/fc-fontations/pattern_bindings/mod.rs
index 826f34b..786bebe 100644
--- a/fc-fontations/pattern_bindings/mod.rs
+++ b/fc-fontations/pattern_bindings/mod.rs
@@ -22,14 +22,12 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-extern crate fc_fontations_bindgen;
-
 pub mod fc_wrapper;
 
 use std::ffi::CString;
 use std::fmt::Debug;
 
-use fc_fontations_bindgen::fcint::{
+use fcint_bindings::{
     FcPattern, FcPatternObjectAddBool, FcPatternObjectAddCharSet, FcPatternObjectAddDouble,
     FcPatternObjectAddInteger, FcPatternObjectAddLangSet, FcPatternObjectAddRange,
     FcPatternObjectAddString, FC_FAMILY_OBJECT, FC_FILE_OBJECT,
@@ -135,7 +133,11 @@ impl PatternElement {
                 FcPatternObjectAddCharSet(pattern, self.object_id, value.into_raw())
             },
             PatternValue::LangSet(value) => unsafe {
-                FcPatternObjectAddLangSet(pattern, self.object_id, value.into_raw())
+                FcPatternObjectAddLangSet(
+                    pattern,
+                    self.object_id,
+                    value.into_raw() as *const fontconfig_bindings::_FcLangSet,
+                )
             },
         } == 1;
         if pattern_add_success {
@@ -211,17 +213,18 @@ mod test {
         fc_wrapper::FcCharSetWrapper, FcPatternBuilder, FcRangeWrapper, PatternElement,
         PatternValue,
     };
-    use fc_fontations_bindgen::{
-        fcint::{
-            FcPatternObjectGetBool, FcPatternObjectGetCharSet, FcPatternObjectGetDouble,
-            FcPatternObjectGetInteger, FcPatternObjectGetLangSet, FcPatternObjectGetRange,
-            FcPatternObjectGetString, FcRange, FC_CHARSET_OBJECT, FC_COLOR_OBJECT,
-            FC_FAMILY_OBJECT, FC_LANG_OBJECT, FC_SLANT_OBJECT, FC_WEIGHT_OBJECT, FC_WIDTH_OBJECT,
-        },
+    use fontconfig_bindings::{
         FcCharSet, FcCharSetAddChar, FcCharSetHasChar, FcLangSet, FcLangSetAdd, FcLangSetHasLang,
         _FcLangResult_FcLangEqual,
     };
 
+    use fcint_bindings::{
+        FcPatternObjectGetBool, FcPatternObjectGetCharSet, FcPatternObjectGetDouble,
+        FcPatternObjectGetInteger, FcPatternObjectGetLangSet, FcPatternObjectGetRange,
+        FcPatternObjectGetString, FcRange, FC_CHARSET_OBJECT, FC_COLOR_OBJECT, FC_FAMILY_OBJECT,
+        FC_LANG_OBJECT, FC_SLANT_OBJECT, FC_WEIGHT_OBJECT, FC_WIDTH_OBJECT,
+    };
+
     #[test]
     fn verify_pattern_bindings() {
         let mut pattern_builder = FcPatternBuilder::new();


More information about the Fontconfig mailing list