@@ -470,47 +470,15 @@ def refresh_styles(self):
470470
471471 def refresh_fonts (self ):
472472 imgui .io .fonts .clear ()
473- max_tex_size = gl .glGetIntegerv (gl .GL_MAX_TEXTURE_SIZE )
474- imgui .io .fonts .tex_desired_width = max_tex_size
475- win_w , win_h = glfw .get_window_size (self .window )
476- fb_w , fb_h = glfw .get_framebuffer_size (self .window )
477- font_scaling_factor = max (fb_w / win_w , fb_h / win_h )
478- imgui .io .font_global_scale = 1 / font_scaling_factor
479- base_font = hello_imgui .asset_file_full_path ("fonts/Roboto/Roboto-Regular.ttf" )
480- fa6_font = hello_imgui .asset_file_full_path ("fonts/Font_Awesome_6_Free-Solid-900.otf" )
481- fa6_config = imgui .ImFontConfig ()
482- fa6_config .merge_mode = True
483- fa6_range = [ifa6 .ICON_MIN_FA , ifa6 .ICON_MAX_FA , 0 ]
484- msgbox_range = []
485- for x in [ifa6 .ICON_FA_CIRCLE_QUESTION , ifa6 .ICON_FA_CIRCLE_INFO , ifa6 .ICON_FA_TRIANGLE_EXCLAMATION ]:
486- msgbox_range .append (ord (x ))
487- msgbox_range .append (ord (x ))
488- msgbox_range .append (0 )
489- size_18 = 18 * font_scaling_factor * self .size_mult
490- size_28 = 28 * font_scaling_factor * self .size_mult
491- size_69 = 69 * font_scaling_factor * self .size_mult
492- # Default font + icons
493- imgui .io .fonts .add_font_from_file_ttf (str (base_font ), size_18 )
494- imgui .io .fonts .add_font_from_file_ttf (str (fa6_font ), size_18 , font_cfg = fa6_config , glyph_ranges_as_int_list = fa6_range )
495- # Big font + more glyphs
496- self .big_font = \
497- imgui .io .fonts .add_font_from_file_ttf (str (base_font ), size_28 )
498- imgui .io .fonts .add_font_from_file_ttf (str (fa6_font ), size_28 , font_cfg = fa6_config , glyph_ranges_as_int_list = fa6_range )
499- # MsgBox type icons
500- self .icon_font = msg_box .icon_font = \
501- imgui .io .fonts .add_font_from_file_ttf (str (fa6_font ), size_69 , glyph_ranges_as_int_list = msgbox_range )
502- try :
503- pixels = imgui .io .fonts .get_tex_data_as_rgba32 ()
504- tex_height ,tex_width = pixels .shape [0 :2 ]
505- except SystemError :
506- tex_height = 1
507- max_tex_size = 0
508- if tex_height > max_tex_size :
509- self .size_mult = 1.0
510- return self .refresh_fonts ()
473+ self ._big_font_size_multiplier = 1.75
474+ self ._icon_font_size_multiplier = 4.2
475+
476+ normal_size = 16.
477+ hello_imgui .load_font ("fonts/Roboto/Roboto-Regular.ttf" , normal_size )
478+ # add icons
479+ hello_imgui .load_font ("fonts/Font_Awesome_6_Free-Solid-900.otf" , normal_size , hello_imgui .FontLoadingParams (merge_to_last_font = True ))
480+
511481 # now refresh font texture
512- imgui .backends .opengl3_destroy_fonts_texture ()
513- imgui .backends .opengl3_create_fonts_texture ()
514482 if self .recording_list is not None :
515483 self .recording_list .font_changed ()
516484
@@ -868,7 +836,7 @@ def draw_unopened_interface(self):
868836 but_x = (avail .x - 2 * but_width - 10 * imgui .style .item_spacing .x ) / 2
869837 but_y = (avail .y - but_height ) / 2
870838
871- imgui .push_font (self .big_font )
839+ imgui .push_font (None , imgui . get_style (). font_size_base * self ._big_font_size_multiplier )
872840 text = "Drag and drop a glassesValidator folder or use the below buttons"
873841 size = imgui .calc_text_size (text )
874842 imgui .set_cursor_pos_x ((avail .x - size .x ) / 2 )
@@ -897,7 +865,7 @@ def draw_unopened_interface(self):
897865 def draw_select_eye_tracker_popup (self , combo_value , eye_tracker ):
898866 spacing = 2 * imgui .style .item_spacing .x
899867 color = (0.45 , 0.09 , 1.00 , 1.00 )
900- imgui .push_font (self .icon_font )
868+ imgui .push_font (None , imgui . get_style (). font_size_base * self ._icon_font_size_multiplier )
901869 imgui .text_colored (color , ifa6 .ICON_FA_CIRCLE_INFO )
902870 imgui .pop_font ()
903871 imgui .same_line (spacing = spacing )
@@ -923,7 +891,7 @@ def draw_select_eye_tracker_popup(self, combo_value, eye_tracker):
923891 def draw_preparing_recordings_for_import_popup (self , eye_tracker ):
924892 spacing = 2 * imgui .style .item_spacing .x
925893 color = (0.45 , 0.09 , 1.00 , 1.00 )
926- imgui .push_font (self .icon_font )
894+ imgui .push_font (None , imgui . get_style (). font_size_base * self ._icon_font_size_multiplier )
927895 imgui .text_colored (color , ifa6 .ICON_FA_CIRCLE_INFO )
928896 imgui .pop_font ()
929897 imgui .same_line (spacing = spacing )
@@ -1046,7 +1014,7 @@ def popup_content():
10461014 _general_imgui .icon_texture .render (_200 , _200 , rounding = globals .settings .style_corner_radius )
10471015 imgui .same_line ()
10481016 imgui .begin_group ()
1049- imgui .push_font (self .big_font )
1017+ imgui .push_font (None , imgui . get_style (). font_size_base * self ._big_font_size_multiplier )
10501018 imgui .text ("glassesValidator" )
10511019 imgui .pop_font ()
10521020 imgui .text (f"Version { globals .version } " )
@@ -1094,7 +1062,7 @@ def popup_content():
10941062 imgui .spacing ()
10951063 imgui .spacing ()
10961064 imgui .dummy ((0 , self .scaled (10 )))
1097- imgui .push_font (self .big_font )
1065+ imgui .push_font (None , imgui . get_style (). font_size_base * self ._big_font_size_multiplier )
10981066 size = imgui .calc_text_size ("Reference" )
10991067 imgui .set_cursor_pos_x ((width - size .x + imgui .style .scrollbar_size ) / 2 )
11001068 imgui .text ("Reference" )
0 commit comments