Closed golddotasksquestions closed 1 year ago
I can't seem to figure out how to use a different font only for the initial. Would be very good to document this as well. All it says in the PR is
font=name
, but what exactly is this "name"? It does not seem to be a resource filepath.
According to the implementation, it is a resource path. Make sure you use the full, qualified path, suitable for ResourceLoader::load
.
@YuriSizov
I tried
[dropcap font="res://myfont.ttf" font_size=80 ]M[/dropcap]y text lorem ipsum ...
and it is not working. BBCode is enabled. dropcap is working, but font is still default.
What am I missing?
I don't think the quotation marks are necessary.
@YuriSizov Thank you, that was it!
Maybe this can be added in form of an example to the documentation of the [dropcap]
tag.
I don't think the quotation marks are necessary.
We should handle string paths with quotes (single or double) in RichTextLabel to avoid this kind of issue. It should be as simple as calling .trim_prefix("\"").trim_suffix("\"").trim_prefix("'").trim_suffix("'")
when parsing a string parameter in RichTextLabel's BBCode parser.
This was documented by https://github.com/godotengine/godot-demo-projects/pull/816 (and also shown in the demo with https://github.com/godotengine/godot-demo-projects/pull/816), closing.
This still happens in Godot 4.2 - the custom font does not get applied inside a dropcap tag if font path contains spaces (which requires the path to be in quotes). Tried both with and without quotes, only fixable by changing the path to not contain any spaces. Also, the documentation (4.2) is missing the dropcap font usage example, which makes it a bit confusing whether "font" is supported at all. It's currentlly as follows:
[dropcap font_size={size} color={color} margins={left},{top},{right},{bottom}]{text}[/dropcap]
Your Godot version: Godot 4 Beta 10
Issue description: I would like to test the drop capital (added in https://github.com/godotengine/godot/pull/43691), but I don't know how and can't seem to find it mention anywhere in the latest docs.
Edit: Apparently it works with BBCode (BBCode needs to be enabled), then just add
[dropcap font=name font_size=80 ]A[/dropcap]
or[dropcap font_size=80 margins=0,0,0,0]A[/dropcap]
Setting margins is especially important when not using a specific font made for initials. For example when using capital letters of the same font of the body of the text for the initial, since this font will likely have ascender and decender height, in which case negative top and bottom margins need to be set:Edit2: I can't seem to figure out how to use a different font only for the initial. Would be very good to document this as well. All it says in the PR is
font=name
, but what exactly is this "name"? It does not seem to be a resource filepath.Still I think this should be documented somewhere on this page:
URL to the documentation page (if already existing): https://docs.godotengine.org/en/latest/tutorials/ui/bbcode_in_richtextlabel.html