x_graphics/direct2d/
text.rs

1use windows::Win32::Graphics::DirectWrite::{
2    DWRITE_TEXT_ALIGNMENT, DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_TRAILING,
3};
4
5use crate::text::TextAlignment;
6
7impl From<TextAlignment> for DWRITE_TEXT_ALIGNMENT {
8    fn from(alignment: TextAlignment) -> Self {
9        match alignment {
10            TextAlignment::Left => DWRITE_TEXT_ALIGNMENT_LEADING,
11            TextAlignment::Center => DWRITE_TEXT_ALIGNMENT_CENTER,
12            TextAlignment::Right => DWRITE_TEXT_ALIGNMENT_TRAILING,
13        }
14    }
15}