As far as I understand, you can set multiple of these flags for some desired effect.
Like add them together or use bitwise operations, which will basically produce the same effect:
var flags = TextServer.BREAK_MANDATORY ^ TextServer.BREAK_WORD_BOUND ^ TextServer.BREAK_TRIM_EDGE_SPACES
However, Godot will always complain: Integer used when an enum value is expected. If this is intended cast the integer to the enum type. and the official documentation does not give much info on this. I couldn’t figure out how it’s supposed to be used.
Do I always have to cast it or is there an official way to add these flags together and if I do have to cast it, how do I do it?
That doesn’t compile. The others compile at least. I’m just asking, because I want to know how to deal with bitfields, because the Editor is complaining. I guess it’s jsut a warning and i can ignore it.
func _ready() -> void:
# the flags you've posted about, no changes
var flags = TextServer.BREAK_MANDATORY ^ TextServer.BREAK_WORD_BOUND ^ TextServer.BREAK_TRIM_EDGE_SPACES
# get a font resource
var font = $Label.get("theme_override_fonts/font")
# default values except for 'flags', no warnings
print(font.get_multiline_string_size("Test", 0, -1, 16, -1, flags))
Can you share a full example of what you’re doing?
It’s not an issue per se. The code works, but I get warnings from the Godot IDE, which makes me think I’m not using it correctly. I’m doing basically the same thing or so I think