-
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
|
Since imgui v1.92, there is no need to specify ranges when loading fonts. For your example to work, you need to use a font that is able to display hebrew, such as https://fonts.google.com/noto/specimen/Noto+Sans+Hebrew for example And then this code can work: from imgui_bundle import immapp, imgui
font_default: imgui.ImFont
font_hebrew: imgui.ImFont
def gui():
imgui.push_font(font_default, 12)
imgui.text("Hello")
imgui.pop_font()
imgui.push_font(font_hebrew, 24)
imgui.text("אבגד")
imgui.pop_font()
def add_font():
global font_hebrew, font_default
# No need to specify ranges, since imgui v1.92
font_default = imgui.get_io().fonts.add_font_default()
font_hebrew = imgui.get_io().fonts.add_font_from_file_ttf(r"/Volumes/ramdisk/NotoSansHebrew-Black.ttf", 24) # Function missing the ranges argument?
def main():
runner_params = immapp.RunnerParams()
runner_params.callbacks.show_gui = gui
# runner_params.callbacks.post_init = add_font
runner_params.callbacks.load_additional_fonts = add_font # use this callback to add fonts
immapp.run(runner_params=runner_params)
if __name__ == "__main__":
main()
|
Beta Was this translation helpful? Give feedback.
-
|
I was a bit confused, but now it works like a charm, thank you very much for the clarification :) |
Beta Was this translation helpful? Give feedback.



Since imgui v1.92, there is no need to specify ranges when loading fonts.
Also, fonts can be used at any size (the size at which you load the font is actually not that useful: you can change the size whenever you call push_font.
For your example to work, you need to use a font that is able to display hebrew, such as https://fonts.google.com/noto/specimen/Noto+Sans+Hebrew for example
And then this code can work: