Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Font configuration
IO functions to modify font config values.
Synopsis
- newtype FontConfig = FontConfig (Ptr ImFontConfig)
- new :: MonadIO m => m FontConfig
- destroy :: MonadIO m => FontConfig -> m ()
- setFontDataOwnedByAtlas :: MonadIO m => FontConfig -> CBool -> m ()
- setFontNo :: MonadIO m => FontConfig -> CInt -> m ()
- setSizePixels :: MonadIO m => FontConfig -> CFloat -> m ()
- setOversampleH :: MonadIO m => FontConfig -> CInt -> m ()
- setOversampleV :: MonadIO m => FontConfig -> CInt -> m ()
- setPixelSnapH :: MonadIO m => FontConfig -> CBool -> m ()
- setGlyphExtraSpacing :: MonadIO m => FontConfig -> Ptr ImVec2 -> m ()
- setGlyphOffset :: MonadIO m => FontConfig -> Ptr ImVec2 -> m ()
- setGlyphRanges :: MonadIO m => FontConfig -> GlyphRanges -> m ()
- setGlyphMinAdvanceX :: MonadIO m => FontConfig -> CFloat -> m ()
- setGlyphMaxAdvanceX :: MonadIO m => FontConfig -> CFloat -> m ()
- setMergeMode :: MonadIO m => FontConfig -> CBool -> m ()
- setFontBuilderFlags :: MonadIO m => FontConfig -> CUInt -> m ()
- setRasterizerMultiply :: MonadIO m => FontConfig -> CFloat -> m ()
- setEllipsisChar :: MonadIO m => FontConfig -> ImWchar -> m ()
Documentation
newtype FontConfig Source #
Font configuration data handle
Wraps ImFontConfig*
.
new :: MonadIO m => m FontConfig Source #
Create an instance of config
destroy :: MonadIO m => FontConfig -> m () Source #
Destroy an instance of config
Should be used after font atlas building.
Changing settings
setFontDataOwnedByAtlas :: MonadIO m => FontConfig -> CBool -> m () Source #
TTF/OTF data ownership taken by the container ImFontAtlas (will delete memory itself).
By default, it is true
setFontNo :: MonadIO m => FontConfig -> CInt -> m () Source #
Index of font within TTF/OTF file
By default, it is 0
setSizePixels :: MonadIO m => FontConfig -> CFloat -> m () Source #
Size in pixels for rasterizer (more or less maps to the resulting font height).
Implicitly set by addFont...
functions.
setOversampleH :: MonadIO m => FontConfig -> CInt -> m () Source #
Rasterize at higher quality for sub-pixel positioning. Note the difference between 2 and 3 is minimal so you can reduce this to 2 to save memory. Read https://github.com/nothings/stb/blob/master/tests/oversample/README.md for details.
By default, it is 3
setOversampleV :: MonadIO m => FontConfig -> CInt -> m () Source #
Rasterize at higher quality for sub-pixel positioning. This is not really useful as we don't use sub-pixel positions on the Y axis.
By default, it is 1
setPixelSnapH :: MonadIO m => FontConfig -> CBool -> m () Source #
Align every glyph to pixel boundary. Useful e.g. if you are merging a non-pixel aligned font with the default font. If enabled, you can set OversampleH/V to 1.
By default, it is false
setGlyphExtraSpacing :: MonadIO m => FontConfig -> Ptr ImVec2 -> m () Source #
Extra spacing (in pixels) between glyphs. Only X axis is supported for now.
By default, it is 0, 0
setGlyphOffset :: MonadIO m => FontConfig -> Ptr ImVec2 -> m () Source #
Offset all glyphs from this font input.
By default, it is 0, 0
setGlyphRanges :: MonadIO m => FontConfig -> GlyphRanges -> m () Source #
Pointer to a user-provided list of Unicode range (2 value per range, values are inclusive, zero-terminated list). THE ARRAY DATA NEEDS TO PERSIST AS LONG AS THE FONT IS ALIVE.
By default, it is NULL
setGlyphMinAdvanceX :: MonadIO m => FontConfig -> CFloat -> m () Source #
Minimum AdvanceX for glyphs, set Min to align font icons, set both Min/Max to enforce mono-space font
By default, it is 0
setGlyphMaxAdvanceX :: MonadIO m => FontConfig -> CFloat -> m () Source #
Maximum AdvanceX for glyphs
By default, it is FLT_MAX
setMergeMode :: MonadIO m => FontConfig -> CBool -> m () Source #
Merge into previous ImFont, so you can combine multiple inputs font into one ImFont (e.g. ASCII font + icons + Japanese glyphs). You may want to use GlyphOffset.y when merge font of different heights.
By default, it is false
setFontBuilderFlags :: MonadIO m => FontConfig -> CUInt -> m () Source #
Settings for custom font builder. THIS IS BUILDER IMPLEMENTATION DEPENDENT.
By default, it is 0
. Leave it so if unsure.
setRasterizerMultiply :: MonadIO m => FontConfig -> CFloat -> m () Source #
Brighten (>1.0f) or darken (<1.0f) font output. Brightening small fonts may be a good workaround to make them more readable.
By default, it is 1.0f
setEllipsisChar :: MonadIO m => FontConfig -> ImWchar -> m () Source #
Explicitly specify unicode codepoint of ellipsis character. When fonts are being merged first specified ellipsis will be used.
By default, it is -1