wumpus-basic-0.15.0: Basic objects and system code built on Wumpus-Core.

PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>

Wumpus.Basic.System.FontLoader.Base.Datatypes

Contents

Description

Datatypes

Synopsis

Afm Unit

data AfmUnit Source

Wrapped Double representing 1/1000 of the scale factor (Point size) of a font. AFM files encode all measurements as these units.

afmValue :: FromPtSize u => AfmUnit -> PtSize -> uSource

Compute the size of a measurement in Afm units scaled by the point size of the font.

Glyph metrics

type PSCharCode = IntSource

Afm files index glyphs by PostScript character code. This is not the same as Unicode, ASCII...

It is expected to be determined by EncodingScheme in the Global Font Information Section.

data AfmFile Source

Wumpus needs a very small subset of AFM files, common to both version 2.0 and version 4.1.

Note - Bounding Box is mandatory for AFM versions 3.0 and 4.1

Cap Height is optional in AFM versions 3.0 and 4.1. As Wumpus uses cap height in calculations, glyph metrics must be build with an arbitrary value if it is not present.

Encoding Scheme is optional in AFM files.

Instances

data MonospaceDefaults cu Source

Monospace defaults are used if the font loader fails to extract the necessary fields.

The values are taken from the font correpsonding to Courier in the distributed font files.

Instances

data FontProps cu Source

The metrics read from a font file by a font loader.

NOTE - FontProps is parametric on cu - Character Unit and not on the usual u. A typical character unit is AfmUnit, the unit of measurement for AFM files (1000th of a point).

The is the initial representation used by Wumpus-Basic as an syntax tree when loading font files.

buildMetricsOps :: (cu -> PtSize) -> FontProps cu -> MetricsOpsSource

Build a MetricsOps function table, from a character unit scaling function and FontProps read from a file.