High DPI

hi-dpi feature is used to enable process-level DPI awareness. It will let the application receive more accurate DPI information, and let Flor update rendering scaling and layout units when window DPI changes.

[dependencies]
flor = { version = "0.1.0", features = ["direct2d", "hi-dpi"] }

What It Affects

After enabling, platform initialization will set DPI awareness. When window receives DPI change message, Flor will update:

ContentResult
Renderer scalingRendering backend will receive new dpi_x / dpi_y.
Layout unitspt and other DPI-dependent units will use new DPI to recalculate.
Layout cacheAfter DPI change will clear layout resolver cache and re-layout.

If you need to detect DPI change at the application layer, you can use the event builder:

use flor::view::builder::EventBuilder;
use flor_lys::label::label;

let root = label("DPI")
    .on_dpi_change(|_view_id, dpi_x, dpi_y| {
        println!("dpi changed: {dpi_x}, {dpi_y}");
    });

on_dpi_change(...)'s complete signature see Handler API's Window Events.