diff --git a/.gitignore b/.gitignore index c1414312..13443fd6 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,4 @@ dist_config.json nimble.develop nimble.paths /t.nim +fonts/ diff --git a/app/components/MarkdownLabel.tscn b/app/components/MarkdownLabel.tscn index 89f8110e..bc57835b 100644 --- a/app/components/MarkdownLabel.tscn +++ b/app/components/MarkdownLabel.tscn @@ -1,41 +1,42 @@ -[gd_scene load_steps=18 format=2] +[gd_scene load_steps=19 format=2] [ext_resource path="res://components/MarkdownLabel.gdns" type="Script" id=1] [ext_resource path="res://themes/DarkTheme.tres" type="Theme" id=2] -[ext_resource path="res://themes/SF-Pro-Text-Bold.otf" type="DynamicFontData" id=3] -[ext_resource path="res://themes/SF-Pro-Text-RegularItalic.otf" type="DynamicFontData" id=4] -[ext_resource path="res://themes/SF-Pro-Text-Regular.otf" type="DynamicFontData" id=5] -[ext_resource path="res://themes/SF-Pro-Text-BoldItalic.otf" type="DynamicFontData" id=6] -[ext_resource path="res://themes/SF-Mono-Powerline-Regular.otf" type="DynamicFontData" id=7] +[ext_resource path="res://themes/text-bold-italic.otf" type="DynamicFontData" id=3] +[ext_resource path="res://themes/text-italic.otf" type="DynamicFontData" id=4] +[ext_resource path="res://themes/text-bold.otf" type="DynamicFontData" id=5] +[ext_resource path="res://themes/text.otf" type="DynamicFontData" id=6] +[ext_resource path="res://themes/display-bold.otf" type="DynamicFontData" id=8] +[ext_resource path="res://themes/mono.otf" type="DynamicFontData" id=9] [sub_resource type="DynamicFont" id=7] -font_data = ExtResource( 5 ) +font_data = ExtResource( 6 ) [sub_resource type="DynamicFont" id=8] font_data = ExtResource( 4 ) [sub_resource type="DynamicFont" id=9] -font_data = ExtResource( 3 ) +font_data = ExtResource( 5 ) [sub_resource type="DynamicFont" id=10] -font_data = ExtResource( 6 ) - -[sub_resource type="DynamicFont" id=11] font_data = ExtResource( 3 ) +[sub_resource type="DynamicFont" id=11] +font_data = ExtResource( 8 ) + [sub_resource type="DynamicFont" id=12] -font_data = ExtResource( 7 ) +font_data = ExtResource( 9 ) [sub_resource type="StyleBoxFlat" id=6] resource_local_to_scene = true content_margin_left = 20.0 content_margin_right = 20.0 -content_margin_top = 20.0 -content_margin_bottom = 20.0 +content_margin_top = 10.0 +content_margin_bottom = 10.0 bg_color = Color( 0.0784314, 0.0117647, 0.113725, 0.839216 ) [sub_resource type="DynamicFont" id=13] -font_data = ExtResource( 7 ) +font_data = ExtResource( 9 ) [sub_resource type="StyleBoxFlat" id=14] bg_color = Color( 0, 0, 0, 0 ) diff --git a/app/components/SignNode.tscn b/app/components/SignNode.tscn index 5397088d..2820990a 100644 --- a/app/components/SignNode.tscn +++ b/app/components/SignNode.tscn @@ -1,32 +1,8 @@ -[gd_scene load_steps=18 format=2] +[gd_scene load_steps=7 format=2] -[ext_resource path="res://themes/SF-Pro-Text-RegularItalic.otf" type="DynamicFontData" id=1] -[ext_resource path="res://themes/SF-Pro-Text-Regular.otf" type="DynamicFontData" id=2] -[ext_resource path="res://themes/SF-Pro-Text-BoldItalic.otf" type="DynamicFontData" id=3] -[ext_resource path="res://themes/SF-Mono-Powerline-Regular.otf" type="DynamicFontData" id=4] [ext_resource path="res://components/MarkdownLabel.tscn" type="PackedScene" id=5] -[ext_resource path="res://themes/SF-Pro-Text-Bold.otf" type="DynamicFontData" id=6] [ext_resource path="res://components/SignNode.gdns" type="Script" id=7] -[sub_resource type="DynamicFont" id=7] -font_data = ExtResource( 2 ) - -[sub_resource type="DynamicFont" id=8] -font_data = ExtResource( 1 ) - -[sub_resource type="DynamicFont" id=9] -font_data = ExtResource( 6 ) - -[sub_resource type="DynamicFont" id=10] -font_data = ExtResource( 3 ) - -[sub_resource type="DynamicFont" id=11] -size = 32 -font_data = ExtResource( 6 ) - -[sub_resource type="DynamicFont" id=12] -font_data = ExtResource( 4 ) - [sub_resource type="QuadMesh" id=18] resource_local_to_scene = true @@ -69,12 +45,6 @@ size_flags_horizontal = 1 size_flags_vertical = 1 scroll_horizontal_enabled = false scroll_vertical_enabled = false -default_font = SubResource( 7 ) -italic_font = SubResource( 8 ) -bold_font = SubResource( 9 ) -bold_italic_font = SubResource( 10 ) -header_font = SubResource( 11 ) -mono_font = SubResource( 12 ) [node name="MeshInstance" type="MeshInstance" parent="."] transform = Transform( -1, 0, -1.50996e-07, 0, 1, 0, 1.50996e-07, 0, -1, 0, 0, 0 ) diff --git a/app/scenes/GUI.tscn b/app/scenes/GUI.tscn index 1f3b2a4c..2edf24f3 100644 --- a/app/scenes/GUI.tscn +++ b/app/scenes/GUI.tscn @@ -7,7 +7,7 @@ [ext_resource path="res://textures/reticle.png" type="Texture" id=5] [ext_resource path="res://themes/DarkTheme.tres" type="Theme" id=6] [ext_resource path="res://components/RightPanel.gdns" type="Script" id=7] -[ext_resource path="res://themes/SF-Mono-Powerline-Bold.otf" type="DynamicFontData" id=8] +[ext_resource path="res://themes/mono-bold.otf" type="DynamicFontData" id=8] [ext_resource path="res://scenes/PreviewWorld.tscn" type="PackedScene" id=9] [ext_resource path="res://components/PreviewMaker.gdns" type="Script" id=10] [ext_resource path="res://components/Toolbar.gdns" type="Script" id=11] diff --git a/app/themes/.gitignore b/app/themes/.gitignore index 05c402b7..528f9021 100644 --- a/app/themes/.gitignore +++ b/app/themes/.gitignore @@ -1 +1 @@ -SF*.otf \ No newline at end of file +*.otf \ No newline at end of file diff --git a/app/themes/AppleTheme.tres b/app/themes/AppleTheme.tres deleted file mode 100644 index 386b0c29..00000000 --- a/app/themes/AppleTheme.tres +++ /dev/null @@ -1,16 +0,0 @@ -[gd_resource type="Theme" load_steps=5 format=2] - -[ext_resource path="res://themes/SF-Mono-Powerline-Bold.otf" type="DynamicFontData" id=1] -[ext_resource path="res://themes/SF-Mono-Powerline-Regular.otf" type="DynamicFontData" id=2] - -[sub_resource type="DynamicFont" id=1] -size = 14 -font_data = ExtResource( 1 ) - -[sub_resource type="DynamicFont" id=2] -size = 14 -font_data = ExtResource( 2 ) - -[resource] -default_font = SubResource( 2 ) -RichTextLabel/fonts/bold_font = SubResource( 1 ) diff --git a/app/themes/DarkTheme.tres b/app/themes/DarkTheme.tres index 1fcc9c23..d892c67b 100644 --- a/app/themes/DarkTheme.tres +++ b/app/themes/DarkTheme.tres @@ -1,6 +1,6 @@ [gd_resource type="Theme" load_steps=1032 format=2] -[ext_resource path="res://themes/Inconsolata-Bold.ttf" type="DynamicFontData" id=1] +[ext_resource path="res://themes/text-bold.otf" type="DynamicFontData" id=1] [sub_resource type="StyleBoxFlat" id=1] content_margin_left = 6.0 @@ -102,7 +102,7 @@ flags = 0 size = Vector2( 16, 16 ) [sub_resource type="DynamicFontData" id=1029] -font_path = "res://themes/Inconsolata-Regular.ttf" +font_path = "res://themes/text.otf" [sub_resource type="DynamicFont" id=1030] size = 26 diff --git a/app/themes/Inconsolata-Bold.ttf b/app/themes/Inconsolata-Bold.ttf deleted file mode 100644 index 9f927258..00000000 Binary files a/app/themes/Inconsolata-Bold.ttf and /dev/null differ diff --git a/app/themes/Inconsolata-Regular.ttf b/app/themes/Inconsolata-Regular.ttf deleted file mode 100644 index 457d262c..00000000 Binary files a/app/themes/Inconsolata-Regular.ttf and /dev/null differ diff --git a/enu.nimble b/enu.nimble index 72896726..2227f243 100644 --- a/enu.nimble +++ b/enu.nimble @@ -68,8 +68,70 @@ proc find_and_copy_dlls(dep_path, dest: string, dlls: varargs[string]) = for dep in dlls: cp_file dep_path.join_path(dep), join_path(dest, dep) +proc download_fonts = + rm_dir "fonts" + mk_dir "fonts" + with_dir "fonts": + when host_os == "macosx": + exec "curl -OJL https://devimages-cdn.apple.com/design/resources/download/SF-Pro.dmg" + exec "curl -OJL https://devimages-cdn.apple.com/design/resources/download/SF-Mono.dmg" + exec "hdiutil attach SF-Mono.dmg" + exec "pkgutil --expand-full '/Volumes/SFMonoFonts/SF Mono Fonts.pkg' mono" + exec "hdiutil detach /Volumes/SFMonoFonts" + with_dir "mono/SFMonoFonts.pkg/Payload/Library/Fonts": + let dest = "../../../../../../app/themes" + cp_file "SF-Mono-Regular.otf", dest / "mono.otf" + cp_file "SF-Mono-RegularItalic.otf", dest / "mono-italic.otf" + cp_file "SF-Mono-Bold.otf", dest / "mono-bold.otf" + cp_file "SF-Mono-BoldItalic.otf", dest / "mono-bold-italic.otf" + + exec "hdiutil attach SF-Pro.dmg" + exec "pkgutil --expand-full '/Volumes/SFProFonts/SF Pro Fonts.pkg' pro" + exec "hdiutil detach /Volumes/SFProFonts" + + with_dir "pro/SFProFonts.pkg/Payload/Library/Fonts": + let dest = "../../../../../../app/themes" + cp_file "SF-Pro-Text-Regular.otf", dest / "text.otf" + cp_file "SF-Pro-Text-RegularItalic.otf", dest / "text-italic.otf" + cp_file "SF-Pro-Text-Bold.otf", dest / "text-bold.otf" + cp_file "SF-Pro-Text-BoldItalic.otf", dest / "text-bold-italic.otf" + + cp_file "SF-Pro-Display-Regular.otf", dest / "display.otf" + cp_file "SF-Pro-Display-RegularItalic.otf", dest / "display-italic.otf" + cp_file "SF-Pro-Display-Bold.otf", dest / "display-bold.otf" + cp_file "SF-Pro-Display-BoldItalic.otf", dest / "display-bold-italic.otf" + + else: + exec "curl -OJL 'https://fonts.google.com/download?family=Roboto'" + exec "curl -OJL 'https://fonts.google.com/download?family=Roboto%20Mono'" + exec "unzip Roboto.zip" + exec "unzip -o Roboto_Mono.zip" + + with_dir "static": + let dest = "../../app/themes" + cp_file "RobotoMono-Regular.ttf", dest / "mono.otf" + cp_file "RobotoMono-Italic.ttf", dest / "mono-italic.otf" + cp_file "RobotoMono-Bold.ttf", dest / "mono-bold.otf" + cp_file "RobotoMono-BoldItalic.ttf", dest / "mono-bold-italic.otf" + + let dest = "../app/themes" + cp_file "Roboto-Regular.ttf", dest / "text.otf" + cp_file "Roboto-Italic.ttf", dest / "text-italic.otf" + cp_file "Roboto-Bold.ttf", dest / "text-bold.otf" + cp_file "Roboto-BoldItalic.ttf", dest / "text-bold-italic.otf" + + # Roboto doesn't have a display version. Consider using something else + # here. + cp_file "Roboto-Regular.ttf", dest / "display.otf" + cp_file "Roboto-Italic.ttf", dest / "display-italic.otf" + cp_file "Roboto-Bold.ttf", dest / "display-bold.otf" + cp_file "Roboto-BoldItalic.ttf", dest / "display-bold-italic.otf" + + rm_dir "fonts" + task prereqs, "Generate Godot API binding": build_godot_task() + download_fonts() exec &"{godot_bin} --gdnative-generate-json-api {join_path generated_dir, api_json}" exec &"{gen()} generate_api -d={generated_dir} -j={api_json}" exec &"{gen()} copy_stdlib -d=vmlib/stdlib" @@ -116,7 +178,7 @@ task dist_universal_mac, "Build Universal mac distribution": rm_dir "dist" let config = read_file("dist_config.json").parse_json - mkdir "dist" + mk_dir "dist" exec "cp -r installer/Enu.app dist/Enu.app" exec &"{gen()} write_info_plist --enu_version {version}" exec "mkdir -p dist/Enu.app/Contents/MacOS" @@ -174,7 +236,7 @@ task dist, "Build distribution": when host_os == "macosx": let config = read_file("dist_config.json").parse_json - mkdir "dist" + mk_dir "dist" exec "cp -r installer/Enu.app dist/Enu.app" exec &"{gen()} write_info_plist --enu_version {version}" exec "mkdir -p dist/Enu.app/Contents/MacOS" @@ -206,7 +268,7 @@ task dist, "Build distribution": elif host_os == "windows": let root = &"dist/enu-{version}" - mkdir root + mk_dir root exec "strip " & release_bin cp_file release_bin, root & "/enu.exe" exec &"rcedit {root}/enu.exe --set-icon media/enu_icon.ico" @@ -223,8 +285,8 @@ task dist, "Build distribution": elif host_os == "linux": let root = &"dist/enu-{version}" - mkdir root & "/bin" - mkdir root & "/lib" + mk_dir root & "/bin" + mk_dir root & "/lib" exec "nimble build -d:release -d:dist" exec "strip " & release_bin cp_file release_bin, root & "/bin/enu" diff --git a/src/game.nim b/src/game.nim index 66b4298c..266a98bb 100644 --- a/src/game.nim +++ b/src/game.nim @@ -171,13 +171,9 @@ gdobj Game of Node: user_config.font_size = some(size) self.save_user_config(user_config) - let (theme_holder, theme) = if hostOS == "macosx": - (self.find_node("ThemeHolder").as(Container), - load("res://themes/AppleTheme.tres").as(Theme)) - else: - let node = self.find_node("LeftPanel").as(Container) - (node, node.theme) let + theme_holder = self.find_node("LeftPanel").as(Container) + theme = theme_holder.theme font = theme.default_font.as(DynamicFont) bold_font = theme.get_font("bold_font", "RichTextLabel") .as(DynamicFont)