[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacspeak] Pull request for unicode handling



Hello,
As I said in the pull request I'll add a patch (the kind accepted by git-am) in
a mail in case you still have difficulties merging the pull request.

-- 
Kind Regards,

Aleksandar Sredojevic
From 8266398d7683a7fc97ff9526f01208158f42f0f3 Mon Sep 17 00:00:00 2001
From: Sekulum Forka <dictatorofturkmenistan@xxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2024 21:54:16 +0100
Subject: [PATCH 1/2] dtk-speak, emacspeak-speak: change when unicode is
 handled

* only do the various transformations when dtk-handle unicode is set
* dtk-handle-unicode can be set by the user but in the next commit the
  various engines will set it automatically that need this.
---
 lisp/dtk-speak.el       | 6 +++++-
 lisp/emacspeak-speak.el | 3 +--
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/dtk-speak.el b/lisp/dtk-speak.el
index bd96b24..18f4645 100644
--- a/lisp/dtk-speak.el
+++ b/lisp/dtk-speak.el
@@ -247,6 +247,10 @@ mac for MAC TTS (default on Mac)")
   :type 'integer
   :group 'tts)
 
+(defvar dtk-handle-unicode nil
+  "convert unicode characters if the speech server doesn't support it.
+  This variable shouldn't usually be set")
+
 (defvar-local dtk-quiet nil
   "Silence speech ")
 
@@ -1719,7 +1723,7 @@ unless   `dtk-quiet' is set to t. "
         (dtk--delete-invisible-text)
         (dtk-handle-repeating-patterns mode)
         (when pron-table (tts-apply-pronunciations pron-table))
-        (dtk-unicode-replace-chars mode)
+        (when dtk-handle-unicode (dtk-unicode-replace-chars mode))
         (dtk-quote mode)
         (goto-char (point-min))         ; text is ready to be spoken
         (skip-syntax-forward "-")       ;skip leading whitespace
diff --git a/lisp/emacspeak-speak.el b/lisp/emacspeak-speak.el
index 21de0df..11dd16e 100644
--- a/lisp/emacspeak-speak.el
+++ b/lisp/emacspeak-speak.el
@@ -1032,7 +1032,7 @@ char is assumed to be one of a--z."
   (when char
     (cond
      ((emacspeak-is-alpha-p char) (dtk-letter (char-to-string char)))
-     ((> char 128) (emacspeak-speak-char-name char))
+     ((and dtk-handle-unicode (> char 128)) (emacspeak-speak-char-name char))
      (t (dtk-dispatch (dtk-char-to-speech char))))))
 
 (defun emacspeak-speak-char (&optional prefix)
@@ -1049,7 +1049,6 @@ Pronounces character phonetically unless  called with a PREFIX arg."
     (when char
       (cond
        ((stringp display) (dtk-speak display))
-       ((> char 128) (emacspeak-speak-char-name char))
        ((and (not prefix)
              (emacspeak-is-alpha-p char))
         (dtk-speak (emacspeak-get-phonetic-string char)))
-- 
2.44.0


From e2b72ab62ed6d5b8cc6f5fed46ac8ca7200baa83 Mon Sep 17 00:00:00 2001
From: Sekulum Forka <dictatorofturkmenistan@xxxxxxxxxxxxxx>
Date: Tue, 12 Mar 2024 21:58:43 +0100
Subject: [PATCH 2/2] dectalk-voices, outloud-voices: enable unicode handling
 for these engines

mac, espeak, and most other modern ttses can handle unicode in some way,
these are the only ones that really need help.
---
 lisp/dectalk-voices.el | 1 +
 lisp/outloud-voices.el | 1 +
 2 files changed, 2 insertions(+)

diff --git a/lisp/dectalk-voices.el b/lisp/dectalk-voices.el
index 66f5518..be80f37 100644
--- a/lisp/dectalk-voices.el
+++ b/lisp/dectalk-voices.el
@@ -368,6 +368,7 @@ and TABLE gives the values along that dimension."
   (setq-default dtk-speech-rate-step 50
                 dtk-speech-rate-base 150)
   (dtk-set-character-scale 1.5 'default)
+  (setq dtk-handle-unicode t)
   (dtk-unicode-update-untouched-charsets
    '(ascii latin-iso8859-1 latin-iso8859-15 latin-iso8859-9 eight-bit-graphic)))
 
diff --git a/lisp/outloud-voices.el b/lisp/outloud-voices.el
index 474bd0c..fe57fe1 100644
--- a/lisp/outloud-voices.el
+++ b/lisp/outloud-voices.el
@@ -298,6 +298,7 @@
                 dtk-speech-rate outloud-default-speech-rate
                 dtk-speech-rate-base 50)
   (dtk-set-character-scale 1.5 'default)
+  (setq dtk-handle-unicode t)
   (dtk-unicode-update-untouched-charsets
    '(ascii latin-iso8859-1 latin-iso8859-15 latin-iso8859-9
            eight-bit-graphic)))
-- 
2.44.0



|Full archive May 1995 - present by Year|Search the archive|


If you have questions about this archive or had problems using it, please contact us.

Contact Info Page