Skip to main content

align_offset_with_direction

Function align_offset_with_direction 

Source
pub fn align_offset_with_direction(
    align: TextAlign,
    total_advance: f32,
    direction: CanvasDirection,
) -> f32
Expand description

指定位置から見た、描き始めの x のずれ(書字方向対応)。

start/end は書字方向(direction)で決まる:

  • LTR: start = 0.0 (左揃え), end = -total_advance (右揃え)
  • RTL: start = -total_advance (右揃え), end = 0.0 (左揃え)
  • left / right / center は書字方向に左右されず物理配置を維持。