# CImGui and special characters (unicode)

**URL:** <https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476>\
**Category:** General Usage\
**Created:** [November 2, 2020, 8:18pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476 "2020-11-02T20:18:45Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 2, 2020, 8:18pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/1 "2020-11-02T20:18:46Z")

</div>

I try to display some unicode characters in CImGui, but I am failing.  
This is the simple code mainly from the demo.jl:

```julia
using GLFW
using ModernGL
using CSyntax
using CSyntax.CStatic

using CImGui
using CImGui.GLFWBackend
using CImGui.OpenGLBackend

@static if Sys.isapple()
    # OpenGL 3.2 + GLSL 150
    tmp_glsl_version = 150
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 2)
    GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # required on Mac
else
    # OpenGL 3.0 + GLSL 130
    tmp_glsl_version = 130
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 0)
    # GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    # GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # 3.0+ only
    GLFW.WindowHint(GLFW.FOCUSED,GL_TRUE)
end
const glsl_version=tmp_glsl_version

# setup GLFW error callback
error_callback(err::GLFW.GLFWError) = @error "GLFW ERROR: code $(err.code) msg: $(err.description)"
GLFW.SetErrorCallback(error_callback)

# create window
window = GLFW.CreateWindow(1100, 720, "PlayGround")

@assert window != C_NULL
GLFW.MakeContextCurrent(window)
GLFW.SwapInterval(1) # enable vsync

# setup Dear ImGui context
ctx = CImGui.CreateContext()

# setup Dear ImGui style
CImGui.StyleColorsClassic()

#
# start to build th font:
#

builder=CImGui.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder()
CImGui.ImFontGlyphRangesBuilder_AddText(builder,"????","") 
CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
ranges=CImGui.ImVector_ImWchar_create()
CImGui.ImFontGlyphRangesBuilder_BuildRanges(builder, ranges)

#fonts_dir = joinpath(pathof(CImGui), "..","..","fonts")
fonts_dir = raw"c:\Windows\Fonts";
fonts = CImGui.GetIO().Fonts

CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "arial.ttf"), 16, C_NULL, ranges )
#CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "arial.ttf"), 16, C_NULL, CImGui.GetGlyphRangesChineseSimplifiedCommon(fonts) )

CImGui.Build(fonts)
default_font = CImGui.AddFontDefault(fonts)
#@assert default_font != C_NULL

# setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true)
ImGui_ImplOpenGL3_Init(glsl_version)

try
    clear_color = Cfloat[0.45, 0.55, 0.60, 1.00]

    while !GLFW.WindowShouldClose(window)
        GLFW.PollEvents()

        # start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame()
        ImGui_ImplGlfw_NewFrame()
        CImGui.NewFrame()
        CImGui.SetNextWindowSize(CImGui.ImVec2(350.0,200.0),CImGui.ImGuiCond_Once);

        CImGui.Begin("Special strings")
        CImGui.Text("????")
        CImGui.Text("p ? ? ? ?")
        CImGui.End()

        # rendering
        CImGui.Render()
        GLFW.MakeContextCurrent(window)
        display_w, display_h = GLFW.GetFramebufferSize(window)
        glViewport(0, 0, display_w, display_h)
        glClearColor(clear_color...)
        glClear(GL_COLOR_BUFFER_BIT)
        ImGui_ImplOpenGL3_RenderDrawData(CImGui.GetDrawData())

        GLFW.MakeContextCurrent(window)
        GLFW.SwapBuffers(window)
    end

catch e
    @error "Error in renderloop!" exception=e
    Base.show_backtrace(stderr, catch_backtrace())
    display_close(display)
finally
    ImGui_ImplOpenGL3_Shutdown()
    ImGui_ImplGlfw_Shutdown()
    CImGui.DestroyContext(ctx)
    GLFW.DestroyWindow(window)
end

```

It fails with the following error:

```julia
Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x70c4fe49 -- _ZN5ImGui14SetCurrentFontEP6ImFont at C:\Users\Oli\.julia\artifacts\d47e9affaed6dd0e59dff721ebb86dd8347b057f\bin\libimgui-cpp.dll (unknown line)
in expression starting at REPL[41]:1
_ZN5ImGui14SetCurrentFontEP6ImFont at C:\Users\Oli\.julia\artifacts\d47e9affaed6dd0e59dff721ebb86dd8347b057f\bin\libimgui-cpp.dll (unknown line)
_ZN5ImGui8NewFrameEv at C:\Users\Oli\.julia\artifacts\d47e9affaed6dd0e59dff721ebb86dd8347b057f\bin\libimgui-cpp.dll (unknown line)
igNewFrame at C:\Users\Oli\.julia\packages\CImGui\tJ4ZL\gen\libcimgui_api.jl:54 [inlined]
NewFrame at C:\Users\Oli\.julia\packages\CImGui\tJ4ZL\src\wrapper.jl:54 [inlined]
top-level scope at .\REPL[41]:100:

```

Does anybody know what’s the proper way to display unicode characters in a CImGui window?

The following code works but display only ? for each unicode character:

```julia
using GLFW
using ModernGL
using CSyntax
using CSyntax.CStatic

using CImGui
using CImGui.GLFWBackend
using CImGui.OpenGLBackend

@static if Sys.isapple()
    # OpenGL 3.2 + GLSL 150
    tmp_glsl_version = 150
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 2)
    GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # required on Mac
else
    # OpenGL 3.0 + GLSL 130
    tmp_glsl_version = 130
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 0)
    # GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    # GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # 3.0+ only
    GLFW.WindowHint(GLFW.FOCUSED,GL_TRUE)
end
const glsl_version=tmp_glsl_version

# setup GLFW error callback
error_callback(err::GLFW.GLFWError) = @error "GLFW ERROR: code $(err.code) msg: $(err.description)"
GLFW.SetErrorCallback(error_callback)

# create window
window = GLFW.CreateWindow(1100, 720, "PlayGround")

@assert window != C_NULL
GLFW.MakeContextCurrent(window)
GLFW.SwapInterval(1) # enable vsync

# setup Dear ImGui context
ctx = CImGui.CreateContext()

# setup Dear ImGui style
CImGui.StyleColorsClassic()

#
# start to build th font:
#

#builder=CImGui.ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder()
#CImGui.ImFontGlyphRangesBuilder_AddText(builder,"????","") 
#CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
#CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
#CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
#CImGui.ImFontGlyphRangesBuilder_AddChar(builder,'?')
#ranges=CImGui.ImVector_ImWchar_create()
#CImGui.ImFontGlyphRangesBuilder_BuildRanges(builder, ranges)

#fonts_dir = joinpath(pathof(CImGui), "..","..","fonts")
fonts_dir = raw"c:\Windows\Fonts";
fonts = CImGui.GetIO().Fonts

#CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "arial.ttf"), 16, C_NULL, ranges )
CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "arial.ttf"), 16, C_NULL, CImGui.GetGlyphRangesChineseSimplifiedCommon(fonts) )

CImGui.Build(fonts)
default_font = CImGui.AddFontDefault(fonts)
#@assert default_font != C_NULL

# setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true)
ImGui_ImplOpenGL3_Init(glsl_version)

try
    clear_color = Cfloat[0.45, 0.55, 0.60, 1.00]

    while !GLFW.WindowShouldClose(window)
        GLFW.PollEvents()

        # start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame()
        ImGui_ImplGlfw_NewFrame()
        CImGui.NewFrame()
        CImGui.SetNextWindowSize(CImGui.ImVec2(350.0,200.0),CImGui.ImGuiCond_Once);

        CImGui.Begin("Special strings")
        CImGui.Text("????")
        CImGui.Text("p ? ? ? ?")
        CImGui.End()

        # rendering
        CImGui.Render()
        GLFW.MakeContextCurrent(window)
        display_w, display_h = GLFW.GetFramebufferSize(window)
        glViewport(0, 0, display_w, display_h)
        glClearColor(clear_color...)
        glClear(GL_COLOR_BUFFER_BIT)
        ImGui_ImplOpenGL3_RenderDrawData(CImGui.GetDrawData())

        GLFW.MakeContextCurrent(window)
        GLFW.SwapBuffers(window)
    end

catch e
    @error "Error in renderloop!" exception=e
    Base.show_backtrace(stderr, catch_backtrace())
    display_close(display)
finally
    ImGui_ImplOpenGL3_Shutdown()
    ImGui_ImplGlfw_Shutdown()
    CImGui.DestroyContext(ctx)
    GLFW.DestroyWindow(window)
end

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 3, 2020, 1:30pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/2 "2020-11-03T13:30:06Z")

</div>

@Gnimuc , can you help?

---

<div class="post-metadata">

**Author:** ![Gnimuc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnimuc/32/2194_2.png) [@Gnimuc](https://discourse.julialang.org/u/Gnimuc)\
**Post date:** [November 4, 2020, 2:03am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/3 "2020-11-04T02:03:23Z")

</div>

> [@oheil](#):
>
> ```julia-auto
> CImGui.Text("????")
> CImGui.Text("p ? ? ? ?")
> 
> ```

It looks like you just let it display `????` here.

BTW, custom glyph ranges are not supported for now. [Unicode is not compatible? · Issue #30 · JuliaImGui/CImGui.jl · GitHub](https://github.com/Gnimuc/CImGui.jl/issues/30#issuecomment-667815903)

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 4, 2020, 10:46am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/4 "2020-11-04T10:46:19Z")

</div>

Oh, I didn’t see that. It’s a copy & paste problem, in the code it is:  
`CImGui.Text("π ϕ θ ♐ ☽")`  
for example.

> [@Gnimuc](#):
>
> BTW, custom glyph ranges are not supported for now.

Ok, in this case how to solve this? Which glyph range can one use?

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 4, 2020, 11:14am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/5 "2020-11-04T11:14:24Z")

</div>

Quoted from the issue:

> Custom glyph range APIs are not fully wrapped, so currently, there is no easy way to draw all unicode texts. I will revisit this if I have time.

Anything I can do? In which direction should I look? Any tips on how to setup a development environment for this?

---

<div class="post-metadata">

**Author:** ![Gnimuc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnimuc/32/2194_2.png) [@Gnimuc](https://discourse.julialang.org/u/Gnimuc)\
**Post date:** [November 4, 2020, 11:45am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/6 "2020-11-04T11:45:46Z")

</div>

[https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#using-custom-glyph-ranges](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md#using-custom-glyph-ranges)

The official fonts doc is a good starting point. If there are any C++ APIs that are used in the doc but not wrapped in CImGui.jl, basically you need to add corresponding C89 wrappers and regenerate the bindings.

[https://github.com/JuliaPackaging/Yggdrasil/blob/master/C/CImGui/bundled/wrapper/helper.c](https://github.com/JuliaPackaging/Yggdrasil/blob/master/C/CImGui/bundled/wrapper/helper.c)

---

<div class="post-metadata">

**Author:** ![Gnimuc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnimuc/32/2194_2.png) [@Gnimuc](https://discourse.julialang.org/u/Gnimuc)\
**Post date:** [November 4, 2020, 11:50am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/7 "2020-11-04T11:50:28Z")

</div>

> [@oheil](#):
>
> Which glyph range can one use?

I don’t know too. There are only a few glyph ranges that are provided by IMGUI, so one simple way is to just test them one-by-one.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 4, 2020, 11:55am UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/8 "2020-11-04T11:55:48Z")

</div>

Ok, the links and references aren’t that much helpfull. I will give it a try anyways, but I am not so optimistic about my skills ☹

---

<div class="post-metadata">

**Author:** ![Gnimuc](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gnimuc/32/2194_2.png) [@Gnimuc](https://discourse.julialang.org/u/Gnimuc)\
**Post date:** [November 4, 2020, 3:39pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/9 "2020-11-04T15:39:31Z")

</div>

@oheil I fixed your first example and it should be working now. Feel free to open a PR if you’d like to add some high-level helper functions for this.

```julia
fonts_dir = joinpath(homedir(), "Downloads")
fonts = CImGui.GetIO().Fonts
# default_font = CImGui.AddFontDefault(fonts)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Cousine-Regular.ttf"), 15)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "DroidSans.ttf"), 16)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Karla-Regular.ttf"), 10)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "ProggyTiny.ttf"), 10)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Roboto-Medium.ttf"), 16)
# @assert default_font != C_NULL

using CImGui.LibCImGui
ranges = ImVector_ImWchar_create()
ImVector_ImWchar_Init(ranges)
builder = ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder()
ImFontGlyphRangesBuilder_AddChar(builder, 'ϕ')
ImFontGlyphRangesBuilder_AddChar(builder, '♐')
ImFontGlyphRangesBuilder_AddRanges(builder, ImFontAtlas_GetGlyphRangesDefault(fonts))
ImFontGlyphRangesBuilder_BuildRanges(builder, ranges)
r = unsafe_wrap(Vector{ImVector_ImWchar}, ranges, 1)
CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "arial-unicode-ms.ttf"), 16, C_NULL, r[1].Data)

