- Я добавил эти файлы в свой src- tauri в папке шрифтов.
- В моем tauri.conf.json я установил "bundle": {"resources": [ Спецификатор "fonts/*"]
- Я проверил каталоги target > debug и папку шрифтов + все файлы шрифтов были созданы
Код: Выделить всё
let resource_path = app_handle
.path()
.resolve(format!("fonts/{}", name), BaseDirectory::Resource)
.expect("failed to resolve resource");
let mut file = File::open(&resource_path).expect(&format!("Failed to open font file {}", resource_path.as_path().to_str().unwrap()));
Код: Выделить всё
10-19 16:22:58.189 19486 19600 I RustStdoutStderr: thread '' panicked at src\lib.rs:85:47:
10-19 16:22:58.189 19486 19600 I RustStdoutStderr: Failed to open font file asset://localhost/fonts/Calibri-Regular.ttf: Os { code: 2, kind: NotFound, message: "No such file or directory" }
Подробнее здесь: https://stackoverflow.com/questions/791 ... on-android
Мобильная версия