Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert the editor and default theme fonts to WOFF2 format to save space. #59510

Merged
merged 1 commit into from
Mar 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,17 @@ Comment: etcpak
Copyright: 2013-2021, Bartosz Taudul
License: BSD-3-clause

Files: ./thirdparty/fonts/DroidSans*.ttf
Files: ./thirdparty/fonts/DroidSans*.woff2
Comment: DroidSans font
Copyright: 2008, The Android Open Source Project
License: Apache-2.0

Files: ./thirdparty/fonts/JetBrainsMono_Regular.ttf
Files: ./thirdparty/fonts/JetBrainsMono_Regular.woff2
Comment: JetBrains Mono font
Copyright: 2020, JetBrains s.r.o.
License: OFL-1.1

Files: ./thirdparty/fonts/NotoSans*.ttf
Files: ./thirdparty/fonts/NotoSans*.woff2
Comment: Noto Sans font
Copyright: 2012, Google Inc.
License: OFL-1.1
Expand Down
2 changes: 2 additions & 0 deletions editor/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ if env["tools"]:
# Fonts
flist = glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.ttf")
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.otf"))
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff"))
flist.extend(glob.glob(env.Dir("#thirdparty").abspath + "/fonts/*.woff2"))
flist.sort()
env.Depends("#editor/builtin_fonts.gen.h", flist)
env.CommandNoCache(
Expand Down
6 changes: 3 additions & 3 deletions editor/editor_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,9 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
#endif
EDITOR_SETTING(Variant::INT, PROPERTY_HINT_ENUM, "interface/editor/font_subpixel_positioning", 1, "Disabled,Auto,One half of a pixel,One quarter of a pixel")

EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/code_font", "", "*.ttf,*.otf")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/main_font_bold", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
EDITOR_SETTING(Variant::STRING, PROPERTY_HINT_GLOBAL_FILE, "interface/editor/code_font", "", "*.ttf,*.otf,*.woff,*.woff2,*.pfb,*.pfm")
EDITOR_SETTING_USAGE(Variant::FLOAT, PROPERTY_HINT_RANGE, "interface/editor/low_processor_mode_sleep_usec", 6900, "1,100000,1", PROPERTY_USAGE_DEFAULT | PROPERTY_USAGE_RESTART_IF_CHANGED)
// Default unfocused usec sleep is for 10 FPS. Allow an unfocused FPS limit
// as low as 1 FPS for those who really need low power usage (but don't need
Expand Down
4 changes: 2 additions & 2 deletions scene/resources/default_theme/SCsub
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import default_theme_icons_builders

env.add_source_files(env.scene_sources, "*.cpp")

env.Depends("#scene/resources/default_theme/default_font.gen.h", "#thirdparty/fonts/OpenSans_SemiBold.ttf")
env.Depends("#scene/resources/default_theme/default_font.gen.h", "#thirdparty/fonts/OpenSans_SemiBold.woff2")
env.CommandNoCache(
"#scene/resources/default_theme/default_font.gen.h",
"#thirdparty/fonts/OpenSans_SemiBold.ttf",
"#thirdparty/fonts/OpenSans_SemiBold.woff2",
run_in_subprocess(default_theme_builders.make_fonts_header),
)

Expand Down
10 changes: 5 additions & 5 deletions thirdparty/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,25 +130,25 @@ Files extracted from upstream source:

## fonts

- `NotoSans*.ttf`, `NotoNaskhArabicUI_*.ttf`:
- `NotoSans*.woff2`, `NotoNaskhArabicUI_*.woff2`:
* Upstream: https://github.com/googlefonts/noto-fonts
* Version: v2017-10-24-phase3-second-cleanup
* License: OFL-1.1
* Comment: Use UI font variant if available, because it has tight vertical metrics and
good for UI.
- `JetBrainsMono_Regular.ttf`:
- `JetBrainsMono_Regular.woff2`:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if that makes any significant difference, but JetBrains seem to provide a woff2 version of the font themselves: https://github.com/JetBrains/JetBrainsMono/blob/master/fonts/webfonts/JetBrainsMono-Regular.woff2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's probably not, WOFF is just a compressed wrapper, all font structures should stay the same. Their version is 3 KB larger, but it probably depends only on a tool that was used to compress it.

* Upstream: https://github.com/JetBrains/JetBrainsMono
* Version: 2.242
* License: OFL-1.1
- `DroidSans*.ttf`:
- `DroidSans*.woff2`:
* Upstream: https://android.googlesource.com/platform/frameworks/base/+/master/data/fonts/
* Version: ? (pre-2014 commit when DroidSansJapanese.ttf was obsoleted)
* License: Apache 2.0
- `OpenSans_SemiBold.ttf`:
- `OpenSans_SemiBold.woff2`:
* Upstream: https://fonts.google.com/specimen/Open+Sans
* Version: 1.10 (downloaded from Google Fonts in February 2021)
* License: Apache 2.0

- All fonts are converted from the `.ttf` sources using `https://github.com/google/woff2` tool.


## freetype
Expand Down
Binary file removed thirdparty/fonts/DroidSansFallback.ttf
Binary file not shown.
Binary file added thirdparty/fonts/DroidSansFallback.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/DroidSansJapanese.ttf
Binary file not shown.
Binary file added thirdparty/fonts/DroidSansJapanese.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/JetBrainsMono_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/JetBrainsMono_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoNaskhArabicUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoNaskhArabicUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoNaskhArabicUI_Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansBengaliUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansBengaliUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansBengaliUI_Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansDevanagariUI_Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansGeorgian_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansGeorgian_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansGeorgian_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansGeorgian_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansHebrew_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansHebrew_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansHebrew_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansHebrew_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansMalayalamUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansMalayalamUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansMalayalamUI_Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansOriyaUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansOriyaUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansOriyaUI_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansOriyaUI_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansSinhalaUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansSinhalaUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansSinhalaUI_Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansTamilUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansTamilUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansTamilUI_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansTamilUI_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansTeluguUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansTeluguUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansTeluguUI_Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansThaiUI_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansThaiUI_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSansThaiUI_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSansThaiUI_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSans_Bold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSans_Bold.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/NotoSans_Regular.ttf
Binary file not shown.
Binary file added thirdparty/fonts/NotoSans_Regular.woff2
Binary file not shown.
Binary file removed thirdparty/fonts/OpenSans_SemiBold.ttf
Binary file not shown.
Binary file added thirdparty/fonts/OpenSans_SemiBold.woff2
Binary file not shown.