aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaromir Wysoglad2019-07-14 21:48:26 +0200
committerFilippos Karapetis2019-09-01 22:47:55 +0300
commit5ee30a1b7342c21db8b32d4e87bdfa300a27a2b4 (patch)
tree22d40935fa085fe97f79c68f3731b7792924db9f
parentc899f5fbc3dfbaf8886c2b4f2438e372bbe18f2d (diff)
downloadscummvm-rg350-5ee30a1b7342c21db8b32d4e87bdfa300a27a2b4.tar.gz
scummvm-rg350-5ee30a1b7342c21db8b32d4e87bdfa300a27a2b4.tar.bz2
scummvm-rg350-5ee30a1b7342c21db8b32d4e87bdfa300a27a2b4.zip
TTS: Convert strings to UTF-8
Conversion happens only for languages, that might needed (not for english)
-rw-r--r--backends/text-to-speech/linux/linux-text-to-speech.cpp6
-rw-r--r--gui/widget.cpp4
2 files changed, 6 insertions, 4 deletions
diff --git a/backends/text-to-speech/linux/linux-text-to-speech.cpp b/backends/text-to-speech/linux/linux-text-to-speech.cpp
index 3445ca972a..9f330bc997 100644
--- a/backends/text-to-speech/linux/linux-text-to-speech.cpp
+++ b/backends/text-to-speech/linux/linux-text-to-speech.cpp
@@ -31,6 +31,8 @@
#include "common/translation.h"
#include "common/debug.h"
#include "common/system.h"
+#include "common/ustr.h"
+#include "common/config-manager.h"
SPDConnection *_connection;
void speech_begin_callback(size_t msg_id, size_t client_id, SPDNotificationType state){
@@ -104,6 +106,10 @@ void LinuxTextToSpeechManager::updateState(LinuxTextToSpeechManager::SpeechState
bool LinuxTextToSpeechManager::say(Common::String str) {
if (_speechState == BROKEN)
return true;
+ //Convert string, that might have foreign characters to UTF-8
+ if (ConfMan.get("gui_language") != "C") {
+ str = Common::convertUtf32ToUtf8(Common::convertToU32String(str.c_str(), Common::kWindows1250)).c_str();
+ }
if (isSpeaking())
stop();
debug("say: %s", str.c_str());
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 1a3986ef43..d02d64fbeb 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -258,10 +258,6 @@ Common::String Widget::cleanupHotkey(const Common::String &label) {
void Widget::read(Common::String str) {
#ifdef USE_TTS
-#if defined(USE_LINUX_TTS) && defined(USE_TRANSLATION)
- if (ConfMan.get("gui_language") != "C")
- return;
-#endif
if (ConfMan.hasKey("tts_enabled", "scummvm") &&
ConfMan.getBool("tts_enabled", "scummvm")) {
int volume = (ConfMan.getInt("speech_volume", "scummvm") * 100) / 256;