From dd1c998cb6ca294c12ed1ea9c9a813354a079004 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 7 Jan 2025 12:36:43 +0530 Subject: [PATCH] Read aloud: Fix no audio produced when text contains <3 and using the Windows legacy speech engine. Fixes #2092948 [TTS Fail <3](https://bugs.launchpad.net/calibre/+bug/2092948) --- src/calibre/gui2/tts/develop.py | 2 +- src/calibre/gui2/tts/qt.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/gui2/tts/develop.py b/src/calibre/gui2/tts/develop.py index 48b709df9a..0463047f11 100644 --- a/src/calibre/gui2/tts/develop.py +++ b/src/calibre/gui2/tts/develop.py @@ -11,7 +11,7 @@ from calibre.gui2.main_window import MainWindow from calibre.gui2.tts.manager import TTSManager TEXT = '''\ -Demonstration 🐈 of DOCX support in calibre +Demonstration 🐈 of DOCX <3 support in calibre This document demonstrates the ability of the calibre DOCX Input plugin to convert the various typographic features in a Microsoft Word (2007 and newer) document. Convert this document to a modern ebook format, such as AZW3 for Kindles or EPUB for other ebook readers, diff --git a/src/calibre/gui2/tts/qt.py b/src/calibre/gui2/tts/qt.py index 0a6d06a8a4..7bb246faaf 100644 --- a/src/calibre/gui2/tts/qt.py +++ b/src/calibre/gui2/tts/qt.py @@ -53,9 +53,11 @@ class QtTTSBackend(TTSBackend): def say(self, text: str) -> None: self.last_word_offset = 0 self.last_spoken_word = None - self.speaking_text = text if self.tts.engine() == 'sapi': + # https://bugs.launchpad.net/bugs/2092948 + text = text.replace('<3', ' 3') self.ignore_tracking_until_state_changes_to_speaking = True + self.speaking_text = text self.tts.say(text) def error_message(self) -> str: