diff options
| author | Juan Linietsky | 2015-12-10 23:02:40 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-12-10 23:02:40 -0300 |
| commit | 46497c450854d0dfee60d8b64e141a303f4e99b3 (patch) | |
| tree | e766efb2b31144c419096c8083558fc6ec0e6c2f /scene/resources/font.h | |
| parent | 5a60edf1ffc7b30706a3f3101282b5f7a115f9cf (diff) | |
| download | godot-46497c450854d0dfee60d8b64e141a303f4e99b3.tar.gz godot-46497c450854d0dfee60d8b64e141a303f4e99b3.tar.zst godot-46497c450854d0dfee60d8b64e141a303f4e99b3.zip | |
added fallbacks proprty to fonts
Diffstat (limited to '')
| -rw-r--r-- | scene/resources/font.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/scene/resources/font.h b/scene/resources/font.h index 6728b59f8..27e3045ea 100644 --- a/scene/resources/font.h +++ b/scene/resources/font.h @@ -84,6 +84,7 @@ private: void _set_textures(const Vector<Variant> & p_textures); Vector<Variant> _get_textures() const; + Ref<Font> fallback; protected: static void _bind_methods(); @@ -113,9 +114,13 @@ public: int get_kerning_pair(CharType p_A,CharType p_B) const; Vector<KerningPairKey> get_kerning_pair_keys() const; - _FORCE_INLINE_ Size2 get_char_size(CharType p_char,CharType p_next=0) const; + inline Size2 get_char_size(CharType p_char,CharType p_next=0) const; Size2 get_string_size(const String& p_string) const; + + void set_fallback(const Ref<Font> &p_fallback); + Ref<Font> get_fallback() const; + void clear(); void set_distance_field_hint(bool p_distance_field); @@ -134,8 +139,11 @@ Size2 Font::get_char_size(CharType p_char,CharType p_next) const { const Character * c = char_map.getptr(p_char); - if (!c) + if (!c) { + if (fallback.is_valid()) + return fallback->get_char_size(p_char,p_next); return Size2(); + } Size2 ret(c->advance,c->rect.size.y); |
