diff --git a/app/src/main/cpp/CvText.cpp b/app/src/main/cpp/CvText.cpp index e54c320f..e8619d28 100644 --- a/app/src/main/cpp/CvText.cpp +++ b/app/src/main/cpp/CvText.cpp @@ -435,7 +435,7 @@ namespace cv { CV_Assert(!FT_Load_Glyph(mFace, FT_Get_Char_Index(mFace, wstr[i]), FT_LOAD_RENDER)); #endif - FT_GlyphSlot slot = mFace->glyph; + FT_GlyphSlot slot = mFace->glyph; FT_Glyph glyph = NULL; int error = FT_Get_Glyph(mFace->glyph, &glyph); @@ -605,7 +605,14 @@ namespace cv { // Update current position ( in FreeType coordinates ) // float advance = mFace->glyph->advance.x >> 6; - currentPos.x += mFace->glyph->advance.x; + if (wstr[i] == ' ') + { + currentPos.x += mFace->glyph->advance.x << 1; + } + else + { + currentPos.x += mFace->glyph->advance.x; + } currentPos.y += mFace->glyph->advance.y; } @@ -711,7 +718,7 @@ namespace cv { ) { bbox.xMin = currentPos.x; - bbox.xMax = currentPos.x + (mFace->glyph->advance.x + mFace->glyph->metrics.horiBearingX); + bbox.xMax = currentPos.x + ((mFace->glyph->advance.x << 1) + mFace->glyph->metrics.horiBearingX); bbox.yMin = yMin; bbox.yMax = yMax; }