SVGFonts-1.7.0.1: Fonts from the SVG-Font format

Safe HaskellNone
LanguageHaskell2010

Graphics.SVGFonts.ReadFont

Synopsis

Documentation

data FontData n #

This type contains everything that a typical SVG font file produced by fontforge contains.

Instances
Generic (FontData n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

Associated Types

type Rep (FontData n) :: Type -> Type #

Methods

from :: FontData n -> Rep (FontData n) x #

to :: Rep (FontData n) x -> FontData n #

Serialize n => Serialize (FontData n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

Methods

put :: Putter (FontData n) #

get :: Get (FontData n) #

type Rep (FontData n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

type Rep (FontData n)

bbox_dy :: RealFloat n => FontData n -> n #

Difference between highest and lowest y-value of bounding box

bbox_lx :: FontData n -> n #

Lowest x-value of bounding box

bbox_ly :: FontData n -> n #

Lowest y-value of bounding box

underlinePosition :: FontData n -> n #

Position of the underline bar

underlineThickness :: FontData n -> n #

Thickness of the underline bar

horizontalAdvance :: String -> FontData n -> n #

Horizontal advance of a character consisting of its width and spacing, extracted out of the font data

kernAdvance :: RealFloat n => String -> String -> Kern n -> Bool -> n #

Change the horizontal advance of two consective chars (kerning)

data Kern n #

See http://www.w3.org/TR/SVG/fonts.html#KernElements

Some explanation how kerning is computed:

In Linlibertine.svg, there are two groups of chars: e.g. <hkern g1="f,longs,uni1E1F,f_f" g2="parenright,bracketright,braceright" k="-37" /> This line means: If there is an f followed by parentright, reduce the horizontal advance by -37 (add 37). Therefore to quickly check if two characters need kerning assign an index to the second group (g2 or u2) and assign to every unicode in the first group (g1 or u1) this index, then sort these tuples after their name (for binary search). Because the same unicode char can appear in several g1s, reduce this multiset, ie all the ("name1",0) ("name1",1) to ("name1",[0,1]). Now the g2s are converted in the same way as the g1s. Whenever two consecutive chars are being printed try to find an intersection of the list assigned to the first char and second char

Constructors

Kern 
Instances
Show n => Show (Kern n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

Methods

showsPrec :: Int -> Kern n -> ShowS #

show :: Kern n -> String #

showList :: [Kern n] -> ShowS #

Generic (Kern n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

Associated Types

type Rep (Kern n) :: Type -> Type #

Methods

from :: Kern n -> Rep (Kern n) x #

to :: Rep (Kern n) x -> Kern n #

Serialize n => Serialize (Kern n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

Methods

put :: Putter (Kern n) #

get :: Get (Kern n) #

type Rep (Kern n) # 
Instance details

Defined in Graphics.SVGFonts.ReadFont

type OutlineMap n = Map String (Path V2 n) #

A map of unicode characters to outline paths.

type PreparedFont n = (FontData n, OutlineMap n) #

A font including its outline map.

loadFont :: (Read n, RealFloat n) => FilePath -> IO (PreparedFont n) #

Read font data from font file, and compute its outline map.

loadFont' :: (XmlSource s, Read n, RealFloat n) => String -> s -> (String, PreparedFont n) #

Read font data from an XmlSource, and compute its outline map.