1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Changed CJK font and fixed some character issues

- The CJK font (for Chinese & Korean) was changed to DroidSansFallback from NotoSansCJKtc. This results in a much smaller exported `.pck` (over 10MB less)

- Fixed Chinese and Korean characters not displaying properly in the Splash dialog and the About dialog.
This commit is contained in:
Manolis Papadeas 2020-10-29 00:45:23 +02:00
parent 4e14c999d3
commit 0d5b4416a4
11 changed files with 44 additions and 22 deletions

View file

@ -19,12 +19,14 @@ PinyaColada, Rémi Verschelde (akien-mga), dasimonde
- `~` is now used as a random brush prefix instead of `%`. ([#362](https://github.com/Orama-Interactive/Pixelorama/pull/362))
- The default path of the dialogs for opening and saving is now the user's desktop folder.
- When there are errors in opening and saving files, the errors appear in the form of a popup dialog, instead of a notification or an OS alert.
- The CJK font (for Chinese & Korean) was changed to DroidSansFallback from NotoSansCJKtc. This results in a much smaller exported `.pck` (over 10MB less)
### Fixed
- Made .pxo saving safer. In case of a crash while parsing JSON data, the old .pxo file, if it exists, will no longer be overwritten and corrupted.
- Fixed issue where the user could grab, and could not let go of, the focus of guides even when they were invisible.
- Fixed issues where fully transparent color could not be picked. One of these cases was ([#364](https://github.com/Orama-Interactive/Pixelorama/issues/364)).
- Fixed "Export" option in the File menu not working properly when switching between projects, and not remembering the directory path and file name, if the project is an imported image and the tabs were switched.
- Fixed Chinese and Korean characters not displaying properly in the Splash dialog and the About dialog.
- Fixed crash when importing an incorrectly formatted GIMP Color Palette file. ([#363](https://github.com/Orama-Interactive/Pixelorama/issues/363))
<br><br>

View file

@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/fonts/CJK/NotoSansCJKtc-Regular.otf" type="DynamicFontData" id=1]
[ext_resource path="res://assets/fonts/CJK/DroidSansFallback.ttf" type="DynamicFontData" id=1]
[resource]
size = 12

View file

@ -1,6 +1,6 @@
[gd_resource type="DynamicFont" load_steps=2 format=2]
[ext_resource path="res://assets/fonts/CJK/NotoSansCJKtc-Regular.otf" type="DynamicFontData" id=1]
[ext_resource path="res://assets/fonts/CJK/DroidSansFallback.ttf" type="DynamicFontData" id=1]
[resource]
size = 10

Binary file not shown.

View file

@ -503,6 +503,10 @@ Hold %s to make a line""") % [InputMap.get_action_list("left_eraser_tool")[0].as
(%s)""") % InputMap.get_action_list("go_to_last_frame")[0].as_text()
func is_cjk(locale : String) -> bool:
return "zh" in locale or "ko" in locale
func _exit_tree() -> void:
config_cache.set_value("window", "screen", OS.current_screen)
config_cache.set_value("window", "maximized", OS.window_maximized || OS.window_fullscreen)

View file

@ -24,7 +24,8 @@ const languages_dict := {
}
var loaded_locales : Array
onready var cjk_font = preload("res://assets/fonts/CJK/NotoSansCJKtc-Regular.tres")
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:
@ -44,8 +45,10 @@ func _ready() -> void:
button.hint_tooltip = languages_dict[locale][1]
button.mouse_default_cursor_shape = Control.CURSOR_POINTING_HAND
button.group = button_group
if is_cjk(locale):
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
@ -60,10 +63,10 @@ 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 is_cjk(TranslationServer.get_locale()):
Global.control.theme.default_font = preload("res://assets/fonts/CJK/NotoSansCJKtc-Regular.tres")
if Global.is_cjk(TranslationServer.get_locale()):
Global.control.theme.default_font = cjk_font
else:
Global.control.theme.default_font = preload("res://assets/fonts/Roboto-Regular.tres")
Global.control.theme.default_font = latin_font
for child in get_children():
if child is Button:
@ -78,10 +81,10 @@ func _on_Language_pressed(index : int) -> void:
else:
TranslationServer.set_locale(loaded_locales[index - 1])
if is_cjk(TranslationServer.get_locale()):
Global.control.theme.default_font = preload("res://assets/fonts/CJK/NotoSansCJKtc-Regular.tres")
if Global.is_cjk(TranslationServer.get_locale()):
Global.control.theme.default_font = cjk_font
else:
Global.control.theme.default_font = preload("res://assets/fonts/Roboto-Regular.tres")
Global.control.theme.default_font = latin_font
Global.config_cache.set_value("preferences", "locale", TranslationServer.get_locale())
Global.config_cache.save("user://cache.ini")
@ -90,7 +93,3 @@ func _on_Language_pressed(index : int) -> void:
Global.update_hint_tooltips()
Global.preferences_dialog._on_PreferencesDialog_popup_hide()
Global.preferences_dialog._on_PreferencesDialog_about_to_show(true)
func is_cjk(locale : String) -> bool:
return "zh" in locale or "ko" in locale

View file

@ -51,7 +51,7 @@ size_flags_horizontal = 3
[node name="VBoxContainer" type="VBoxContainer" parent="HSplitContainer/ScrollContainer"]
margin_right = 498.0
margin_bottom = 384.0
margin_bottom = 24.0
size_flags_horizontal = 3
[node name="Startup" type="VBoxContainer" parent="HSplitContainer/ScrollContainer/VBoxContainer"]

View file

@ -12,6 +12,14 @@ onready var contributors : Tree = $AboutUI/Credits/Contributors/ContributorTree
onready var donors : Tree = $AboutUI/Credits/Donors/DonorTree
onready var translators : Tree = $AboutUI/Credits/Translators/TranslatorTree
onready var slogan_label : 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:
var contributor_root := contributors.create_item()
@ -53,6 +61,13 @@ 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_label.add_font_override("font", cjk_font)
copyright_label.add_font_override("font", cjk_font_small)
else:
slogan_label.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)

View file

@ -46,7 +46,7 @@ margin_top = 12.0
margin_right = 332.0
margin_bottom = 51.0
[node name="Pixelorama" type="Label" parent="AboutUI/IconsButtons/SloganAndLinks/VBoxContainer"]
[node name="PixeloramaSlogan" type="Label" parent="AboutUI/IconsButtons/SloganAndLinks/VBoxContainer"]
margin_right = 224.0
margin_bottom = 15.0
custom_fonts/font = ExtResource( 3 )

View file

@ -9,6 +9,9 @@ var artworks := {
var chosen_artwork = ""
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:
var splash_art_texturerect : TextureRect = Global.find_node_by_name(self, "SplashArt")
@ -26,12 +29,12 @@ func _on_SplashDialog_about_to_show() -> void:
art_by_label.text = tr("Art by: %s") % chosen_artwork
art_by_label.hint_tooltip = artworks[chosen_artwork][1]
if "zh" in TranslationServer.get_locale():
show_on_startup_button.add_font_override("font", preload("res://assets/fonts/CJK/NotoSansCJKtc-Small.tres"))
copyright_label.add_font_override("font", preload("res://assets/fonts/CJK/NotoSansCJKtc-Small.tres"))
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", preload("res://assets/fonts/Roboto-Small.tres"))
copyright_label.add_font_override("font", preload("res://assets/fonts/Roboto-Small.tres"))
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
get_stylebox("panel", "WindowDialog").border_color = Global.control.theme.get_stylebox("panel", "WindowDialog").border_color
@ -39,7 +42,6 @@ func _on_SplashDialog_about_to_show() -> void:
$Contents/ButtonsPatronsLogos/Buttons/OpenLastBtn.visible = false
func _on_ArtCredits_pressed() -> void:
OS.shell_open(artworks[chosen_artwork][1])