```

BTW, don’t forget to call the corresponding `destroy` methods in the finally block to clean up resources.

```julia
finally
    ImGui_ImplOpenGL3_Shutdown()
    ImGui_ImplGlfw_Shutdown()
    ImVector_ImWchar_destroy(ranges)
    ImFontGlyphRangesBuilder_destroy(builder)
    CImGui.DestroyContext(ctx)
    GLFW.DestroyWindow(window)
end

```

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 4, 2020, 7:23pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/10 "2020-11-04T19:23:30Z")

</div>

Awesome, it works now.

> [@Gnimuc](#):
>
> Feel free to open a PR if you’d like to add some high-level helper functions for this

Hmm, I don’t know. I’m afraid that this is quite tedious and my results are probably insufficient. Thanks a lot for your effort. Maybe I can help others when these question come up again.

---

<div class="post-metadata">

**Author:** ![oheil](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/oheil/32/220745_2.png) [@oheil](https://discourse.julialang.org/u/oheil)\
**Post date:** [November 5, 2020, 7:01pm UTC](https://discourse.julialang.org/t/cimgui-and-special-characters-unicode/49476/11 "2020-11-05T19:01:28Z")

</div>

Here is a _complete_ example.

I have added another recipe to add a complete glyph range using `AddRanges` (`ImFontGlyphRangesBuilder_AddRanges`) without the restriction, that you have to use the few available `GetGlyphRanges...` functions.

This is the snippet for this to add the complete glyph range of greek characters (0x0300-0x03ff):

```julia
struct GlyphRange
	first::ImWchar
	last::ImWchar
	zero::ImWchar
	function GlyphRange(first::ImWchar,last::ImWchar)
		new(first,last,0x0)
	end
