Read aloud: Fix no audio produced when text contains <3 and using the Windows legacy speech engine. Fixes #2092948 [TTS Fail &lt;3](https://bugs.launchpad.net/calibre/+bug/2092948)

This commit is contained in:
Kovid Goyal 2025-01-07 12:36:43 +05:30
parent d2e499fe3e
commit dd1c998cb6
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 4 additions and 2 deletions

View File

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

View File

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