Portability | GHC |
---|---|
Stability | highly unstable |
Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
Datatypes
- type PSCharCode = Int
- type PSEncodingScheme = String
- type AfmBoundingBox = BoundingBox AfmUnit
- type AfmKey = String
- type GlobalInfo = Map AfmKey String
- data AfmFile = AfmFile {}
- data AfmGlyphMetrics = AfmGlyphMetrics {
- afm_char_code :: !PSCharCode
- afm_width_vector :: !(Vec2 AfmUnit)
- afm_char_name :: !String
- data MonospaceDefaults cu = MonospaceDefaults {
- default_letter_bbox :: BoundingBox cu
- default_cap_height :: cu
- default_descender :: cu
- default_underline_position :: cu
- default_underline_thickness :: cu
- default_char_width :: Vec2 cu
- data FontProps cu = FontProps {
- fp_bounding_box :: BoundingBox cu
- fp_default_adv_vec :: Vec2 cu
- fp_adv_vecs :: IntMap (Vec2 cu)
- fp_cap_height :: cu
- fp_descender :: cu
- fp_underline_position :: cu
- fp_underline_thickness :: cu
- buildMetricsOps :: (FontSize -> cu -> Double) -> FontProps cu -> FontMetrics
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.
type PSEncodingScheme = StringSource
type GlobalInfo = Map AfmKey StringSource
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.
data AfmGlyphMetrics Source
AfmGlyphMetrics | |
|
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.
MonospaceDefaults | |
|
(Ord cu, Tolerance cu) => Eq (MonospaceDefaults cu) | |
Show cu => Show (MonospaceDefaults cu) |
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.
FontProps | |
|
buildMetricsOps :: (FontSize -> cu -> Double) -> FontProps cu -> FontMetricsSource
Build a MetricsOps function table, from a character unit scaling function and FontProps read from a file.