end
greekRange=GlyphRange(0x0300, 0x03ff)
greekRange_ptr=Core.Ptr{ImWchar}(Base.pointer_from_objref(Ref(greekRange)))
ImFontGlyphRangesBuilder_AddRanges(builder, greekRange_ptr)

```

The following example adds glyphs with `AddText`, `AddChar`, `AddRanges` with arbitrary glyph range and `AddRanges` with `GetGlyphRangesDefault`. It uses the [font JuliaMono-Regular.ttf](https://github.com/cormullion/juliamono) which is on my system located in `c:\Windows\Fonts`, because I have installed it a while ago. The example is based on the `demo.jl` of package [CImGui.jl](https://github.com/Gnimuc/CImGui.jl) which has the benefit, that the Style Editor is available, which can be used to inspect the font:

```julia
using CImGui
using CImGui.LibCImGui
using CImGui.CSyntax
using CImGui.CSyntax.CStatic
using CImGui.GLFWBackend
using CImGui.OpenGLBackend
using CImGui.GLFWBackend.GLFW
using CImGui.OpenGLBackend.ModernGL
using Printf

@static if Sys.isapple()
    # OpenGL 3.2 + GLSL 150
    const glsl_version = 150
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 2)
    GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # required on Mac
else
    # OpenGL 3.0 + GLSL 130
    const glsl_version = 130
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MAJOR, 3)
    GLFW.WindowHint(GLFW.CONTEXT_VERSION_MINOR, 0)
    # GLFW.WindowHint(GLFW.OPENGL_PROFILE, GLFW.OPENGL_CORE_PROFILE) # 3.2+ only
    # GLFW.WindowHint(GLFW.OPENGL_FORWARD_COMPAT, GL_TRUE) # 3.0+ only
