Merge pull request #15958 from unknownbrackets/osd-ascii

UI: Only force ASCII messages if they're ASCII
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2022-09-04 07:34:26 +02:00
commit 49d5b64479
1 file changed
+4 -2
+4 -2
View File
@@ -3,6 +3,7 @@
#include "UI/OnScreenDisplay.h"
#include "Common/Data/Color/RGBAUtil.h"
#include "Common/Data/Encoding/Utf8.h"
#include "Common/Render/TextureAtlas.h"
#include "Common/Render/DrawBuffer.h"
@@ -33,9 +34,10 @@ void OnScreenMessagesView::Draw(UIContext &dc) {
// Messages that are wider than the screen are left-aligned instead of centered.
int align = 0;
// Simple heuristic: Draw messages that contain line breaks with ASCII_FONT (likely debug output)
// If we have newlines, we may be looking at ASCII debug output. But let's verify.
if (iter->text.find('\n') != 0) {
align |= FLAG_DYNAMIC_ASCII;
if (!UTF8StringHasNonASCII(iter->text.c_str()))
align |= FLAG_DYNAMIC_ASCII;
}
float tw, th;