Sunday, November 27, 2005

KOffice Gets Text-to-Speech?

I have committed a new Text-to-Speech (TTS) capability to the KOffice svn code repository. By default, the TTS feature is off. In KWord, KSpread, and KPresenter, you can activate it in the Configure dialog.

It adds a kinda screen reader capability to all KO apps. It can speak the text of widgets under the mouse pointer and/or widgets that have the focus. It also adds a "Speak Text" option in the context menu of the KWord Document Structure Area, which is useful for speaking a document. Note that this capability is not intended for completely blind users. Instead, it is intended for users with other visual disabilities. I would like feedback as to whether this feature is useful. In particular, I would like to hear from anyone with visual disabilities.

This capability will be removed (or adapted) when KO is converted to KDE4, where hopefully we will have a proper screen reader using the Assistive Technology - Service Provider Interface.

The capability mostly works (at least for me), but there are a few problems:

1. Cannot speak menu items under the mouse pointer in a QMenuBar (the main menu). If anyone can tell me how to determine the menu item in a QMenuBar given a global coordinate, I'd be appreciative.

2. Doesn't support all kinds of widgets.

It is implemented as a new object, lib/kofficecore/KoSpeaker.cpp, which is created in lib/kofficecore/komainwindow.cc, and therefore is created in all KO apps (except Kexi). The code is quite a hack, so unless there is positive feedback, I may decide to remove it from the 3.5 final product. If anything, the code is a good example of why we need a proper accessibility infrastructure, such as will be available in KDE 4.

To try it, you'll need to

1. Build KOffice from svn.

2. Install KTTSD from 3.4 or 3.5 kdeaccessibility module. Configure with a suitable synth engine. A really lightweight English-only synth is Festival Lite (flite), but Festival is a good choice in general.

I haven't yet added configuration pages to the other KO apps, but if you want to test it under those apps now, you can add a section like this to the corresponding rc file in $HOME/.kde/share/config

[TTS]
AcceleratorPrefixWord=Accelerator
PollingInterval=600
SpeakAccelerators=true
SpeakDisabled=true
SpeakFocusWidget=false
SpeakPointerWidget=true
SpeakTooltips=true
SpeakWhatsThis=true

SpeakPointerWidget and SpeakFocusWidget true enable speaking of the widget under the mouse pointer and speaking the focused widget respectively.