end

# setup GLFW error callback
error_callback(err::GLFW.GLFWError) = @error "GLFW ERROR: code $(err.code) msg: $(err.description)"
GLFW.SetErrorCallback(error_callback)

# create window
window = GLFW.CreateWindow(1280, 720, "Demo")
@assert window != C_NULL
GLFW.MakeContextCurrent(window)
GLFW.SwapInterval(1) # enable vsync

# setup Dear ImGui context
ctx = CImGui.CreateContext()

# setup Dear ImGui style
CImGui.StyleColorsDark()
# CImGui.StyleColorsClassic()
# CImGui.StyleColorsLight()

# load Fonts
# - If no fonts are loaded, dear imgui will use the default font. You can also load multiple fonts and use `CImGui.PushFont/PopFont` to select them.
# - `CImGui.AddFontFromFileTTF` will return the `Ptr{ImFont}` so you can store it if you need to select the font among multiple.
# - If the file cannot be loaded, the function will return C_NULL. Please handle those errors in your application (e.g. use an assertion, or display an error and quit).
# - The fonts will be rasterized at a given size (w/ oversampling) and stored into a texture when calling `CImGui.Build()`/`GetTexDataAsXXXX()``, which `ImGui_ImplXXXX_NewFrame` below will call.
# - Read 'fonts/README.txt' for more instructions and details.
#fonts_dir = joinpath(@ __DIR__ , "..", "fonts")
#fonts = CImGui.GetIO().Fonts
# default_font = CImGui.AddFontDefault(fonts)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Cousine-Regular.ttf"), 15)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "DroidSans.ttf"), 16)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Karla-Regular.ttf"), 10)
# CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "ProggyTiny.ttf"), 10)
#CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "Roboto-Medium.ttf"), 16)
# @assert default_font != C_NULL

