Braille Viewer draws two braille patterns wrongly (U+28CC, U+2873) because of glyph errors in FreeMono-FixedBraille.ttf

Aperta Adatta ai principianti
#21,022 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

  • #21064 di @unvisible789 — chiusa senza merge

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Inizia con fonts\FreeMono-FixedBraille.ttf e il controllo Python incluso che esegue il rendering di U+2800–U+28FF, quindi confronta il font fisso con il GNU FreeFont upstream. Conferma che U+28CC e U+2873 disegnino rispettivamente i punti 3-4-7-8 e 1-2-5-6-7 e che il controllo di tutti i pattern non segnali errori dei glifi nel font di Braille Viewer.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

audience/a11y-tester good first issue p4 triaged
Steps to reproduce:
  1. Open the Braille Viewer (NVDA menu > Tools > Braille Viewer).
  2. Use an output table that produces braille pattern U+28CC (dots 3-4-7-8) or U+2873 (dots 1-2-5-6-7). The simplest way: set the output table to Chinese (Taiwan, Mandarin) zh-tw.ctb, open Notepad and type or paste ⣌⡳. This table passes Unicode braille characters through unchanged, so the display gets exactly these two cells.
  3. Compare the cells drawn in the Braille Viewer with the dots on a braille display, or with the character codes.
Actual behavior:

The Braille Viewer draws the wrong dots for two patterns:

Character Correct dots Drawn by the Braille Viewer
U+28CC ⣌ 3-4-7-8 2-3-4-7-8 (looks the same as U+28CE ⣎)
U+2873 ⡳ 1-2-5-6-7 1-2-6-7 (dot 5 missing)

The braille display shows the correct dots. The text in the viewer's control also holds the correct characters (I read it back with WM_GETTEXT: U+28CC). Only the drawing is wrong.

Expected behavior:

The Braille Viewer draws the same dots that the braille display shows.

Cause:

The Braille Viewer uses the bundled font fonts\FreeMono-FixedBraille.ttf. The glyphs for U+28CC and U+2873 in that font are wrong. I rendered all 256 braille patterns (U+2800 to U+28FF) with Pillow, detected which of the 8 dot positions are inked, and compared them with each code point's bits. Only these two glyphs were wrong. The same check found no errors in Segoe UI Symbol.

The upstream GNU FreeFont FreeMono.ttf has the same two wrong glyphs, so the error probably comes from upstream and was carried into the fixed copy.

Check script (Python 3 with Pillow):

from PIL import Image, ImageDraw, ImageFont

FONT = r"C:\Program Files\NVDA\fonts\FreeMono-FixedBraille.ttf"
F = ImageFont.truetype(FONT, 200)

def render(ch):
    img = Image.new("L", (300, 300), 255)
    ImageDraw.Draw(img).text((50, 20), ch, font=F, fill=0)
    return img.load()

# Find the 8 dot centres from U+28FF (all dots)
px = render("\u28FF")
dark = [(x, y) for x in range(300) for y in range(300) if px[x, y] < 128]

def centres(vals):
    vals, out, cur = sorted(set(vals)), [], []
    for v in vals:
        if cur and v - cur[-1] > 3:
            out.append(sum(cur) / len(cur)); cur = []
        cur.append(v)
    return out + [sum(cur) / len(cur)]

cols, rows = centres(x for x, _ in dark), centres(y for _, y in dark)
POS = {1: (0, 0), 2: (0, 1), 3: (0, 2), 4: (1, 0), 5: (1, 1), 6: (1, 2), 7: (0, 3), 8: (1, 3)}
for code in range(256):
    img = render(chr(0x2800 + code))
    got = sum(1 << (d - 1) for d, (c, r) in POS.items() if img[int(cols[c]), int(rows[r])] < 128)
    if got != code:
        print(f"U+{0x2800 + code:04X}: expected {code:08b}, drawn {got:08b}")

Output:

U+2873: expected 01110011, drawn 01100011
U+28CC: expected 11001100, drawn 11001110
How I found it:

I was testing a braille table that puts Mandarin tones on dots 7 and 8. The Braille Viewer showed 2-3-4-7-8 where the braille display correctly showed 3-4-7-8.

NVDA logs, crash dumps and other attachments:

None needed. The problem is in the font file.

System configuration
NVDA installed/portable/running from source:

Installed

NVDA version:

2026.2 (AMD64)

Windows version:

Windows 11 Enterprise 10.0.26200

Name and version of other software in use when reproducing the issue:

Notepad

Other information about your system:

Braille display: Freedom Scientific Focus 40

Other questions
Does the issue still occur after restarting your computer?

Yes. The glyphs are wrong in the font file itself.

Have you tried any other versions of NVDA? If so, please report their behaviors.

No.

If NVDA add-ons are disabled, is your problem still occurring?

Yes. The font file is part of NVDA.

Does the issue still occur after you run the COM Registration Fixing Tool in NVDA's tools menu?

Not applicable.

Lingua principale
Python
Stelle
2.7k
Fork
842
Merge medio
2g 4h
PR unite (30g)
56

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di nvaccess/nvda

Tutte le issue di nvaccess/nvda

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.