Created
April 11, 2022 04:08
-
-
Save zbyna/7e1d392cb338879666b0226032ab9edc to your computer and use it in GitHub Desktop.
Godot how to change font size in RichTextLabel
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// adding override Font for default Theme | |
var fontForExplanation = new DynamicFont(); | |
fontForExplanation.FontData = (Godot.DynamicFontData) GD.Load("res://Fonts/Xolonium-Regular.ttf"); | |
fontForExplanation.Size = 24; | |
fontForExplanation.UseFilter = true; | |
fontForExplanation.UseMipmaps = true; | |
rtlExample.AddFontOverride("normal_font",fontForExplanation); | |
// or simpler way | |
var fontForExplanation = rtlExample.GetFont("normal_font",""); | |
(fontForExplanation as DynamicFont).Size = 24; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Theme resources change the Control's appearance. If you change the Theme on a Control node, it affects all of its children. To override some of the theme's parameters, call one of the add_*_override methods, like AddFontOverride(String, Font). You can override the theme with the inspector.
Note: Theme items are not Object properties. This means you can't access their values using Get(String) and Set(String, Object). Instead, use GetColor(String, String), GetConstant(String, String), GetFont(String, String), GetIcon(String, String), GetStylebox(String, String), and the add_*_override methods provided by this class.