summaryrefslogtreecommitdiff
path: root/scene/resources/dynamic_font.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/dynamic_font.cpp')
-rw-r--r--scene/resources/dynamic_font.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/scene/resources/dynamic_font.cpp b/scene/resources/dynamic_font.cpp
index eea4d12d0e..442151de36 100644
--- a/scene/resources/dynamic_font.cpp
+++ b/scene/resources/dynamic_font.cpp
@@ -221,6 +221,8 @@ Error DynamicFontAtSize::_load() {
ascent = (face->size->metrics.ascender / 64.0) / oversampling * scale_color_font;
descent = (-face->size->metrics.descender / 64.0) / oversampling * scale_color_font;
+ underline_position = -face->underline_position / 64.0 / oversampling * scale_color_font;
+ underline_thickness = face->underline_thickness / 64.0 / oversampling * scale_color_font;
linegap = 0;
valid = true;
@@ -243,6 +245,16 @@ float DynamicFontAtSize::get_descent() const {
return descent;
}
+float DynamicFontAtSize::get_underline_position() const {
+
+ return underline_position;
+}
+
+float DynamicFontAtSize::get_underline_thickness() const {
+
+ return underline_thickness;
+}
+
const Pair<const DynamicFontAtSize::Character *, DynamicFontAtSize *> DynamicFontAtSize::_find_char_with_font(CharType p_char, const Vector<Ref<DynamicFontAtSize>> &p_fallbacks) const {
const Character *chr = char_map.getptr(p_char);
ERR_FAIL_COND_V(!chr, (Pair<const Character *, DynamicFontAtSize *>(nullptr, nullptr)));
@@ -821,6 +833,22 @@ float DynamicFont::get_descent() const {
return data_at_size->get_descent() + spacing_bottom;
}
+float DynamicFont::get_underline_position() const {
+
+ if (!data_at_size.is_valid())
+ return 2;
+
+ return data_at_size->get_underline_position();
+}
+
+float DynamicFont::get_underline_thickness() const {
+
+ if (!data_at_size.is_valid())
+ return 1;
+
+ return data_at_size->get_underline_thickness();
+}
+
Size2 DynamicFont::get_char_size(CharType p_char, CharType p_next) const {
if (!data_at_size.is_valid())