| Portability | GHC |
|---|---|
| Stability | highly unstable |
| Maintainer | Stephen Tetley <stephen.tetley@gmail.com> |
| Safe Haskell | Safe-Infered |
Wumpus.Basic.Kernel.Base.FontSupport
Description
Data types representing font metrics.
- type FontName = String
- type CodePoint = Int
- data FontDef = FontDef {}
- data FontFamily = FontFamily {}
- regularWeight :: FontFamily -> FontDef
- boldWeight :: FontFamily -> FontDef
- italicWeight :: FontFamily -> FontDef
- boldItalicWeight :: FontFamily -> FontDef
- type CharWidthLookup = CodePoint -> Vec2 Double
- data FontMetrics = FontMetrics {}
- data FontTable
- emptyFontTable :: FontTable
- lookupFont :: FontName -> FontTable -> Maybe FontMetrics
- insertFont :: FontName -> FontMetrics -> FontTable -> FontTable
- type FontLoadMsg = String
- data FontLoadLog
- fontLoadMsg :: String -> FontLoadLog
- data FontLoadResult = FontLoadResult {}
- printLoadErrors :: FontLoadResult -> IO ()
- monospace_metrics :: FontMetrics
Documentation
FontDef wraps FontFace from Wumpus-Core with file name
information for the font loaders.
Constructors
| FontDef | |
Fields | |
data FontFamily Source
A family group of FontDefs (regular, bold, italic and bold-italic).
It is convenient for some higher-level text objects in Wumpus
(particularly Doc in Wumpus-Drawing) to treat a font and its
standard weights as the same entity. This allows Doc API to
provide a bold operation to simply change to the the bold
weight of the current family, rather than use the primitive
set_font operation to change to an explicitly named font.
Constructors
| FontFamily | |
regularWeight :: FontFamily -> FontDefSource
Extract the regular weight FontDef from a FontFamily.
boldWeight :: FontFamily -> FontDefSource
Extract the bold weight FontDef from a FontFamily.
Note - this falls back to the regular weight if the font family
has no bold weight. To get the bold weight or Nothing if it
is not present use the record selector ff_bold.
italicWeight :: FontFamily -> FontDefSource
Extract the italic weight FontDef from a FontFamily.
Note - this falls back to the regular weight if the font family
has no italic weight. To get the italic weight or Nothing if
it is not present use the record selector ff_italic.
boldItalicWeight :: FontFamily -> FontDefSource
Extract the bold-italic weight FontDef from a
FontFamily.
Note - this falls back to the regular weight if the font family
has no bold-italic weight. To get the bold-italic weight or
Nothing if it is not present use the record selector
ff_bold_italic.
type CharWidthLookup = CodePoint -> Vec2 DoubleSource
A lookup function from code point to width vector.
The unit is always stored as a Double representing PostScript points.
Note - in PostScript terminology a width vector is not obliged to be left-to-right (writing direction 0). It could be top-to-bottom (writing direction 1).
data FontMetrics Source
FontMetrics store a subset of the properties available in
a font file - enough to calculate accurate bounding boxes and
positions for text.
Bounding box representing the maximum glyph area. Width vectors for each character. Cap height Descender depth.
Because Wumpus always needs font metrics respective to the current point size, the actual fields are all functions.
Constructors
| FontMetrics | |
Fields
| |
A map between a font name and the respective FontMetrics.
lookupFont :: FontName -> FontTable -> Maybe FontMetricsSource
lookupFont : name * font_table -> Maybe FontMetrics
Lookup a font in the font_table.
insertFont :: FontName -> FontMetrics -> FontTable -> FontTableSource
insertFont : name * font_metrics * font_table -> FontTable
Insert a named font into the font_table.
type FontLoadMsg = StringSource
FontLoadMsg - type synonym for String.
data FontLoadLog Source
FontLoadLog is a Hughes list of Strings, so it supports
efficient append.
Instances
data FontLoadResult Source
Constructors
| FontLoadResult | |
Fields | |
printLoadErrors :: FontLoadResult -> IO ()Source
Print the loader errors from the FontLoadResult to std-out.
monospace_metrics :: FontMetricsSource
This ignores the Char code lookup and just returns the default advance vector.