iced-rs / iced

A cross-platform GUI library for Rust, inspired by Elm

Home Page:https://iced.rs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tour and other examples doesn't render most text

thankfulmachine opened this issue · comments

Is your issue REALLY a bug?

  • My issue is indeed a bug!
  • I am not crazy! I will not fill out this form just to ask a question or request a feature. Pinky promise.

Is there an existing issue for this?

  • I have searched the existing issues.

Is this issue related to iced?

  • My hardware is compatible and my graphics drivers are up-to-date.

What happened?

When running the tour with cargo run --package tour, most text does not display. See attached screenshot.

20240830_19h44m05s_grim

If I change the settings to specify the default_font to be MONOSPACE, the tour more or less works correctly, so I suspect there is a font issue with the default font, but I have searched and searched and can't find anything wrong with my system.

Configuration

  • iced 0.12.1
  • Arch Linux (updated as of this writing)
  • Ryzen 7 7840U (with and without Vulkan drivers)
  • Installed fonts:
    • Fira Sans OTF
    • Fira Mono OTF
    • Adobe Source Code Pro OTF
    • Noto Color Emoji TTF
    • Liberation* TTF

.config/fontconfig/fonts.conf:

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>

 <alias>
  <family>sans-serif</family>
  <prefer>
   <family>Fira Sans</family>
   <family>Noto Color Emoji</family>
  </prefer>
 </alias>

 <alias>
  <family>serif</family>
  <prefer>
   <family>Fira Sans</family>
   <family>Noto Color Emoji</family>
  </prefer>
 </alias>

 <alias>
  <family>monospace</family>
  <prefer>
   <family>Fira Mono</family>
   <family>Noto Color Emoji</family>
  </prefer>
 </alias>
</fontconfig>

What is the expected behavior?

I expect the tour to render correctly with sans-serif fonts.

Version

crates.io release

Operating System

Linux

Do you have any log output?

2024-08-31T03:14:38.432005Z  INFO iced_wgpu::window::compositor: Settings {
    present_mode: AutoVsync,
    internal_backend: Backends(
        VULKAN | GL | METAL | DX12 | BROWSER_WEBGPU,
    ),
    default_font: Font {
        family: SansSerif,
        weight: Normal,
        stretch: Normal,
        style: Normal,
    },
    default_text_size: Pixels(
        16.0,
    ),
    antialiasing: None,
}    
2024-08-31T03:14:38.434739Z  INFO iced_wgpu::window::compositor: Selected: AdapterInfo {
    name: "AMD Radeon 780M (RADV GFX1103_R1)",
    vendor: 4098,
    device: 5567,
    device_type: IntegratedGpu,
    driver: "radv",
    driver_info: "Mesa 24.2.1-arch1.1",
    backend: Vulkan,
}    
2024-08-31T03:14:38.435061Z  INFO iced_wgpu::window::compositor: Available formats: Copied {
    it: Iter(
        [
            Bgra8UnormSrgb,
            Rgba8UnormSrgb,
            Bgra8Unorm,
            Rgba8Unorm,
        ],
    ),
}    
2024-08-31T03:14:38.435075Z  INFO iced_wgpu::window::compositor: Available alpha modes: [
    Opaque,
    PreMultiplied,
]

Adding to this, if I install noto-fonts I get correct behavior. This doesn't seem right, but does the text system specifically require Noto Sans to be installed when the default font is used in the settings? I would've expected my fontconfig to be honored. Hopefully I didn't miss anything.

Finally found some fallbacks in

https://github.com/pop-os/cosmic-text/blob/e16b39f29c84773a05457fe39577a602de27855c/src/font/fallback/unix.rs#L6

I feel it would be good to document this dependency somewhere or perhaps update the examples to use an included font?

Although, this doesn't really explain why default_font: Font::MONOSPACE works, but not Font::DEFAULT or Font::default().

iced/src/settings.rs

Lines 18 to 21 in 0dcec51

/// The default [`Font`] to be used.
///
/// By default, it uses [`Family::SansSerif`](crate::font::Family::SansSerif).
pub default_font: Font,

Same with markdown example on Clear Linux + Gnome + Wayland + Mesa.
I can select lines and click links, but text iteself is not visible.
Screenshot from 2024-09-04 11-04-09