The ProggyClean font embedded in ImGui has only Latin (presumably ASCII) glyphs, and ImGui doesn't have a mechanism for automatically referencing system fallback fonts. To render non-Latin fonts thus takes some manual work.
Aesthetically, the free PixelMplus 12px font seems to fit well in addition to Proggy for Latin, but I have yet to figure out a way to get it to render pixel perfectly. The 10px version renders correctly when the size is set to 11, so there's likely some value that works. It'll take some experimentation.
We would also need to a general way to load an appropriate font for any language, not just Japanese. Given that there are several hurdles to overcome before it's ready at all, I'll just leave this code here (under fonts.AddFontDefault () in ImGui.fs) as a starting point.
// add Japanese font
let config: ImFontConfigPtr = ImGuiNative.ImFontConfig_ImFontConfig()
config.PixelSnapH <- true
config.MergeMode <- true
try
fonts.AddFontFromFileTTF(@"PixelMplus12-Regular.ttf", 13.5f, config, fonts.GetGlyphRangesJapanese()) |> ignore<ImFontPtr>
finally
config.Destroy()
Here's also a Japanese blog post on how someone used a GDI32 call to find the file location of a built-in Windows Japanese font. This may be something to consider, as although PixelMPlus is just over 1mb, most CJK fonts are 10mb+, so we may want to use system fonts by default if we move away from monochrome monospace fonts.
As per our discussion, for Japanese users, it seems like it would make sense to leave most of the UI in English, except text-heavy dialog boxes and logs and such. But just for fun, here's a screenshot of how it might look if we were to translate some UI elements (with the nasty font smoothing issue not yet resolved):
The ProggyClean font embedded in ImGui has only Latin (presumably ASCII) glyphs, and ImGui doesn't have a mechanism for automatically referencing system fallback fonts. To render non-Latin fonts thus takes some manual work.
Aesthetically, the free PixelMplus 12px font seems to fit well in addition to Proggy for Latin, but I have yet to figure out a way to get it to render pixel perfectly. The 10px version renders correctly when the size is set to 11, so there's likely some value that works. It'll take some experimentation.
We would also need to a general way to load an appropriate font for any language, not just Japanese. Given that there are several hurdles to overcome before it's ready at all, I'll just leave this code here (under
fonts.AddFontDefault ()
in ImGui.fs) as a starting point.Here's also a Japanese blog post on how someone used a GDI32 call to find the file location of a built-in Windows Japanese font. This may be something to consider, as although PixelMPlus is just over 1mb, most CJK fonts are 10mb+, so we may want to use system fonts by default if we move away from monochrome monospace fonts.
As per our discussion, for Japanese users, it seems like it would make sense to leave most of the UI in English, except text-heavy dialog boxes and logs and such. But just for fun, here's a screenshot of how it might look if we were to translate some UI elements (with the nasty font smoothing issue not yet resolved):