sdf_font_demo.gd 674 B

123456789101112131415161718192021
  1. extends Control
  2. func _input(event):
  3. if event.is_action_pressed("toggle_msdf_font"):
  4. if %FontLabel.get_theme_font("font").multichannel_signed_distance_field:
  5. %FontLabel.add_theme_font_override("font", preload("res://montserrat_semibold.ttf"))
  6. else:
  7. %FontLabel.add_theme_font_override("font", preload("res://montserrat_semibold_msdf.ttf"))
  8. update_label()
  9. func update_label():
  10. %FontMode.text = "Font rendering: %s" % ("MSDF" if %FontLabel.get_theme_font("font").multichannel_signed_distance_field else "Traditional")
  11. func _on_outline_size_value_changed(value):
  12. %FontLabel.add_theme_constant_override("outline_size", int(value))
  13. %Value.text = str(value)