Cofnięcie fontu DejaVu — przywraca działający interfejs
This commit is contained in:
1 parent
f178589c00
commit
bdf1a1fdd5
1 file changed
-30
@@ -687,34 +687,6 @@ class XSayATC:
|
||||
xp.log(f"[XSayATC] Blad ustawiania VR: {e}")
|
||||
|
||||
# ---------------------------- Okno ImGui ----------------------------
|
||||
def _setup_polish_font(self, win):
|
||||
"""Laduje font z polskimi znakami (DejaVu Sans) zamiast domyslnego."""
|
||||
if win is None or getattr(win, "imgui_context", None) is None:
|
||||
return
|
||||
font_paths = [
|
||||
"/usr/share/fonts/TTF/DejaVuSans.ttf",
|
||||
"/usr/share/fonts/liberation/LiberationSans-Regular.ttf",
|
||||
"/usr/share/fonts/noto/NotoSans-Regular.ttf",
|
||||
]
|
||||
font_path = None
|
||||
for p in font_paths:
|
||||
if os.path.exists(p):
|
||||
font_path = p
|
||||
break
|
||||
if font_path is None:
|
||||
xp.log("[XSayATC] Nie znaleziono fontu TTF z polskimi znakami.")
|
||||
return
|
||||
try:
|
||||
imgui.set_current_context(win.imgui_context)
|
||||
io = imgui.get_io()
|
||||
io.fonts.clear_fonts()
|
||||
io.fonts.add_font_from_file_ttf(
|
||||
font_path, 15.0, glyph_ranges=io.fonts.get_glyph_ranges_latin())
|
||||
win.renderer.refresh_font_texture()
|
||||
xp.log(f"[XSayATC] Zaladowano font: {font_path}")
|
||||
except Exception as e:
|
||||
xp.log(f"[XSayATC] Blad ladowania fontu: {e}")
|
||||
|
||||
def _draw(self, windowID, refCon):
|
||||
imgui.text("XSayATC - lokalny ATC")
|
||||
imgui.separator()
|
||||
@@ -831,7 +803,6 @@ class XSayATC:
|
||||
visible=0, draw=self._draw, refCon=None,
|
||||
decoration=1, layer=1)
|
||||
self._imgui_window.setTitle("XSayATC")
|
||||
self._setup_polish_font(self._imgui_window)
|
||||
|
||||
# Okno konfiguracji (ukryte domyslnie)
|
||||
self._config_window = ImguiWindow(
|
||||
@@ -839,7 +810,6 @@ class XSayATC:
|
||||
visible=0, draw=self._draw_config, refCon=None,
|
||||
decoration=1, layer=1)
|
||||
self._config_window.setTitle("XSayATC - Konfiguracja")
|
||||
self._setup_polish_font(self._config_window)
|
||||
|
||||
# Ustaw limity zmiany rozmiaru
|
||||
for win in (self._imgui_window, self._config_window):
|
||||
|
||||
Reference in new issue
Block a user