fschutt/azul

Labels are not displayed.

VengeQ opened this issue · 2 comments

Am I did something wrong or is it a bug?

Description

  • Texts in labels are not displayed.
  • Labels of button are not displayed.

Version / OS

  • azul version:
    Latest from branch="unvendor_dependencies"
    dcc69cd

  • Operating system:
    Windows 10 version 1607 (OS Build 14393.3326)

  • Windowing system (X11 or Wayland, Linux only):
    N/A

  • Rust version
    rustc 1.41.0-nightly (ded5ee001 2019-11-13)
    cargo 1.40.0-nightly (5da4b4d47 2019-10-28)

Steps to Reproduce

Just cargo run.
My main.rs(Very similar to "hello_world" from examples):

extern crate azul;
use azul::prelude::*;
use azul::widgets::{button::Button, label::Label, };
const CSS: &str = "
#label1 {
    width: 40px;
    height: 40px;
    background-color:red;
    font-color:blue;
}
#button1 {
     top:40px;
     width: 40px;
     height: 40px;
}
";
struct DataModel {
    counter: usize
}
impl Layout for DataModel {
    fn layout(&self, _: LayoutInfo) -> Dom<Self> {
        let label = Label::new(format!("counter: {}", self.counter))
            .dom()
            .with_id("label1");
        let button = Button::with_label("Update counter")
            .dom()
            .with_id("button1")
            .with_callback(On::MouseUp, update_counter);
        Dom::new(NodeType::Div).with_child(label).with_child(button)
       // Dom::div().with_child(label).with_child(button)
    }
}
fn update_counter(event: CallbackInfo<DataModel>) -> UpdateScreen {
    event.state.counter += 1;
    println!("counter: {}",event.state.counter ); // counter works properly
    Redraw
}
fn main() {
    let app = App::new(DataModel { counter: 0 }, AppConfig::default()).unwrap();
    let window = WindowCreateOptions::new(css::override_native(CSS).unwrap());
    app.run(window);
}

Additional Information

When use css::override_native in window:
image

When use css::native:
image

Yeah, no, this is a known bug in the layout solver. The font instance keys aren't always generated. Will be fixed, but I haven't had the time recently.

This has been fixed, the labels now display properly.