Copyright | (c) 2018 Schell Scivally |
---|---|
License | MIT |
Maintainer | Schell Scivally <schell@takt.com> & Adrian Cochrane <alcinnz@argonaut-constellation.org> |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Text rendering abstraction, hiding the details of the Atlas, Cache, and the Harfbuzz library.
Synopsis
- data GlyphSize
- data SampleText = SampleText {
- sampleFeatures :: [Feature]
- sampleText :: Text
- tabwidth :: Int
- fontOptions :: FontOptions
- minLineHeight :: Float
- defaultSample :: SampleText
- addSampleFeature :: String -> Word32 -> SampleText -> SampleText
- parseSampleFeature :: String -> SampleText -> SampleText
- parseSampleFeatures :: [String] -> SampleText -> SampleText
- addFontVariant :: String -> Float -> SampleText -> SampleText
- parseFontVariant :: String -> SampleText -> SampleText
- parseFontVariants :: [String] -> SampleText -> SampleText
- varItalic :: String
- varOptSize :: String
- varSlant :: String
- varWidth :: String
- varWeight :: String
- makeDrawText :: (MonadIO m, MonadFail m, MonadError TypograffitiError m, MonadIO n, MonadFail n, MonadError TypograffitiError n) => FT_Library -> FilePath -> Int -> GlyphSize -> SampleText -> m (RichText -> n (AllocatedRendering [TextTransform]))
- makeDrawText' :: (MonadIO n, MonadFail n, MonadError TypograffitiError n) => FilePath -> Int -> GlyphSize -> SampleText -> IO (Either TypograffitiError (RichText -> n (AllocatedRendering [TextTransform])))
- type TextRenderer m = RichText -> m (AllocatedRendering [TextTransform])
- drawLinesWrapper :: (MonadIO m, MonadFail m) => Int -> Float -> TextRenderer m -> TextRenderer m
- freeAtlasWrapper :: MonadIO m => Atlas -> TextRenderer m -> TextRenderer m
Documentation
How large the text should be rendered.
data SampleText Source #
Extra parameters for constructing a font atlas, and determining which glyphs should be in it.
SampleText | |
|
defaultSample :: SampleText Source #
Constructs a SampleText
with default values.
addSampleFeature :: String -> Word32 -> SampleText -> SampleText Source #
Appends an OpenType feature callers may use to the Sample
ensuring its
glyphs are available. Call after setting sampleText
.
parseSampleFeature :: String -> SampleText -> SampleText Source #
Parse an OpenType feature into this font using syntax akin to CSS font-feature-settings.
parseSampleFeatures :: [String] -> SampleText -> SampleText Source #
Parse multiple OpenType features into this font.
addFontVariant :: String -> Float -> SampleText -> SampleText Source #
Alter which OpenType variant of this font will be rendered. Please check your font which variants are supported.
parseFontVariant :: String -> SampleText -> SampleText Source #
Parse a OpenType variant into the configured font using syntax akin to CSS font-variant-settings.
parseFontVariants :: [String] -> SampleText -> SampleText Source #
Parse multiple OpenType variants into this font.
varOptSize :: String Source #
Standard optical size font variant. Please check if your font supports this.
Standard slant (oblique) font variant. Please check if your font supports this.
Standard weight (boldness) font variant. Please check if your font supports this.
makeDrawText :: (MonadIO m, MonadFail m, MonadError TypograffitiError m, MonadIO n, MonadFail n, MonadError TypograffitiError n) => FT_Library -> FilePath -> Int -> GlyphSize -> SampleText -> m (RichText -> n (AllocatedRendering [TextTransform])) Source #
Opens a font sized to the given value & prepare to render text in it.
There is no need to keep the given FT_Library
live before rendering the text.
makeDrawText' :: (MonadIO n, MonadFail n, MonadError TypograffitiError n) => FilePath -> Int -> GlyphSize -> SampleText -> IO (Either TypograffitiError (RichText -> n (AllocatedRendering [TextTransform]))) Source #
Variant of makeDrawText
which initializes FreeType itself.
type TextRenderer m = RichText -> m (AllocatedRendering [TextTransform]) Source #
Internal utility for rendering multiple lines of text & expanding tabs as configured.
drawLinesWrapper :: (MonadIO m, MonadFail m) => Int -> Float -> TextRenderer m -> TextRenderer m Source #
freeAtlasWrapper :: MonadIO m => Atlas -> TextRenderer m -> TextRenderer m Source #