From 9177325dbdcfddddff371c16c54323b445fc9044 Mon Sep 17 00:00:00 2001 From: Matthew Date: Sun, 28 Apr 2024 09:09:33 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E5=AD=97size?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/cpp/CvText.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/cpp/CvText.cpp b/app/src/main/cpp/CvText.cpp index e8619d28..01dbcdd5 100644 --- a/app/src/main/cpp/CvText.cpp +++ b/app/src/main/cpp/CvText.cpp @@ -712,11 +712,13 @@ namespace cv { // If codepoint is space(0x20), it has no glyph. // A dummy boundary box is needed when last code is space. + bool isSpace = false; if ( (bbox.xMin == 0) && (bbox.xMax == 0) && (bbox.yMin == 0) && (bbox.yMax == 0) ) { + isSpace = true; bbox.xMin = currentPos.x; bbox.xMax = currentPos.x + ((mFace->glyph->advance.x << 1) + mFace->glyph->metrics.horiBearingX); bbox.yMin = yMin; @@ -724,7 +726,7 @@ namespace cv { } // Update current position ( in FreeType coordinates ) - currentPos.x += mFace->glyph->advance.x; + currentPos.x += isSpace ? (mFace->glyph->advance.x << 1) : mFace->glyph->advance.x; currentPos.y += mFace->glyph->advance.y; // Update BoundaryBox ( in OpenCV coordinates )