TTS: Convert strings to UTF-8

Conversion happens only for languages, that might needed (not
for english)
This commit is contained in:
Jaromir Wysoglad 2019-07-14 21:48:26 +02:00 committed by Filippos Karapetis
parent c899f5fbc3
commit 5ee30a1b73
2 changed files with 6 additions and 4 deletions

View file

@ -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());

View file

@ -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;