-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Иди нахуй винда со своей ебучей кодировкой
- Loading branch information
1 parent
5c3cdd0
commit d9148a6
Showing
3 changed files
with
43 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,31 @@ | ||
import sys | ||
|
||
import dearpygui.dearpygui as dpg | ||
from root_path import ROOT_PATH | ||
|
||
|
||
class FontManager: | ||
|
||
@staticmethod | ||
def load_fonts(): | ||
with dpg.font_registry(): | ||
with dpg.font(str(ROOT_PATH / 'Content' / 'Client' / 'fronts' / 'Monocraft' / 'Monocraft.otf'), 13) as default_font: | ||
dpg.add_font_range_hint(dpg.mvFontRangeHint_Default) | ||
dpg.add_font_range_hint(dpg.mvFontRangeHint_Cyrillic) | ||
|
||
|
||
dpg.add_font_range(0x0391, 0x03C9) #Greek character range | ||
dpg.add_font_range(0x2070, 0x209F) #Range of upper and lower numerical indices | ||
|
||
if sys.platform == 'win32': # Иди нахуй винда | ||
_remap_chars() | ||
|
||
dpg.bind_font(default_font) | ||
|
||
def _remap_chars(): | ||
biglet = 0x0410 | ||
for i1 in range(0x00C0, 0xE0): | ||
dpg.add_char_remap(i1, biglet) | ||
dpg.add_char_remap(i1 + 0x20, biglet + 0x20) | ||
biglet += 1 | ||
|
||
dpg.add_char_remap(0x00A8, 0x0401) # Ё | ||
dpg.add_char_remap(0x00B8, 0x0451) # ё |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import sys | ||
|
||
|
||
def decode_string(instr : str): | ||
"""Данную функцию нужно вызывать каждый раз при получении данных от пользователя (input_text). Винда у нас особая и не работает по нормальному. Язык стола зачарований из майна нам не нужен (и тот который блять на винде только) | ||
""" | ||
if not sys.platform == 'win32': # Иди нахуй винда | ||
return instr | ||
|
||
translation_table = str.maketrans({ | ||
chr(i): chr(i + 0x350) for i in range(0x00C0, 0x100) | ||
}) | ||
|
||
translation_table.update({ | ||
0x00B8: chr(0x0451), | ||
0x00A8: chr(0x0401) | ||
}) | ||
|
||
return instr.translate(translation_table) |