pub struct FontDialogData {
pub initial: FontDescriptor,
pub effects: FontEffects,
pub show_effects: bool,
pub min_size_pt: Option<f32>,
pub max_size_pt: Option<f32>,
pub fixed_pitch_only: bool,
}Expand description
Serializable preferences and current state of a font dialog (F1-F2).
Fields§
§initial: FontDescriptorThe font the dialog opens with; refreshed on accept.
effects: FontEffectsThe effect toggles shown and echoed with the selection.
show_effects: boolWhether effect controls are requested (capability-gated variants).
min_size_pt: Option<f32>Inclusive minimum point size, when the caller restricts the range.
max_size_pt: Option<f32>Inclusive maximum point size, when the caller restricts the range.
fixed_pitch_only: boolWhether only fixed-pitch families may be chosen.
Implementations§
Source§impl FontDialogData
impl FontDialogData
Sourcepub fn new(initial: FontDescriptor) -> Self
pub fn new(initial: FontDescriptor) -> Self
Creates default data for initial: effects shown, no size restriction.
Sourcepub fn validate(&self) -> PickerResult<()>
pub fn validate(&self) -> PickerResult<()>
Checks the descriptor and the size range.
Both bounds must be finite and positive
(PickerError::InvalidFontSize) and a configured pair must not be
inverted (PickerError::InvalidSizeRange).
Sourcepub fn clamp_size(&self, size_pt: f32) -> f32
pub fn clamp_size(&self, size_pt: f32) -> f32
Clamps a chosen size to the configured range (F2’s shared rule).
Non-finite input falls back to the initial descriptor’s size, so a native dialog that reports a broken value can never escape the range. The clamp never panics, even for data that was not validated first.