Files
RedBear-OS/recipes/dev/fontconfig/source/fc-fontations/mod.rs
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

42 lines
1.2 KiB
Rust

extern crate fc_fontations_bindgen;
use fc_fontations_bindgen::{fcint::FcPatternCreate, FcFontSet, FcFontSetAdd};
#[no_mangle]
/// Externally called in fcfontations.c as the file scanner function
/// similar to the job that FreeType performs.
///
/// # Safety
/// * At this point, the font file path is not dereferenced.
/// * In this initial sanity check mock call, only one empty pattern
/// is added to the FontSet, which is null checked, which is sound.
pub unsafe extern "C" fn add_patterns_to_fontset(
_: *const libc::c_char,
font_set: *mut FcFontSet,
) -> libc::c_int {
let empty_pattern = FcPatternCreate();
if !font_set.is_null() {
FcFontSetAdd(
font_set,
empty_pattern as *mut fc_fontations_bindgen::FcPattern,
)
} else {
0
}
}
#[cfg(test)]
mod test {
use crate::add_patterns_to_fontset;
use fc_fontations_bindgen::{FcFontSetCreate, FcFontSetDestroy};
#[test]
fn basic_pattern_construction() {
unsafe {
let font_set = FcFontSetCreate();
assert!(add_patterns_to_fontset(std::ptr::null(), font_set) == 1);
FcFontSetDestroy(font_set);
}
}
}