Random beginner-question: the seconds-digits of a clock should be smaller than the rest

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pferft

Hi everyone,

I have a clock ticking in a RichTextLabel, hours, minutes and seconds.

extends RichTextLabel

var date_time
var hour
var minute
var second
export var twentyfour = true

func _process(_delta):
	date_time = OS.get_datetime()

	hour = date_time.get("hour")
	minute = date_time.get("minute")
	second = date_time.get("second")

		second = "0" + str(second)
		minute = "0" + str(minute)

	set_text(str(hour) + ":" + str(minute) + ":" + str(second))

I’d like to have the seconds-digits be written smaller than the rest.
Is there any simple way to apply a custom font-size to them? (I’d assume bbcode might work, but how could I attach it to the seconds only?)

:bust_in_silhouette: Reply From: netimu

I never tried this but according to documentation(link) you could use this with bbcode:

[font=<path>]{text}[/font] # Use custom font at <path> for {text}.

and you could have different fonts with different font sizes (or a dynamic font and change its size).
This is one solution, a much simpler solution is have three different labels with different font.

Indeed, three different labels would work as well, didn’t think of this!

Right now I’m not sure how to correctly implement that path… I set up an export(String, FILE) var smallerFontPath but I can’t seem to have it included. Where do I have to put my path?
(By the way, the code [font=<path>]{text}[/font] is currently leading to the error message Error parsing expression, misplaced: '<')

pferft | 2021-02-10 10:42