The text bounding box width was incorrect because the measurement function
was using logical pixels while the rendering function was using physical
pixels (scaled by DPI). This caused a mismatch where:
- sclay_measure_text() set font size and letter spacing without DPI scaling
- sclay_render() applied DPI scaling to both font size and letter spacing
- fontstash's fonsTextBounds() returned physical pixel measurements even
when given logical pixel sizes, leading to incorrect width calculations
The fix ensures consistent DPI scaling by:
1. Scaling font size and letter spacing by dpi_scale during measurement
2. Dividing the returned bounds by dpi_scale to convert back to logical pixels
3. This ensures Clay receives measurements in logical pixels that match what
will actually be rendered
This was particularly noticeable with long continuous text where the
discrepancy accumulated across many characters. The issue was font-size
dependent because different font sizes have different rounding behaviors
in the underlying font rendering system.
Also adds text alignment support to properly measure and render centered/right-aligned text.