Portability | GHC |
---|---|

Stability | unstable |

Maintainer | stephen.tetley@gmail.com |

Helpers for working with measured / advance text.

- advtext :: FromPtSize u => EscapedText -> AdvGraphic u
- textVector :: FromPtSize u => EscapedText -> DrawingInfo (AdvanceVec u)
- charVector :: FromPtSize u => EscapedChar -> DrawingInfo (AdvanceVec u)
- multilineHeight :: (Real u, Floating u, FromPtSize u) => Int -> DrawingInfo u
- textObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)
- borderedTextObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)
- centerToBaseline :: (Fractional u, FromPtSize u) => DrawingInfo u
- centerSpinePoints :: Floating u => Int -> Radian -> LocChain u

# Documentation

advtext :: FromPtSize u => EscapedText -> AdvGraphic uSource

Single line text, returning its advance vector.

textVector :: FromPtSize u => EscapedText -> DrawingInfo (AdvanceVec u)Source

charVector :: FromPtSize u => EscapedChar -> DrawingInfo (AdvanceVec u)Source

multilineHeight :: (Real u, Floating u, FromPtSize u) => Int -> DrawingInfo uSource

Height of multiline text is cap_height to descender for the first line, then baseline-to-baseline span for the remaining lines.

textObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)Source

Height of multiline text is cap_height to descender for the first line, then baseline-to-baseline span for the remaining lines.

The answer is in centerform, i.e.:

ObjectPos half_width half_width half_height half_height

borderedTextObjectPos :: (Real u, Floating u, FromPtSize u) => Int -> u -> DrawingInfo (ObjectPos u)Source

Variant of `textObjectPos`

where the calculation includes
margins around all four sides of the enclosing rectangle.

Margin sizes are taken from the `text_margin`

field in the
`DrawingContext`

.

centerToBaseline :: (Fractional u, FromPtSize u) => DrawingInfo uSource

Calculate the distance from the center of a one-line textbox
to the baseline. Note the height of a textbox is `vspan`

which
is cap_height + descender