Add Inter font + move input handling around

This commit is contained in:
JeremyStar™ 2024-01-17 20:49:17 +01:00
parent 63ddf81e9b
commit 147aab7784
32 changed files with 39 additions and 204 deletions

View file

@ -1,9 +1,9 @@
[gd_scene load_steps=10 format=3 uid="uid://btyi16dkvbly1"]
[ext_resource type="Script" path="res://src/console.gd" id="1_viv5y"]
[ext_resource type="FontFile" uid="uid://bl4vgye7bg8kf" path="res://docs/static/assets/fonts/FiraCode-Regular.ttf" id="2_ebuk0"]
[ext_resource type="FontFile" uid="uid://b5qsng8gpvos3" path="res://docs/static/assets/fonts/FiraCode-Bold.ttf" id="3_102to"]
[ext_resource type="FontFile" uid="uid://c5jkbqx10tj8e" path="res://docs/static/assets/fonts/FiraCode-Medium.ttf" id="4_jqfsc"]
[ext_resource type="FontFile" uid="uid://fd61n825la2g" path="res://assets/fonts/FiraCode/Regular.ttf" id="2_ebuk0"]
[ext_resource type="FontFile" uid="uid://cqa0ee5go1p00" path="res://assets/fonts/FiraCode/Bold.ttf" id="3_102to"]
[ext_resource type="FontFile" uid="uid://ddjvx4n721qha" path="res://assets/fonts/FiraCode/Medium.ttf" id="4_jqfsc"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_u40jo"]

View file

@ -1,33 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://b5qsng8gpvos3"
path="res://.godot/imported/FiraCode-Bold.ttf-85308023e4b3887c42a87bcac392d375.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Bold.ttf"
dest_files=["res://.godot/imported/FiraCode-Bold.ttf-85308023e4b3887c42a87bcac392d375.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,33 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://4q4lsmuimus1"
path="res://.godot/imported/FiraCode-Light.ttf-c09448311f89f98ee7f002def57567d8.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Light.ttf"
dest_files=["res://.godot/imported/FiraCode-Light.ttf-c09448311f89f98ee7f002def57567d8.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,33 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://c5jkbqx10tj8e"
path="res://.godot/imported/FiraCode-Medium.ttf-0db7f1fcf0ebd067a2e7f37f0ec7247d.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Medium.ttf"
dest_files=["res://.godot/imported/FiraCode-Medium.ttf-0db7f1fcf0ebd067a2e7f37f0ec7247d.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,33 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://bl4vgye7bg8kf"
path="res://.godot/imported/FiraCode-Regular.ttf-5fbe404b04fc56529c18062b38f4ba3d.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Regular.ttf"
dest_files=["res://.godot/imported/FiraCode-Regular.ttf-5fbe404b04fc56529c18062b38f4ba3d.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

View file

@ -1,33 +0,0 @@
[remap]
importer="font_data_dynamic"
type="FontFile"
uid="uid://btpllsnn0t030"
path="res://.godot/imported/FiraCode-Retina.ttf-3af65c1aa12af660768f353167f5ab00.fontdata"
[deps]
source_file="res://docs/static/assets/fonts/FiraCode-Retina.ttf"
dest_files=["res://.godot/imported/FiraCode-Retina.ttf-3af65c1aa12af660768f353167f5ab00.fontdata"]
[params]
Rendering=null
antialiasing=1
generate_mipmaps=false
multichannel_signed_distance_field=false
msdf_pixel_range=8
msdf_size=48
allow_system_fallback=true
force_autohinter=false
hinting=1
subpixel_positioning=1
oversampling=0.0
Fallbacks=null
fallbacks=[]
Compress=null
compress=true
preload=[]
language_support={}
script_support={}
opentype_features={}

Binary file not shown.

Binary file not shown.

BIN
assets/fonts/Inter/Bold.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
assets/fonts/Inter/Thin.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

View file

@ -57,8 +57,8 @@ func _ready() -> void:
logrtl.auto_translate = false
logrtl.localize_numeral_system = false
## Create font override
logrtl.add_theme_font_override("normal_font", ResourceLoader.load("res://assets/fonts/FiraCode-Regular.ttf"))
logrtl.add_theme_font_override("bold_font", ResourceLoader.load("res://assets/fonts/FiraCode-Bold.ttf"))
logrtl.add_theme_font_override("normal_font", ResourceLoader.load("res://assets/fonts/FiraCode/Regular.ttf"))
logrtl.add_theme_font_override("bold_font", ResourceLoader.load("res://assets/fonts/FiraCode/Bold.ttf"))
logrtl.add_theme_font_size_override("normal_font_size", 14)
logrtl.add_theme_font_size_override("bold_font_size", 14)
## Connect to logger
@ -111,7 +111,7 @@ Licensed under the GNU General Public License version 3
# Open presentation archive/directory
var path: String = " ".join(OS.get_cmdline_user_args())
if OS.get_cmdline_user_args().size() == 0:
await logger.error("No presentation was passed to Presencode")
ui_engine.initialize(self)
else:
await print_warning()
await load_presentation(path)
@ -157,6 +157,27 @@ func _process(_delta: float) -> void:
if typeof(logrtl) == TYPE_OBJECT:
logrtl.size = DisplayServer.window_get_size()
if config_window_size_support: move_child($WindowSizeSupport, get_child_count(true))
# Fullscreen key combo
if pmana.config_allow_fullscreen and Input.is_action_just_pressed("fullscreen"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_WINDOWED:
# window is windowed, set to fullscreen mode
logger.info("Switched to fullscreen mode")
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
# window is in fullscreen (or something else) mode, set to windowed mode
logger.info("Switched to windowed mode")
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
# Content scale switch combo
if Input.is_action_just_pressed("content_scale_switch"):
match(get_tree().root.content_scale_stretch):
Window.CONTENT_SCALE_STRETCH_FRACTIONAL:
logger.info("Switching to fractional scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_INTEGER
Window.CONTENT_SCALE_STRETCH_INTEGER:
logger.info("Switching to integer scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
_:
logger.error("Invalid content_scale_stretch value")
# Append log output to logrtl.text
func append_log(_type: logger.Types, _message: String, log_str: String) -> void:

View file

@ -197,22 +197,11 @@ func shutdown(exitcode: int = 0) -> void:
# Runs every frame (duh)
func _process(_delta: float) -> void:
# Fullscreen key combo
if config_allow_fullscreen and Input.is_action_just_pressed("fullscreen"):
if DisplayServer.window_get_mode() == DisplayServer.WINDOW_MODE_WINDOWED:
# window is windowed, set to fullscreen mode
logger.info("Switched to fullscreen mode")
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_FULLSCREEN)
else:
# window is in fullscreen (or something else) mode, set to windowed mode
logger.info("Switched to windowed mode")
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
if !registered: return
# Navigation key combos
if Input.is_action_pressed("slide_forwards") and Input.is_action_pressed("slide_backwards"):
# slide_forwards and slide_backwards shouldn't be pressed at the same time
logger.warn("slide_forwards and slide_backwards are both pressed, aborting")
return
if Input.is_action_pressed("slide_forwards") and Input.is_action_pressed("slide_backwards"): return
else:
if get_node_or_null("/root/Console") == null or !get_node("/root/Console").visible:
if Input.is_action_just_pressed("slide_forwards"):
# Increase current_slide by one
logger.info("Navigating one slide forwards (key)")
@ -220,15 +209,5 @@ func _process(_delta: float) -> void:
elif Input.is_action_just_pressed("slide_backwards"):
# Decrease current_slide by one
logger.info("Navigating one slide backwards (key)")
change_slide(current_slide-1)
# Content scale switch combo
if Input.is_action_just_pressed("content_scale_switch"):
match(get_tree().root.content_scale_stretch):
Window.CONTENT_SCALE_STRETCH_FRACTIONAL:
logger.info("Switching to fractional scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_INTEGER
Window.CONTENT_SCALE_STRETCH_INTEGER:
logger.info("Switching to integer scaling")
get_tree().root.content_scale_stretch = Window.CONTENT_SCALE_STRETCH_FRACTIONAL
_:
logger.error("Invalid content_scale_stretch value")