FontyFruity-0.2.1: A true type file format loader

Safe HaskellNone

Graphics.Text.TrueType

Contents

Description

Module in charge of loading fonts.

Synopsis

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)

getStringCurveAtPointSource

Arguments

:: 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

data Font Source

Type representing a font.

Constructors

Font 

Fields

_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
 

Instances

type Dpi = IntSource

Express device resolution in dot per inch.

type PointSize = IntSource

Font size expressed in points.