mirror of
https://github.com/duhanbalci/dreport.git
synced 2026-07-02 02:49:16 +00:00
faz 5
This commit is contained in:
17
backend/src/typst_engine/fonts.rs
Normal file
17
backend/src/typst_engine/fonts.rs
Normal file
@@ -0,0 +1,17 @@
|
||||
use std::path::PathBuf;
|
||||
use typst_kit::fonts::{FontSearcher, Fonts};
|
||||
|
||||
/// Proje fontlarını yükler (backend/fonts/ dizininden).
|
||||
/// Uygulama başlangıcında bir kez çağrılır ve paylaşılır.
|
||||
pub fn load_fonts() -> Fonts {
|
||||
let font_dir = font_dir();
|
||||
FontSearcher::new()
|
||||
.include_system_fonts(false)
|
||||
.search_with(&[font_dir])
|
||||
}
|
||||
|
||||
fn font_dir() -> PathBuf {
|
||||
// Cargo manifest dizinine göre fonts/ klasörü
|
||||
let manifest_dir = env!("CARGO_MANIFEST_DIR");
|
||||
PathBuf::from(manifest_dir).join("fonts")
|
||||
}
|
||||
Reference in New Issue
Block a user