mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
PPGe: Apply overlong handling to wrapped text too.
This commit is contained in:
parent
233b0a87c1
commit
7d085966f1
@ -954,10 +954,7 @@ static void PPGeDecimateTextImages(int age) {
|
||||
}
|
||||
}
|
||||
|
||||
void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
static std::string PPGeSanitizeText(const std::string &text) {
|
||||
// Seen in Ratchet & Clank - Secret Agent. To match the output of the real thing, we have to remove
|
||||
// both the overlong encoding and "ENTR", whatever that is. If we just let SanitizeUTF8 remove
|
||||
// the overlong null, the rest of the string is missing in the bottom left corner (save size, etc).
|
||||
@ -966,7 +963,14 @@ void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style) {
|
||||
// TODO: Potentially if the string is only ended by a C080, ReplaceAll might overshoot :(
|
||||
std::string str = ReplaceAll(text, "\xC0\x80""ENTR", "");
|
||||
// Then SanitizeUTF8 is needed to get rid of various other overlong encodings.
|
||||
str = SanitizeUTF8(str);
|
||||
return SanitizeUTF8(str);
|
||||
}
|
||||
|
||||
void PPGeDrawText(const char *text, float x, float y, const PPGeStyle &style) {
|
||||
if (!text) {
|
||||
return;
|
||||
}
|
||||
std::string str = PPGeSanitizeText(text);
|
||||
if (str.empty()) {
|
||||
return;
|
||||
}
|
||||
@ -1013,7 +1017,7 @@ static std::string CropLinesToCount(const std::string &s, int numLines) {
|
||||
}
|
||||
|
||||
void PPGeDrawTextWrapped(const char *text, float x, float y, float wrapWidth, float wrapHeight, const PPGeStyle &style) {
|
||||
std::string s = text;
|
||||
std::string s = PPGeSanitizeText(text);
|
||||
if (wrapHeight != 0.0f) {
|
||||
s = StripTrailingWhite(s);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user