Safe Haskell | None |
---|
Module in charge of loading fonts.
- decodeFont :: ByteString -> Either String Font
- loadFontFile :: FilePath -> IO (Either String Font)
- getStringCurveAtPoint :: Dpi -> (Float, Float) -> [(Font, PointSize, String)] -> [[Vector (Float, Float)]]
- stringBoundingBox :: Font -> Dpi -> PointSize -> String -> (Float, Float)
- data Font = Font {
- _fontOffsetTable :: !OffsetTable
- _fontTables :: ![(ByteString, ByteString)]
- _fontNames :: Maybe NameTable
- _fontHeader :: Maybe FontHeader
- _fontMaxp :: Maybe MaxpTable
- _fontMap :: Maybe CharacterMaps
- _fontGlyph :: Maybe (Vector Glyph)
- _fontLoca :: Maybe (Vector Word32)
- _fontHorizontalHeader :: Maybe HorizontalHeader
- _fontHorizontalMetrics :: Maybe HorizontalMetricsTable
- type Dpi = Int
- type PointSize = Int
Functions
decodeFont :: ByteString -> Either String FontSource
Decode a in-memory true type file.
loadFontFile :: FilePath -> IO (Either String Font)Source
Load a font file, the file path must be pointing to the true type file (.ttf)
:: Dpi | Dot per inch of the output. |
-> (Float, Float) | Initial position of the baseline. |
-> [(Font, PointSize, String)] | Text to draw |
-> [[Vector (Float, Float)]] | List of contours for each char |
Extract a list of outlines for every char in the string. The given curves are in an image like coordinate system, with the origin point in the upper left corner.
stringBoundingBox :: Font -> Dpi -> PointSize -> String -> (Float, Float)Source
Compute the bounding box of a string displayed with a font at a given size. The resulting coordinate represent the width and the height in pixels.
Types
Type representing a font.
Font | |
|