Skip to content

Commit

Permalink
custom_fonts example
Browse files Browse the repository at this point in the history
  • Loading branch information
wookay committed Jul 22, 2020
1 parent 1b66f46 commit 6df7431
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions examples/custom_fonts.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using Poptart.Desktop
using CImGui

function Desktop.custom_fonts(::Application)
fonts = CImGui.GetIO().Fonts
glyph_ranges = CImGui.GetGlyphRangesDefault(fonts)
# GetGlyphRangesKorean
# GetGlyphRangesJapanese
# GetGlyphRangesChineseFull
# GetGlyphRangesChineseSimplifiedCommon
# GetGlyphRangesCyrillic
# GetGlyphRangesThai
font_path = normpath(pathof(CImGui), "../..", "fonts", "Roboto-Medium.ttf")
CImGui.AddFontFromFileTTF(fonts, font_path, 25, C_NULL, glyph_ranges)
end

app = Application()
push!(first(app.windows).items, InputText(buf="Hello world"))

Desktop.exit_on_esc() = true
Base.JLOptions().isinteractive==0 && wait(app.closenotify)

0 comments on commit 6df7431

Please sign in to comment.