pub enum TextVerticalPlacement {
CenterMetricsBox,
BoundsAsLineBox,
}Variants§
CenterMetricsBox
Center the prepared text box (TextMetrics.size.height) within the allocated bounds.
This is the historical Fret behavior and remains the default in v1.
BoundsAsLineBox
Treat the allocated bounds height as the effective line box height for single-line text and compute baseline placement via a CSS/GPUI-like “half-leading” model:
padding_top = (bounds_h - ascent - descent) / 2baseline_y = padding_top + ascent
Notes:
- This mode is intended for fixed-height controls (tabs, pills, buttons) where authors want a stable baseline placement without per-component y-offset hacks.
- Implementations should fall back to
CenterMetricsBoxwhen line metrics are unavailable or the prepared text contains multiple lines.
Trait Implementations§
Source§impl Clone for TextVerticalPlacement
impl Clone for TextVerticalPlacement
Source§fn clone(&self) -> TextVerticalPlacement
fn clone(&self) -> TextVerticalPlacement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for TextVerticalPlacement
impl Debug for TextVerticalPlacement
Source§impl Default for TextVerticalPlacement
impl Default for TextVerticalPlacement
Source§fn default() -> TextVerticalPlacement
fn default() -> TextVerticalPlacement
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TextVerticalPlacement
impl<'de> Deserialize<'de> for TextVerticalPlacement
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Hash for TextVerticalPlacement
impl Hash for TextVerticalPlacement
Source§impl PartialEq for TextVerticalPlacement
impl PartialEq for TextVerticalPlacement
Source§impl Serialize for TextVerticalPlacement
impl Serialize for TextVerticalPlacement
impl Copy for TextVerticalPlacement
impl Eq for TextVerticalPlacement
impl StructuralPartialEq for TextVerticalPlacement
Auto Trait Implementations§
impl Freeze for TextVerticalPlacement
impl RefUnwindSafe for TextVerticalPlacement
impl Send for TextVerticalPlacement
impl Sync for TextVerticalPlacement
impl Unpin for TextVerticalPlacement
impl UnsafeUnpin for TextVerticalPlacement
impl UnwindSafe for TextVerticalPlacement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more