Safe Haskell | None |
---|---|
Language | Haskell2010 |
- data FontData n = FontData {
- fontDataGlyphs :: SvgGlyphs n
- fontDataKerning :: Kern n
- fontDataBoundingBox :: [n]
- fontDataFileName :: String
- fontDataUnderlinePos :: n
- fontDataUnderlineThickness :: n
- fontDataOverlinePos :: Maybe n
- fontDataOverlineThickness :: Maybe n
- fontDataStrikethroughPos :: Maybe n
- fontDataStrikethroughThickness :: Maybe n
- fontDataHorizontalAdvance :: n
- fontDataFamily :: String
- fontDataStyle :: String
- fontDataWeight :: String
- fontDataVariant :: String
- fontDataStretch :: String
- fontDataSize :: Maybe String
- fontDataUnitsPerEm :: n
- fontDataPanose :: String
- fontDataSlope :: Maybe n
- fontDataAscent :: n
- fontDataDescent :: n
- fontDataXHeight :: n
- fontDataCapHeight :: n
- fontDataAccentHeight :: Maybe n
- fontDataWidths :: Maybe String
- fontDataHorizontalStem :: Maybe n
- fontDataVerticalStem :: Maybe n
- fontDataUnicodeRange :: String
- fontDataRawKernings :: [(String, [String], [String], [String], [String])]
- fontDataIdeographicBaseline :: Maybe n
- fontDataAlphabeticBaseline :: Maybe n
- fontDataMathematicalBaseline :: Maybe n
- fontDataHangingBaseline :: Maybe n
- fontDataVIdeographicBaseline :: Maybe n
- fontDataVAlphabeticBaseline :: Maybe n
- fontDataVMathematicalBaseline :: Maybe n
- fontDataVHangingBaseline :: Maybe n
- bbox_dy :: RealFloat n => FontData n -> n
- bbox_lx :: FontData n -> n
- bbox_ly :: FontData n -> n
- underlinePosition :: FontData n -> n
- underlineThickness :: FontData n -> n
- horizontalAdvance :: String -> FontData n -> n
- kernAdvance :: RealFloat n => String -> String -> Kern n -> Bool -> n
- data Kern n = Kern {}
- type OutlineMap n = Map String (Path V2 n)
- type PreparedFont n = (FontData n, OutlineMap n)
- loadFont :: (Read n, RealFloat n) => FilePath -> IO (PreparedFont n)
- loadFont' :: (XmlSource s, Read n, RealFloat n) => String -> s -> (String, PreparedFont n)
Documentation
This type contains everything that a typical SVG font file produced by fontforge contains.
bbox_dy :: RealFloat n => FontData n -> n Source #
Difference between highest and lowest y-value of bounding box
underlinePosition :: FontData n -> n Source #
Position of the underline bar
underlineThickness :: FontData n -> n Source #
Thickness of the underline bar
horizontalAdvance :: String -> FontData n -> n Source #
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 Source #
Change the horizontal advance of two consective chars (kerning)
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
type PreparedFont n = (FontData n, OutlineMap n) Source #
A font including its outline map.