wumpus-core-0.12.0: Pure Haskell PostScript and SVG generation.

PortabilityGHC only




Text handling


Type synonym

Courier metrics at 48 point

courier48_width :: Num u => uSource

The width of a letter in Courier at 48 pt.

The value is not entirely accurate but it is satisfactory.

courier48_body_height :: Num u => uSource

The height of a letter without accents, ascenders or descenders in Courier at 48 pt .

The value is not entirely accurate but it is satisfactory - some letters are taller than others (e.g. numbers are taller then capitals).

courier48_height :: Num u => uSource

The common maximum height of a letter in Courier at 48pt.

By common maximum the letter is allowed to have both an accent or ascender and a descender.

Naturally the height is 48.0.

courier48_descender_depth :: Num u => uSource

The depth of a descender in Courier at 48 pt.

Also the height of an ascender.

courier48_spacer_width :: Num u => uSource

The spacing between letters printed directly with PostScript's show command for Courier at 48 pt.

The value is not entirely accurate but it is satisfactory.

widthAt48pt :: Fractional u => CharCount -> uSource

Width of the supplied string when printed at 48pt.

textWidth :: Fractional u => FontSize -> CharCount -> uSource

textHeight :: Num u => FontSize -> uSource

Text height is just identity/double-coercion, i.e. 18 == 18.0. The size of a font is (apparently) the maximum height (body + descender max + ascender max).

descenderDepth :: Fractional u => FontSize -> uSource

Descender depth for font size sz.

(The metrics are taken from Courier, of course).

textBounds :: Fractional u => FontSize -> Point2 u -> CharCount -> BoundingBox uSource

Find the bounding box for the character count at the supplied font-size.

The supplied point represents the bottom left corner of the a regular upper-case letter (that is without descenders). The bounding box will always be dropped to accommodate ascenders - no interpretation of the string takes place to see if it actually contains ascenders or descenders.

The metrics used are derived from Courier - a monospaced font. For variable width fonts the calculated bounding box will usually be too long.