Closed Calinou closed 9 months ago
I've tried replacing the workarounds with setting dictionary keys directly like this:
diff --git a/gui/bidi_and_font_features/bidi.gd b/gui/bidi_and_font_features/bidi.gd
index ea2f64d4..6bba4a61 100644
--- a/gui/bidi_and_font_features/bidi.gd
+++ b/gui/bidi_and_font_features/bidi.gd
@@ -44,42 +44,27 @@ func _on_variable_size_value_changed(value: float) -> void:
func _on_variable_weight_value_changed(value: float) -> void:
$"TabContainer/Variable fonts/Variables/Weight/Value".text = str(value)
- # Workaround to make the variable font axis value effective. This requires duplicating the dictionary.
- var dict = variable_font_variation.variation_opentype.duplicate()
- dict["weight"] = value
- variable_font_variation.variation_opentype = dict
+ variable_font_variation.variation_opentype["weight"] = value
func _on_variable_slant_value_changed(value: float) -> void:
$"TabContainer/Variable fonts/Variables/Slant/Value".text = str(value)
- # Workaround to make the variable font axis value effective. This requires duplicating the dictionary.
- var dict = variable_font_variation.variation_opentype.duplicate()
- dict["slant"] = value
- variable_font_variation.variation_opentype = dict
+ variable_font_variation.variation_opentype["slant"] = value
func _on_variable_cursive_toggled(button_pressed: bool) -> void:
$"TabContainer/Variable fonts/Variables/Cursive".button_pressed = button_pressed
- # Workaround to make the variable font axis value effective. This requires duplicating the dictionary.
- var dict = variable_font_variation.variation_opentype.duplicate()
- dict["custom_CRSV"] = int(button_pressed)
- variable_font_variation.variation_opentype = dict
+ variable_font_variation.variation_opentype["custom_CRSV"] = int(button_pressed)
func _on_variable_casual_toggled(button_pressed: bool) -> void:
$"TabContainer/Variable fonts/Variables/Casual".button_pressed = button_pressed
- # Workaround to make the variable font axis value effective. This requires duplicating the dictionary.
- var dict = variable_font_variation.variation_opentype.duplicate()
- dict["custom_CASL"] = int(button_pressed)
- variable_font_variation.variation_opentype = dict
+ variable_font_variation.variation_opentype["custom_CASL"] = int(button_pressed)
func _on_variable_monospace_toggled(button_pressed: bool) -> void:
$"TabContainer/Variable fonts/Variables/Monospace".button_pressed = button_pressed
- # Workaround to make the variable font axis value effective. This requires duplicating the dictionary.
- var dict = variable_font_variation.variation_opentype.duplicate()
- dict["custom_MONO"] = int(button_pressed)
- variable_font_variation.variation_opentype = dict
+ variable_font_variation.variation_opentype["custom_MONO"] = int(button_pressed)
func _on_system_font_value_text_changed(new_text: String) -> void:
However, this has no effect in 4.2.beta1. @bruvzg Any ideas?
However, this has no effect in 4.2.beta1. @bruvzg Any ideas?
That's not gonna work, and I do not think there's any way to make it work. The only thing that can be removed for the old version is .duplicate()
.
That's not gonna work, and I do not think there's any way to make it work. The only thing that can be removed for the old version is
.duplicate()
.
I've tried removing .duplicate()
and it didn't seem to work either. That said, I don't think this is critical for this demo to be mergeable.
Thanks!
Note that some of the code could be simplified once https://github.com/godotengine/godot/pull/79166 is merged, but I don't know if that PR will be cherry-picked for 4.1.x.
Preview