#fonts_dir = joinpath(pathof(CImGui), "..","..","fonts")
fonts_dir = raw"c:\Windows\Fonts";
fonts = CImGui.GetIO().Fonts

builder=ImFontGlyphRangesBuilder_ImFontGlyphRangesBuilder()
ImFontGlyphRangesBuilder_AddText(builder, "♐", C_NULL)
ImFontGlyphRangesBuilder_AddChar(builder,'☽')
ImFontGlyphRangesBuilder_AddRanges(builder, ImFontAtlas_GetGlyphRangesDefault(fonts))

struct GlyphRange
	first::ImWchar
	last::ImWchar
	zero::ImWchar
	function GlyphRange(first::ImWchar,last::ImWchar)
		new(first,last,0x0)
	end
end
greekRange=GlyphRange(0x0300, 0x03ff)
greekRange_ptr=Core.Ptr{ImWchar}(Base.pointer_from_objref(Ref(greekRange)))
ImFontGlyphRangesBuilder_AddRanges(builder, greekRange_ptr)

ranges=ImVector_ImWchar_create()
ImVector_ImWchar_Init(ranges)
ImFontGlyphRangesBuilder_BuildRanges(builder, ranges)
r = unsafe_wrap(Vector{ImVector_ImWchar}, ranges, 1)
CImGui.AddFontFromFileTTF(fonts, joinpath(fonts_dir, "JuliaMono-Regular.ttf"), 16, C_NULL, r[1].Data )

