mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Remove unneeded font changing code
Welp, I just found out that Godot's font resources have fallback options. Better late than never, I guess.
This commit is contained in:
parent
563aab3137
commit
086c6c5b9c
|
@ -1,9 +0,0 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/CJK/DroidSansFallback.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
|
@ -1,9 +0,0 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/CJK/DroidSansFallback.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 10
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
|
@ -1,9 +0,0 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/Roboto-Bold.ttf" type="DynamicFontData" id=1]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
Binary file not shown.
|
@ -1,9 +1,11 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
[gd_resource type="DynamicFont" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/Roboto-Italic.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://assets/fonts/DroidSansFallback.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
fallback/0 = ExtResource( 2 )
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
[gd_resource type="DynamicFont" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://assets/fonts/DroidSansFallback.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[resource]
|
||||
size = 12
|
||||
use_mipmaps = true
|
||||
use_filter = true
|
||||
font_data = ExtResource( 1 )
|
||||
fallback/0 = ExtResource( 2 )
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
[gd_resource type="DynamicFont" load_steps=2 format=2]
|
||||
[gd_resource type="DynamicFont" load_steps=3 format=2]
|
||||
|
||||
[ext_resource path="res://assets/fonts/Roboto-Regular.ttf" type="DynamicFontData" id=1]
|
||||
[ext_resource path="res://assets/fonts/DroidSansFallback.ttf" type="DynamicFontData" id=2]
|
||||
|
||||
[resource]
|
||||
size = 10
|
||||
use_mipmaps = true
|
||||
font_data = ExtResource( 1 )
|
||||
fallback/0 = ExtResource( 2 )
|
||||
|
|
|
@ -327,7 +327,3 @@ func update_hint_tooltips() -> void:
|
|||
|
||||
for tip in ui_tooltips:
|
||||
tip.hint_tooltip = tr(ui_tooltips[tip]) % tip.shortcut.get_as_text()
|
||||
|
||||
|
||||
func is_cjk(locale: String) -> bool:
|
||||
return "zh" in locale or "ko" in locale or "ja" in locale
|
||||
|
|
|
@ -26,8 +26,6 @@ const LANGUAGES_DICT := {
|
|||
}
|
||||
|
||||
var loaded_locales: Array
|
||||
onready var latin_font = preload("res://assets/fonts/Roboto-Regular.tres")
|
||||
onready var cjk_font = preload("res://assets/fonts/CJK/DroidSansFallback-Regular.tres")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
|
@ -47,10 +45,6 @@ func _ready() -> void:
|
|||
button.hint_tooltip = LANGUAGES_DICT[locale][1]
|
||||
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
|
||||
button.group = button_group
|
||||
if Global.is_cjk(locale):
|
||||
button.add_font_override("font", cjk_font)
|
||||
else:
|
||||
button.add_font_override("font", latin_font)
|
||||
add_child(button)
|
||||
|
||||
# Load language
|
||||
|
@ -65,11 +59,6 @@ func _ready() -> void:
|
|||
else: # If the user doesn't have a language preference, set it to their OS' locale
|
||||
TranslationServer.set_locale(OS.get_locale())
|
||||
|
||||
if Global.is_cjk(TranslationServer.get_locale()):
|
||||
Global.control.theme.default_font = cjk_font
|
||||
else:
|
||||
Global.control.theme.default_font = latin_font
|
||||
|
||||
for child in get_children():
|
||||
if child is Button:
|
||||
child.connect("pressed", self, "_on_Language_pressed", [child.get_index()])
|
||||
|
@ -83,11 +72,6 @@ func _on_Language_pressed(index: int) -> void:
|
|||
else:
|
||||
TranslationServer.set_locale(loaded_locales[index - 1])
|
||||
|
||||
if Global.is_cjk(TranslationServer.get_locale()):
|
||||
Global.control.theme.default_font = cjk_font
|
||||
else:
|
||||
Global.control.theme.default_font = latin_font
|
||||
|
||||
Global.config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
|
||||
Global.config_cache.save("user://cache.ini")
|
||||
|
||||
|
|
|
@ -20,11 +20,6 @@ onready var license_text: TextEdit = $AboutUI/Credits/Licenses/LicenseText
|
|||
onready var slogan: Label = $AboutUI/IconsButtons/SloganAndLinks/VBoxContainer/PixeloramaSlogan
|
||||
onready var copyright_label: Label = $AboutUI/Copyright
|
||||
|
||||
onready var latin_font_italic = preload("res://assets/fonts/Roboto-Italic.tres")
|
||||
onready var cjk_font = preload("res://assets/fonts/CJK/DroidSansFallback-Regular.tres")
|
||||
onready var latin_font_small = preload("res://assets/fonts/Roboto-Small.tres")
|
||||
onready var cjk_font_small = preload("res://assets/fonts/CJK/DroidSansFallback-Small.tres")
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
create_donors()
|
||||
|
@ -38,13 +33,6 @@ func _ready() -> void:
|
|||
func _on_AboutDialog_about_to_show() -> void:
|
||||
window_title = tr("About Pixelorama") + " " + Global.current_version
|
||||
|
||||
if Global.is_cjk(TranslationServer.get_locale()):
|
||||
slogan.add_font_override("font", cjk_font)
|
||||
copyright_label.add_font_override("font", cjk_font_small)
|
||||
else:
|
||||
slogan.add_font_override("font", latin_font_italic)
|
||||
copyright_label.add_font_override("font", latin_font_small)
|
||||
|
||||
var groups_root := groups.create_item()
|
||||
var developers_button := groups.create_item(groups_root)
|
||||
var contributors_button := groups.create_item(groups_root)
|
||||
|
|
|
@ -23,15 +23,11 @@ var chosen_artwork: int
|
|||
var splash_art_texturerect: TextureRect
|
||||
var art_by_label: Button
|
||||
|
||||
onready var latin_font = preload("res://assets/fonts/Roboto-Small.tres")
|
||||
onready var cjk_font = preload("res://assets/fonts/CJK/DroidSansFallback-Small.tres")
|
||||
|
||||
|
||||
func _on_SplashDialog_about_to_show() -> void:
|
||||
splash_art_texturerect = find_node("SplashArt")
|
||||
art_by_label = find_node("ArtistName")
|
||||
var show_on_startup_button: CheckBox = find_node("ShowOnStartup")
|
||||
var copyright_label: Label = find_node("CopyrightLabel")
|
||||
|
||||
if Global.config_cache.has_section_key("preferences", "startup"):
|
||||
show_on_startup_button.pressed = !Global.config_cache.get_value("preferences", "startup")
|
||||
|
@ -40,13 +36,6 @@ func _on_SplashDialog_about_to_show() -> void:
|
|||
chosen_artwork = randi() % artworks.size()
|
||||
change_artwork(0)
|
||||
|
||||
if Global.is_cjk(TranslationServer.get_locale()):
|
||||
show_on_startup_button.add_font_override("font", cjk_font)
|
||||
copyright_label.add_font_override("font", cjk_font)
|
||||
else:
|
||||
show_on_startup_button.add_font_override("font", latin_font)
|
||||
copyright_label.add_font_override("font", latin_font)
|
||||
|
||||
get_stylebox("panel", "WindowDialog").bg_color = Global.control.theme.get_stylebox(
|
||||
"panel", "WindowDialog"
|
||||
).bg_color
|
||||
|
|
Loading…
Reference in a new issue