[Scummvm-git-logs] scummvm master -> 0198bef2358bcac316020cee5c8496fe38dbea0c
phcoder
noreply at scummvm.org
Thu Apr 27 02:24:31 UTC 2023
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0198bef235 SAGA: Fix wrong calculation of Big5 string height
Commit: 0198bef2358bcac316020cee5c8496fe38dbea0c
https://github.com/scummvm/scummvm/commit/0198bef2358bcac316020cee5c8496fe38dbea0c
Author: Vladimir Serbinenko (phcoder at gmail.com)
Date: 2023-04-27T04:24:27+02:00
Commit Message:
SAGA: Fix wrong calculation of Big5 string height
Changed paths:
engines/saga/font.cpp
diff --git a/engines/saga/font.cpp b/engines/saga/font.cpp
index a9bd26a8ed8..6af69dde4bb 100644
--- a/engines/saga/font.cpp
+++ b/engines/saga/font.cpp
@@ -461,7 +461,10 @@ void DefaultFont::textDrawRect(FontId fontId, const char *text, const Common::Re
w_total = 0;
len_total = 0;
if (wc == 0 && measurePointer) {
- searchPointer = measurePointer + 1;
+ if (isBig5 && (*measurePointer & 0x80))
+ searchPointer = measurePointer + 2;
+ else
+ searchPointer = measurePointer + 1;
}
wc = 0;
@@ -579,8 +582,19 @@ int DefaultFont::getHeight(FontId fontId, const char *text, int width, FontEffec
searchPointer = text;
endPointer = text + textLength;
+ // IHNM korean uses spaces, so we use western algorithm for it.
+ bool isBig5 = !!_chineseFont;
+
for (;;) {
- foundPointer = strchr(searchPointer, ' ');
+ if (isBig5) {
+ if (*searchPointer & 0x80)
+ foundPointer = searchPointer + 2;
+ else if (*searchPointer)
+ foundPointer = searchPointer + 1;
+ else
+ foundPointer = nullptr;
+ } else
+ foundPointer = strchr(searchPointer, ' ');
if (foundPointer == nullptr) {
// Ran to the end of the buffer
len = endPointer - measurePointer;
@@ -595,7 +609,10 @@ int DefaultFont::getHeight(FontId fontId, const char *text, int width, FontEffec
// This word won't fit
if (wc == 0) {
// The first word in the line didn't fit. Still print it
- searchPointer = measurePointer + 1;
+ if (isBig5 && (*measurePointer & 0x80))
+ searchPointer = measurePointer + 2;
+ else
+ searchPointer = measurePointer + 1;
}
// Wrap what we've got and restart
textPoint.y += h + TEXT_LINESPACING;
@@ -614,7 +631,10 @@ int DefaultFont::getHeight(FontId fontId, const char *text, int width, FontEffec
// Since word hit NULL but fit, we are done
return textPoint.y + h;
}
- searchPointer = measurePointer + 1;
+ if (isBig5 && (*measurePointer & 0x80))
+ searchPointer = measurePointer + 2;
+ else
+ searchPointer = measurePointer + 1;
}
}
}
More information about the Scummvm-git-logs
mailing list