Show Japanese text and close the gap in the top bar
Build / test (push) Successful in 35s
Build / build (push) Successful in 1m12s

Godot's built-in font has no Japanese, so kanji in song names showed as
boxes. The theme now sets Godot's own Open Sans SemiBold as its default
font, with Noto Sans JP Medium as fallback. The Noto file's line metrics
are set to Open Sans's, so line heights stay the same and every other
screen is pixel-identical; fonts/README.md explains how to redo it.

Search and Sync move right to where the Statistics button was.
This commit is contained in:
Sansan committed 2026-10-06 23:57:37 +02:00
1 parent a21b6e9b22
commit b40b160fde
13 files changed
+325 -15

No files matched your search

+92
View File
@@ -0,0 +1,92 @@
This Font Software is licensed under the SIL Open Font License,
Version 1.1.
This license is copied below, and is also available with a FAQ at:
http://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://c325cbuhy0n3d"
path="res://.godot/imported/NotoSansJP-Medium.otf-48029a81cfbb1e3a1e09d84067c2726b.fontdata"
[deps]
source_file="res://fonts/NotoSansJP-Medium.otf"
dest_files=["res://.godot/imported/NotoSansJP-Medium.otf-48029a81cfbb1e3a1e09d84067c2726b.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=1
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}
+88
View File
@@ -0,0 +1,88 @@
Copyright 2020 The Open Sans Project Authors (https://github.com/googlefonts/opensans)
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font
creation efforts of academic and linguistic communities, and to
provide a free and open framework in which fonts may be shared and
improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply to
any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software
components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to,
deleting, or substituting -- in part or in whole -- any of the
components of the Original Version, by changing formats or by porting
the Font Software to a new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed,
modify, redistribute, and sell modified and unmodified copies of the
Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components, in
Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the
corresponding Copyright Holder. This restriction only applies to the
primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created using
the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
Binary file not shown.
+36
View File
@@ -0,0 +1,36 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bu247t5hvmk2w"
path="res://.godot/imported/OpenSans-SemiBold.woff2-035244bfb0cae573e35cba9e3c76e652.fontdata"
[deps]
source_file="res://fonts/OpenSans-SemiBold.woff2"
dest_files=["res://.godot/imported/OpenSans-SemiBold.woff2-035244bfb0cae573e35cba9e3c76e652.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
disable_embedded_bitmaps=true
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
modulate_color_glyphs=false
hinting=1
subpixel_positioning=1
keep_rounding_remainders=true
oversampling=0.0
Fallbacks=null
fallbacks=[Resource("uid://c325cbuhy0n3d", "res://fonts/NotoSansJP-Medium.otf")]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}
+31
View File
@@ -0,0 +1,31 @@
# Fonts
The theme's default font (`themes/main_theme.tres`) is `OpenSans-SemiBold.woff2`, the
font Godot uses when a project sets none, saved from Godot so the game looks the same.
Text it has no letters for, such as Japanese, falls back to `NotoSansJP-Medium.otf`.
Both are under the SIL Open Font License, see `OpenSans-LICENSE.txt` and
`NotoSansJP-LICENSE.txt`.
`NotoSansJP-Medium.otf` is the Medium weight from
[noto-cjk](https://github.com/notofonts/noto-cjk/tree/main/Sans/SubsetOTF/JP), changed in
one way: its line metrics (`hhea` ascent and descent) are set to Open Sans's. Godot makes
every line as tall as the tallest font in the fallback chain, so with Noto's own, taller
metrics all text in the game would move down and rows would grow, even without any
Japanese on screen. The glyphs are unchanged. To update the font, download it again and
set the metrics with [fontTools](https://github.com/fonttools/fonttools):
```python
from fontTools.ttLib import TTFont
reference = TTFont("OpenSans-SemiBold.woff2") # needs the brotli package
noto = TTFont("NotoSansJP-Medium.otf")
scale = noto["head"].unitsPerEm / reference["head"].unitsPerEm
noto["hhea"].ascent = round(reference["hhea"].ascent * scale)
noto["hhea"].descent = round(reference["hhea"].descent * scale)
noto["hhea"].lineGap = 0
noto.save("NotoSansJP-Medium.otf")
```
`tests/integration/test_theme.gd` checks that Japanese has a font and that the line
height is still Godot's.
+4 -4
View File
@@ -38,9 +38,9 @@ text = "Music Player Randomizer"
[node name="SyncButton" type="Button" parent="." unique_id=1228313556]
layout_mode = 0
offset_left = 1442.0
offset_left = 1538.0
offset_top = 8.0
offset_right = 1512.0
offset_right = 1608.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
@@ -48,9 +48,9 @@ text = "Sync"
[node name="SearchButton" type="Button" parent="." unique_id=1782453581]
layout_mode = 0
offset_left = 1354.0
offset_left = 1450.0
offset_top = 8.0
offset_right = 1424.0
offset_right = 1520.0
offset_bottom = 48.0
focus_mode = 0
action_mode = 0
+10 -10
View File
@@ -3152,7 +3152,7 @@
},
"TopBar/SearchButton": {
"rect": [
1354.0,
1450.0,
8.0,
70.0,
40.0
@@ -3179,7 +3179,7 @@
},
"TopBar/SyncButton": {
"rect": [
1442.0,
1538.0,
8.0,
70.0,
40.0
@@ -6574,7 +6574,7 @@
},
"TopBar/SearchButton": {
"rect": [
1354.0,
1450.0,
8.0,
70.0,
40.0
@@ -6601,7 +6601,7 @@
},
"TopBar/SyncButton": {
"rect": [
1442.0,
1538.0,
8.0,
70.0,
40.0
@@ -10086,7 +10086,7 @@
},
"TopBar/SearchButton": {
"rect": [
1354.0,
1450.0,
8.0,
70.0,
40.0
@@ -10113,7 +10113,7 @@
},
"TopBar/SyncButton": {
"rect": [
1442.0,
1538.0,
8.0,
70.0,
40.0
@@ -15805,7 +15805,7 @@
},
"TopBar/SearchButton": {
"rect": [
1354.0,
1450.0,
8.0,
70.0,
40.0
@@ -15832,7 +15832,7 @@
},
"TopBar/SyncButton": {
"rect": [
1442.0,
1538.0,
8.0,
70.0,
40.0
@@ -23463,7 +23463,7 @@
},
"TopBar/SearchButton": {
"rect": [
1354.0,
1450.0,
8.0,
70.0,
40.0
@@ -23490,7 +23490,7 @@
},
"TopBar/SyncButton": {
"rect": [
1442.0,
1538.0,
8.0,
70.0,
40.0
+6 -1
View File
@@ -28,6 +28,11 @@ const SYNC_RESULT: Dictionary = {
"total_time": "00:00:03",
}
## Song names of the first soundtrack in the statistics, to show Japanese text.
const JAPANESE_SONGS: Array[String] = [
"時の回廊", "カエルのテーマ", "風の憧憬", "魔王決戦", "遥かなる時の彼方へ",
]
## The character pictures the fake server hands out.
const CHARACTERS_DIR: String = "res://characters"
@@ -84,7 +89,7 @@ static func soundtrack_statistics() -> Array[Dictionary]:
"song_uuid": "song-%d-%d" % [i, song],
"soundtrack_uuid": "soundtrack-%d" % i,
"soundtrack_name": SOUNDTRACKS[i],
"song_name": "Track %d" % (song + 1),
"song_name": JAPANESE_SONGS[song] if i == 0 else "Track %d" % (song + 1),
"times_played": maxi(0, played - song * 2),
})
var soundtrack: Dictionary = {
+16
View File
@@ -119,3 +119,19 @@ func test_main_window_background_comes_from_the_theme_and_lets_clicks_through()
assert_int(background.mouse_filter).is_equal(Control.MOUSE_FILTER_IGNORE)
assert_float(background.anchor_right).is_equal(1.0)
assert_float(background.anchor_bottom).is_equal(1.0)
func test_default_font_shows_japanese() -> void:
var font: Font = _theme.default_font
for character: String in "幕開けミッション":
var found: bool = font.fallbacks.any(
func(fallback: Font) -> bool: return fallback.has_char(character.unicode_at(0)))
assert_bool(found).override_failure_message("No font has " + character).is_true()
func test_japanese_fallback_keeps_the_line_height_of_godots_font() -> void:
var builtin: Font = ThemeDB.get_default_theme().default_font
for size: int in [16, 18, 20, 25, 35, 50]:
assert_float(_theme.default_font.get_height(size)) \
.override_failure_message("Line height at size %d" % size) \
.is_equal(builtin.get_height(size))
+3
View File
@@ -13,6 +13,9 @@ checks that it stays that way.
sizes in the theme editor. Keep every style's name.
3. Point Project Settings → GUI → Theme → Custom at the copy.
The **font** is the theme's default font, Godot's own Open Sans with Noto Sans JP for
Japanese text; see `fonts/README.md`.
Icons (play, restart, add player, the slider and switch knobs) are not part of the theme;
they come from the image files in `icons/` and Godot's built-in theme.
+3
View File
@@ -1,5 +1,7 @@
[gd_resource type="Theme" format=3]
[ext_resource type="FontFile" path="res://fonts/OpenSans-SemiBold.woff2" id="1_default_font"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_vxwtt"]
content_margin_left = 4.0
content_margin_top = 4.0
@@ -748,6 +750,7 @@ corner_radius_bottom_right = 6
corner_radius_bottom_left = 6
[resource]
default_font = ExtResource("1_default_font")
Button/colors/font_color = Color(0.875, 0.875, 0.875, 1)
Button/colors/font_disabled_color = Color(0.875, 0.875, 0.875, 0.5)
Button/colors/font_focus_color = Color(0.95, 0.95, 0.95, 1)