[GH-ISSUE #401] linux-rust : Compiling from source archive fails because of missing DejaVuSans.ttf #194

Open
opened 2026-03-02 12:04:21 +03:00 by kerem · 0 comments
Owner

Originally created by @d0tiKs on GitHub (Dec 24, 2025).
Original GitHub issue: https://github.com/kavishdevar/librepods/issues/401

When trying to build from source using the tar.gz available to download I got this message :

❯ cargo build -r 2>| grep error -A 8
error: couldn't read `src/ui/../../assets/font/DejaVuSans.ttf`: No such file or directory (os error 2)
   --> src/ui/tray.rs:176:21
    |
176 |     let font_data = include_bytes!("../../assets/font/DejaVuSans.ttf");
    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

warning: unused import: `crate::bluetooth::att::ATTManager`
 --> src/devices/airpods.rs:3:5
  |
--
error: could not compile `librepods` (bin "librepods") due to 1 previous error; 13 warnings emitted

I think the path to the font asset should be different, putting the font availability as a requirement and using the standard path for font /usr/share/fonts/TTF/ could be a way to fix it (in linux-rust/src/ui/tray.rs ).

fn generate_icon(text: &str, text_mode: bool, charging: bool) -> Icon {
    use ab_glyph::{FontRef, PxScale};
    use image::{ImageBuffer, Rgba};
    use imageproc::drawing::draw_text_mut;

    let width = 64;
    let height = 64;

    let mut img = ImageBuffer::from_fn(width, height, |_, _| Rgba([0u8, 0u8, 0u8, 0u8]));

-    let font_data = include_bytes!("../../assets/font/DejaVuSans.ttf");
+    let font_data = include_bytes!("/usr/share/fonts/TTF/DejaVuSans.ttf");
    let font = match FontRef::try_from_slice(font_data) {
        Ok(f) => f,
        Err(_) => {
            return Icon {
                width: width as i32,
                height: height as i32,
                data: vec![0u8; (width * height * 4) as usize],
            };
        }
    };

Another way would be to bundle the font in the archive, which perhaps seems the best.

Originally created by @d0tiKs on GitHub (Dec 24, 2025). Original GitHub issue: https://github.com/kavishdevar/librepods/issues/401 When trying to build from source using the tar.gz available to download I got this message : ``` ❯ cargo build -r 2>| grep error -A 8 error: couldn't read `src/ui/../../assets/font/DejaVuSans.ttf`: No such file or directory (os error 2) --> src/ui/tray.rs:176:21 | 176 | let font_data = include_bytes!("../../assets/font/DejaVuSans.ttf"); | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ warning: unused import: `crate::bluetooth::att::ATTManager` --> src/devices/airpods.rs:3:5 | -- error: could not compile `librepods` (bin "librepods") due to 1 previous error; 13 warnings emitted ``` I think the path to the font asset should be different, putting the font availability as a requirement and using the standard path for font `/usr/share/fonts/TTF/` could be a way to fix it (in [linux-rust/src/ui/tray.rs](https://github.com/kavishdevar/librepods/blob/linux/rust/linux-rust/src/ui/tray.rs) ). ```diff fn generate_icon(text: &str, text_mode: bool, charging: bool) -> Icon { use ab_glyph::{FontRef, PxScale}; use image::{ImageBuffer, Rgba}; use imageproc::drawing::draw_text_mut; let width = 64; let height = 64; let mut img = ImageBuffer::from_fn(width, height, |_, _| Rgba([0u8, 0u8, 0u8, 0u8])); - let font_data = include_bytes!("../../assets/font/DejaVuSans.ttf"); + let font_data = include_bytes!("/usr/share/fonts/TTF/DejaVuSans.ttf"); let font = match FontRef::try_from_slice(font_data) { Ok(f) => f, Err(_) => { return Icon { width: width as i32, height: height as i32, data: vec![0u8; (width * height * 4) as usize], }; } }; ``` Another way would be to bundle the font in the archive, which perhaps seems the best.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/librepods#194
No description provided.