Repository navigation
jaws: Cut braille text to fit a JAWS script call - #187
Conversation
|
Hi there, Please don't define a function like this in a header file. Instead define it in the TU where thE JAWS backend is defined. That said, is there some way we can chunk the text and queue it, or will we just have to deal with the text loss? |
|
@ethindp Thanks for your reply! I deleted the header and moved the function to jaws.cpp. On chunking… unfortunately, I don't believe we could do anything to it. I've tested it now, and second and all sequential messages do replace the first message on the Braille display. A timer could probably help, but then we'd impose our pace to the reader: the reader would either wait for too long, or not be able to read the previous chunk fast enough. |
|
@Menelion I sadly don't have many ideas beyodn this one, having little knowledge to how braille displays work or the protocols they expose to system software. I theorize that Prism implementing it's own braille communications engine may create some path to resolution, but doing so would be incredibly difficult, time consuming and would probably be a version 2.x thing. Re: characters. Your initial post says:
I would recommend you use what simdutf provides instead of handwriting |
JAWS does not run a script call longer than 255 UTF-16 code units, yet
IJawsApi::RunFunction still returns true for it. The JAWS backend
brailles through RunFunction("BrailleString(\"...\")"), whose wrapper
takes 17 of those units, so a braille text longer than 238 units never
reached the display while braille and output reported success.
Convert the text to UTF-16 first, then cut it to fit, letting simdutf's
trim_partial_utf16 drop a high surrogate left at the cut, so the
display shows the start of a long text instead of nothing. Speech is
not cut. The limit was measured with JAWS 2027 and is counted in
characters, not bytes: English, Ukrainian and Hebrew texts all stop at
238.
Signed-off-by: André Polykanine <[email protected]>
c78bb7e to
2a08720
Compare
|
I removed the hand-written helper and used simdutf, as you recommended.
|
|
@Menelion Alright, let's see what the linters think. If they have nothing to say, we'll merge. Otherwise, the routine is to fix all lints found, following the contributing guidelines, and once done we merge. Thank you for finding and reporting this! |
JAWS does not run a script call longer than 255 UTF-16 code units, but
IJawsApi::RunFunctionstill returnsVARIANT_TRUEfor it. The JAWS backend brailles throughRunFunction("BrailleString(\"...\")"), and the wrapper takes 17 of those units, so any Braille text longer than 238 units never reaches the display, whileprism_backend_brailleandprism_backend_outputreport success.Measured with JAWS 2027.2610.428 on Windows 11 (10.0.26300, x64), by sending texts of growing length through
RunFunctionand reading the display. Texts of up to 238 characters appear, and longer ones never do. RunFunction returnedtrueevery time. The limit is in characters, not bytes: English, Ukrainian and Hebrew texts all stop at 238, though 238 Ukrainian or Hebrew characters are about 410 bytes in UTF-8.The backend now cuts the text to the first 238 UTF-16 code units before building the call. It never cuts inside a code point, so a character outside the BMP is kept or dropped whole instead of splitting into a lone surrogate. Speech is not impacted by this change.
The cut length is computed by utf8_prefix_within_utf16_units in source/backends/jaws_braille.h, header-only so it can be tested without JAWS. tests/win32/jaws_braille covers ASCII, two- and three-byte characters, and a surrogate pair at and across the limit. It passes with -DPRISM_ENABLE_TESTS=ON -DBUILD_SHARED_LIBS=OFF (MSVC 14.51, Debug), and clang-tidy with the repository's .clang-tidy reports nothing for the changed files.
The backend notes in the manual describe the cut.
How to Reproduce (PowerShell 7, JAWS running with a Braille display):