sdf_font_demo.tscn 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. [gd_scene load_steps=7 format=3 uid="uid://c50snxy83byec"]
  2. [ext_resource type="Script" path="res://sdf_font_demo.gd" id="1_05k3u"]
  3. [ext_resource type="FontFile" uid="uid://j0vum3eyhewy" path="res://montserrat_semibold_msdf.ttf" id="1_eart1"]
  4. [sub_resource type="Animation" id="1"]
  5. length = 15.0
  6. loop_mode = 1
  7. tracks/0/type = "value"
  8. tracks/0/imported = false
  9. tracks/0/enabled = true
  10. tracks/0/path = NodePath(".:rotation")
  11. tracks/0/interp = 1
  12. tracks/0/loop_wrap = true
  13. tracks/0/keys = {
  14. "times": PackedFloat32Array(0, 15),
  15. "transitions": PackedFloat32Array(1, 1),
  16. "update": 0,
  17. "values": [0.0, -6.28319]
  18. }
  19. [sub_resource type="Animation" id="2"]
  20. length = 10.0
  21. loop_mode = 1
  22. tracks/0/type = "value"
  23. tracks/0/imported = false
  24. tracks/0/enabled = true
  25. tracks/0/path = NodePath(".:scale")
  26. tracks/0/interp = 1
  27. tracks/0/loop_wrap = true
  28. tracks/0/keys = {
  29. "times": PackedFloat32Array(0, 5),
  30. "transitions": PackedFloat32Array(-2, -2),
  31. "update": 0,
  32. "values": [Vector2(1, 1), Vector2(7, 7)]
  33. }
  34. [sub_resource type="AnimationLibrary" id="AnimationLibrary_88vp7"]
  35. _data = {
  36. "rotate": SubResource("1"),
  37. "zoomin_zoomout": SubResource("2")
  38. }
  39. [sub_resource type="AnimationLibrary" id="AnimationLibrary_j5dlp"]
  40. _data = {
  41. "zoomin_zoomout": SubResource("2")
  42. }
  43. [node name="SDFFontDemo" type="Control"]
  44. layout_mode = 3
  45. anchors_preset = 15
  46. anchor_right = 1.0
  47. anchor_bottom = 1.0
  48. grow_horizontal = 2
  49. grow_vertical = 2
  50. script = ExtResource("1_05k3u")
  51. [node name="Panel" type="Panel" parent="."]
  52. layout_mode = 0
  53. offset_right = 285.0
  54. offset_bottom = 107.0
  55. [node name="FontMode" type="Label" parent="."]
  56. unique_name_in_owner = true
  57. layout_mode = 1
  58. offset_left = 16.0
  59. offset_top = 16.0
  60. offset_right = 218.0
  61. offset_bottom = 68.0
  62. text = "Font rendering: MSDF"
  63. [node name="OutlineSize" type="HBoxContainer" parent="."]
  64. layout_mode = 0
  65. offset_left = 16.0
  66. offset_top = 56.0
  67. offset_right = 286.0
  68. offset_bottom = 96.0
  69. theme_override_constants/separation = 8
  70. [node name="Label" type="Label" parent="OutlineSize"]
  71. layout_mode = 2
  72. text = "Outline size:"
  73. [node name="HSlider" type="HSlider" parent="OutlineSize"]
  74. layout_mode = 2
  75. size_flags_horizontal = 3
  76. size_flags_vertical = 1
  77. max_value = 20.0
  78. value = 5.0
  79. [node name="Value" type="Label" parent="OutlineSize"]
  80. unique_name_in_owner = true
  81. layout_mode = 2
  82. size_flags_horizontal = 3
  83. size_flags_stretch_ratio = 0.23
  84. text = "5"
  85. [node name="Help" type="Label" parent="."]
  86. layout_mode = 1
  87. anchors_preset = 2
  88. anchor_top = 1.0
  89. anchor_bottom = 1.0
  90. offset_left = 16.0
  91. offset_top = -42.0
  92. offset_right = 439.0
  93. offset_bottom = -16.0
  94. grow_vertical = 0
  95. theme_override_colors/font_outline_color = Color(0, 0, 0, 1)
  96. theme_override_constants/outline_size = 4
  97. text = "S: Toggle between traditional and MSDF font rendering"
  98. [node name="CenterContainer" type="CenterContainer" parent="."]
  99. layout_mode = 0
  100. offset_left = 576.0
  101. offset_top = 324.0
  102. offset_right = 576.0
  103. offset_bottom = 324.0
  104. [node name="Base" type="Control" parent="CenterContainer"]
  105. layout_mode = 2
  106. [node name="Rotate" type="AnimationPlayer" parent="CenterContainer/Base"]
  107. autoplay = "rotate"
  108. libraries = {
  109. "": SubResource("AnimationLibrary_88vp7")
  110. }
  111. [node name="Zoom" type="AnimationPlayer" parent="CenterContainer/Base"]
  112. autoplay = "zoomin_zoomout"
  113. libraries = {
  114. "": SubResource("AnimationLibrary_j5dlp")
  115. }
  116. [node name="FontLabel" type="Label" parent="CenterContainer/Base"]
  117. unique_name_in_owner = true
  118. z_index = -1
  119. layout_mode = 0
  120. offset_left = -128.0
  121. offset_top = -50.0
  122. offset_right = 128.0
  123. offset_bottom = 51.0
  124. theme_override_colors/font_outline_color = Color(0.831373, 0.384314, 0.109804, 1)
  125. theme_override_constants/outline_size = 5
  126. theme_override_fonts/font = ExtResource("1_eart1")
  127. text = "Font rendering example
  128. 0123456789
  129. !@#$%^&*()_+-="
  130. [connection signal="value_changed" from="OutlineSize/HSlider" to="." method="_on_outline_size_value_changed"]