You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the project you are working on:
(Any project which supports multiple languages)
Describe the problem or limitation you are having in your project:
If the currently selected Font doesn't contain a glyph/character you're trying to use, it will just be ignored/skipped, which can look like a bug.
Describe the feature / enhancement and how it helps to overcome the problem or limitation:
There is already a proposal for using a placeholder glyph in this case #591.
I am simply proposing that we add a has_char_str(char_str: String) and has_char_code(char_code: int) to the Font class.
Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
You could make a custom Label scene, with this script to ensure that every character is supported by the Font.
extends Label
func set_text(__text: String): #override
assert_font_supports_all_characters(__text)
text = __text
func assert_font_supports_all_characters(__text: String):
var __font := get_font("font")
var __font_path := __font.resource_path
for __char_str in __text:
if !__font.has_char_str(__char_str):
assert(false, str("Unsupported char '", __char_str, "' in Font (", __font_path, ")"))
If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not sure, but I don't think so.
Is there a reason why this should be core and not an add-on in the asset library?:
This could help in catching some confusing bugs relating to having multiple fonts for different languages.
By adding these functions, an invalid char/glyph could be caught and throw an error so the problem can be fixed instead of slipping by unnoticed.
If you're creating your own font, this would also help to track down any characters which you may have forgotten to add glyphs for.
The text was updated successfully, but these errors were encountered:
In 4.0 both bool has_char(char32_t p_char) and String get_supported_chars() are part of the Font, since Font is unified it's available for bitmap fonts as well.
If the currently selected Font doesn't contain a glyph/character you're trying to use, it will just be ignored/skipped, which can look like a bug.
In 4.0, instead of ignoring missing chars, char hex code is drawn (by default, this feature can be disabled).
In 4.0 both bool has_char(char32_t p_char) and String get_supported_chars() are part of the Font, since Font is unified it's available for bitmap fonts as well.
In 4.0, instead of ignoring missing chars, char hex code is drawn (by default, this feature can be disabled).
Describe the project you are working on:
(Any project which supports multiple languages)
Describe the problem or limitation you are having in your project:
If the currently selected
Font
doesn't contain a glyph/character you're trying to use, it will just be ignored/skipped, which can look like a bug.Describe the feature / enhancement and how it helps to overcome the problem or limitation:
There is already a proposal for using a placeholder glyph in this case #591.
I am simply proposing that we add a
has_char_str(char_str: String)
andhas_char_code(char_code: int)
to theFont
class.Describe how your proposal will work, with code, pseudocode, mockups, and/or diagrams:
You could make a custom
Label
scene, with this script to ensure that every character is supported by theFont
.If this enhancement will not be used often, can it be worked around with a few lines of script?:
Not sure, but I don't think so.
Is there a reason why this should be core and not an add-on in the asset library?:
This could help in catching some confusing bugs relating to having multiple fonts for different languages.
By adding these functions, an invalid char/glyph could be caught and throw an error so the problem can be fixed instead of slipping by unnoticed.
If you're creating your own font, this would also help to track down any characters which you may have forgotten to add glyphs for.
The text was updated successfully, but these errors were encountered: