Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Font glyph ranges builder
Helper to build glyph ranges from text/string data.
Feed your application strings/characters to it then call buildRanges
.
Low-level example of usage:
-- import ImGui.Fonts -- import ImGui.Raw.GlyphRangesBuilder as GRB builder <- GRB.new GRB.addRanges builder getGlyphRangesDefault liftIO $ withCString Привет $ GRB.addText builder rangesVec <- GRB.buildRanges builder let ranges = GRB.fromRangesVector rangesVec addFontFromFileTTF' ".imguimiscfontsDroidSans.ttf" 12 Nothing (Just ranges) -- it is strictly necessary to explicitly build the atlas buildFontAtlas -- resource destruction comes only after the building GRB.destroyRangesVector rangesVec GRB.destroy builder
Synopsis
- newtype GlyphRanges = GlyphRanges (Ptr ImWchar)
- data Builtin
- getBuiltin :: Builtin -> GlyphRanges
- builtinSetup :: Builtin -> Maybe GlyphRanges
- newtype GlyphRangesBuilder = GlyphRangesBuilder (Ptr ImFontGlyphRangesBuilder)
- new :: MonadIO m => m GlyphRangesBuilder
- destroy :: MonadIO m => GlyphRangesBuilder -> m ()
- addChar :: MonadIO m => GlyphRangesBuilder -> ImWchar -> m ()
- addText :: MonadIO m => GlyphRangesBuilder -> CString -> m ()
- addRanges :: MonadIO m => GlyphRangesBuilder -> GlyphRanges -> m ()
- newtype GlyphRangesVector = GlyphRangesVector (Ptr ())
- buildRangesVector :: MonadIO m => GlyphRangesBuilder -> m GlyphRangesVector
- fromRangesVector :: GlyphRangesVector -> GlyphRanges
- destroyRangesVector :: MonadIO m => GlyphRangesVector -> m ()
Documentation
Built-in ranges
Builtin glyph ranges tags.
Instances
Bounded Builtin Source # | |
Enum Builtin Source # | |
Show Builtin Source # | |
Eq Builtin Source # | |
Ord Builtin Source # | |
Defined in DearImGui.Raw.Font.GlyphRanges |
getBuiltin :: Builtin -> GlyphRanges Source #
Get builtin glyph ranges from a tag.
builtinSetup :: Builtin -> Maybe GlyphRanges Source #
Special case of getBuiltin
, but for font source setup.
Preparing a builder
newtype GlyphRangesBuilder Source #
Glyph ranges builder handle
Wraps ImFontGlyphRangesBuilder*
.
new :: MonadIO m => m GlyphRangesBuilder Source #
Create an instance of builder
destroy :: MonadIO m => GlyphRangesBuilder -> m () Source #
Destroy an instance of builder
Should be used after font atlas building.
addText :: MonadIO m => GlyphRangesBuilder -> CString -> m () Source #
Add string (each character of the UTF-8 string are added)
addRanges :: MonadIO m => GlyphRangesBuilder -> GlyphRanges -> m () Source #
Add ranges, e.g. 'addRanges builder getGlyphRangesDefault' to force add all of ASCII/Latin+Ext
Extracting data
newtype GlyphRangesVector Source #
Glyph ranges vector handle to keep builder output
Wraps ImVectorImWchar*
.
GlyphRangesVector (Ptr ()) |
buildRangesVector :: MonadIO m => GlyphRangesBuilder -> m GlyphRangesVector Source #
Build new ranges and create ranges vector instance, containing them
fromRangesVector :: GlyphRangesVector -> GlyphRanges Source #
Extract glyph ranges from a vector
Should be used before vector destruction.
destroyRangesVector :: MonadIO m => GlyphRangesVector -> m () Source #
Destroy a ranges vector instance
Should be used after font atlas building.