CImGui.Build(fonts)
default_font = CImGui.AddFontDefault(fonts)
#@assert default_font != C_NULL

# setup Platform/Renderer bindings
ImGui_ImplGlfw_InitForOpenGL(window, true)
ImGui_ImplOpenGL3_Init(glsl_version)

try
    show_demo_window = true
    show_another_window = false
    clear_color = Cfloat[0.45, 0.55, 0.60, 1.00]
    while !GLFW.WindowShouldClose(window)
        GLFW.PollEvents()
        # start the Dear ImGui frame
        ImGui_ImplOpenGL3_NewFrame()
        ImGui_ImplGlfw_NewFrame()
        CImGui.NewFrame()

        # show the big demo window
        show_demo_window && @c CImGui.ShowDemoWindow(&show_demo_window)

        # show a simple window that we create ourselves.
        # we use a Begin/End pair to created a named window.
        @cstatic f=Cfloat(0.0) counter=Cint(0) begin
            CImGui.Begin("Hello, world!") # create a window called "Hello, world!" and append into it.
            CImGui.Text("This is some useful text.") # display some text
            @c CImGui.Checkbox("Demo Window", &show_demo_window) # edit bools storing our window open/close state
            @c CImGui.Checkbox("Another Window", &show_another_window)

            @c CImGui.SliderFloat("float", &f, 0, 1) # edit 1 float using a slider from 0 to 1
            CImGui.ColorEdit3("clear color", clear_color) # edit 3 floats representing a color
            CImGui.Button("Button") && (counter += 1)

            CImGui.SameLine()
            CImGui.Text("counter = $counter")
            CImGui.Text(@sprintf("Application average %.3f ms/frame (%.1f FPS)", 1000 / CImGui.GetIO().Framerate, CImGui.GetIO().Framerate))

            CImGui.End()
        end

        # show another simple window.
        if show_another_window
            @c CImGui.Begin("Another Window", &show_another_window) # pass a pointer to our bool variable (the window will have a closing button that will clear the bool when clicked)
            CImGui.Text("Hello from another window!")
            CImGui.Button("Close Me") && (show_another_window = false;)
            CImGui.End()
        end

		CImGui.Begin("Special characters")
		CImGui.Text("π ϕ θ ♐ ☽")
		CImGui.End()

        # rendering
        CImGui.Render()
        GLFW.MakeContextCurrent(window)
        display_w, display_h = GLFW.GetFramebufferSize(window)
        glViewport(0, 0, display_w, display_h)
        glClearColor(clear_color...)
        glClear(GL_COLOR_BUFFER_BIT)
        ImGui_ImplOpenGL3_RenderDrawData(CImGui.GetDrawData())

        GLFW.MakeContextCurrent(window)
        GLFW.SwapBuffers(window)
    end
catch e
    @error "Error in renderloop!" exception=e
    Base.show_backtrace(stderr, catch_backtrace())
finally
    ImGui_ImplOpenGL3_Shutdown()
    ImGui_ImplGlfw_Shutdown()
    ImVector_ImWchar_destroy(ranges)
    ImFontGlyphRangesBuilder_destroy(builder)
	CImGui.DestroyContext(ctx)
    GLFW.DestroyWindow(window)
end

```

Again thanks to @Gnimuc for his efforts which brought me on the path to glyphs.

For everybody who needs Unicode+CImGui, this is a must read [https://github.com/ocornut/imgui/blob/master/docs/FONTS.md](https://github.com/ocornut/imgui/blob/master/docs/FONTS.md). There is important information e.g. that your font atlas can grow too large which is crucial to know if you add large glyph ranges.

Everything about Unicode: [Unicode Technical Site](https://www.unicode.org/main.html)
