From f872dbf02c81eab1f9bf002531235616a7af7759 Mon Sep 17 00:00:00 2001 From: barron1988 <120796547@qq.com> Date: Wed, 20 Nov 2024 14:00:16 +0800 Subject: [PATCH] update getUtf8TextBoundingBox --- pipeline/Drawer2D.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipeline/Drawer2D.cpp b/pipeline/Drawer2D.cpp index a3ad362..0fbcc9e 100644 --- a/pipeline/Drawer2D.cpp +++ b/pipeline/Drawer2D.cpp @@ -421,7 +421,7 @@ osg::Vec4 Drawer2D::getUtf8TextBoundingBox(const std::string& text, float size, BLGlyphBuffer gb; gb.setUtf8Text(text.data(), text.size()); BLTextMetrics tm; BLFontMetrics fm = font.metrics(); font.shape(gb); font.getTextMetrics(gb, tm); float xx = fm.ascent, yy = fm.lineGap + size; - const BLBox& bb = tm.boundingBox; bbox.set(bb.x0, bb.y0, bb.x1 - bb.x0 + xx, bb.y1 - bb.y0 + yy); + const BLBox& bb = tm.boundingBox; bbox.set(bb.x0, bb.y0 + fm.descent, bb.x1, bb.y1 - bb.y0 + yy); } return bbox; } -- Gitee