font stringclasses 3
values | case stringclasses 5
values | text stringclasses 5
values | path stringclasses 4
values | iou_vs_reference float64 0.07 1 | verdict stringclasses 3
values | missing_glyphs listlengths 0 8 |
|---|---|---|---|---|---|---|
SFArabic | greeting | مرحبا بكم | raqm_plain | 1 | identical | [] |
SFArabic | greeting | مرحبا بكم | raqm_reshaped | 0.223 | broken | [] |
SFArabic | greeting | مرحبا بكم | basic_plain | 0.181 | broken | [] |
SFArabic | greeting | مرحبا بكم | basic_reshaped | 0.847 | recognisable | [] |
SFArabic | sentence | التزامنا بالنزاهة | raqm_plain | 1 | identical | [] |
SFArabic | sentence | التزامنا بالنزاهة | raqm_reshaped | 0.199 | broken | [] |
SFArabic | sentence | التزامنا بالنزاهة | basic_plain | 0.11 | broken | [] |
SFArabic | sentence | التزامنا بالنزاهة | basic_reshaped | 0.814 | recognisable | [] |
SFArabic | with_digits | في عام 2026 | raqm_plain | 1 | identical | [
"2",
"0",
"6"
] |
SFArabic | with_digits | في عام 2026 | raqm_reshaped | 0.27 | broken | [
"2",
"0",
"6"
] |
SFArabic | with_digits | في عام 2026 | basic_plain | 0.234 | broken | [
"2",
"0",
"6"
] |
SFArabic | with_digits | في عام 2026 | basic_reshaped | 0.839 | recognisable | [
"2",
"0",
"6"
] |
SFArabic | mixed_latin | شركة Pixelogik للإنتاج | raqm_plain | 1 | identical | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
SFArabic | mixed_latin | شركة Pixelogik للإنتاج | raqm_reshaped | 0.677 | recognisable | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
SFArabic | mixed_latin | شركة Pixelogik للإنتاج | basic_plain | 0.559 | broken | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
SFArabic | mixed_latin | شركة Pixelogik للإنتاج | basic_reshaped | 0.853 | recognisable | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
SFArabic | diacritics | مَرْحَبًا بِكُمْ | raqm_plain | 1 | identical | [] |
SFArabic | diacritics | مَرْحَبًا بِكُمْ | raqm_reshaped | 0.167 | broken | [] |
SFArabic | diacritics | مَرْحَبًا بِكُمْ | basic_plain | 0.172 | broken | [] |
SFArabic | diacritics | مَرْحَبًا بِكُمْ | basic_reshaped | 0.345 | broken | [] |
GeezaPro | greeting | مرحبا بكم | raqm_plain | 1 | identical | [] |
GeezaPro | greeting | مرحبا بكم | raqm_reshaped | 0.252 | broken | [] |
GeezaPro | greeting | مرحبا بكم | basic_plain | 0.166 | broken | [] |
GeezaPro | greeting | مرحبا بكم | basic_reshaped | 0.763 | recognisable | [] |
GeezaPro | sentence | التزامنا بالنزاهة | raqm_plain | 1 | identical | [] |
GeezaPro | sentence | التزامنا بالنزاهة | raqm_reshaped | 0.186 | broken | [] |
GeezaPro | sentence | التزامنا بالنزاهة | basic_plain | 0.097 | broken | [] |
GeezaPro | sentence | التزامنا بالنزاهة | basic_reshaped | 0.665 | recognisable | [] |
GeezaPro | with_digits | في عام 2026 | raqm_plain | 1 | identical | [
"2",
"0",
"6"
] |
GeezaPro | with_digits | في عام 2026 | raqm_reshaped | 0.102 | broken | [
"2",
"0",
"6"
] |
GeezaPro | with_digits | في عام 2026 | basic_plain | 0.087 | broken | [
"2",
"0",
"6"
] |
GeezaPro | with_digits | في عام 2026 | basic_reshaped | 0.638 | recognisable | [
"2",
"0",
"6"
] |
GeezaPro | mixed_latin | شركة Pixelogik للإنتاج | raqm_plain | 1 | identical | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
GeezaPro | mixed_latin | شركة Pixelogik للإنتاج | raqm_reshaped | 0.27 | broken | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
GeezaPro | mixed_latin | شركة Pixelogik للإنتاج | basic_plain | 0.195 | broken | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
GeezaPro | mixed_latin | شركة Pixelogik للإنتاج | basic_reshaped | 0.4 | broken | [
"P",
"i",
"x",
"e",
"l",
"o",
"g",
"k"
] |
GeezaPro | diacritics | مَرْحَبًا بِكُمْ | raqm_plain | 1 | identical | [] |
GeezaPro | diacritics | مَرْحَبًا بِكُمْ | raqm_reshaped | 0.099 | broken | [] |
GeezaPro | diacritics | مَرْحَبًا بِكُمْ | basic_plain | 0.072 | broken | [] |
GeezaPro | diacritics | مَرْحَبًا بِكُمْ | basic_reshaped | 0.138 | broken | [] |
IBMPlexSansArabic | greeting | مرحبا بكم | raqm_plain | 1 | identical | [] |
IBMPlexSansArabic | greeting | مرحبا بكم | raqm_reshaped | 0.167 | broken | [] |
IBMPlexSansArabic | greeting | مرحبا بكم | basic_plain | 0.191 | broken | [] |
IBMPlexSansArabic | greeting | مرحبا بكم | basic_reshaped | 0.847 | recognisable | [] |
IBMPlexSansArabic | sentence | التزامنا بالنزاهة | raqm_plain | 1 | identical | [] |
IBMPlexSansArabic | sentence | التزامنا بالنزاهة | raqm_reshaped | 0.148 | broken | [] |
IBMPlexSansArabic | sentence | التزامنا بالنزاهة | basic_plain | 0.117 | broken | [] |
IBMPlexSansArabic | sentence | التزامنا بالنزاهة | basic_reshaped | 0.678 | recognisable | [] |
IBMPlexSansArabic | with_digits | في عام 2026 | raqm_plain | 1 | identical | [] |
IBMPlexSansArabic | with_digits | في عام 2026 | raqm_reshaped | 0.129 | broken | [] |
IBMPlexSansArabic | with_digits | في عام 2026 | basic_plain | 0.142 | broken | [] |
IBMPlexSansArabic | with_digits | في عام 2026 | basic_reshaped | 0.203 | broken | [] |
IBMPlexSansArabic | mixed_latin | شركة Pixelogik للإنتاج | raqm_plain | 1 | identical | [] |
IBMPlexSansArabic | mixed_latin | شركة Pixelogik للإنتاج | raqm_reshaped | 0.149 | broken | [] |
IBMPlexSansArabic | mixed_latin | شركة Pixelogik للإنتاج | basic_plain | 0.142 | broken | [] |
IBMPlexSansArabic | mixed_latin | شركة Pixelogik للإنتاج | basic_reshaped | 0.311 | broken | [] |
IBMPlexSansArabic | diacritics | مَرْحَبًا بِكُمْ | raqm_plain | 1 | identical | [] |
IBMPlexSansArabic | diacritics | مَرْحَبًا بِكُمْ | raqm_reshaped | 0.151 | broken | [] |
IBMPlexSansArabic | diacritics | مَرْحَبًا بِكُمْ | basic_plain | 0.151 | broken | [] |
IBMPlexSansArabic | diacritics | مَرْحَبًا بِكُمْ | basic_reshaped | 0.403 | broken | [] |
ArShape — when does the standard Arabic rendering recipe break Arabic?
Author: Syamjith NK Write-up: The Arabic fix everyone recommends is now the thing breaking your Arabic Companion dataset: ArNum-TTS — the same failure mode in speech.
The finding
arabic_reshaper + python-bidi before drawing is the standard advice for rendering
Arabic in Python. On any renderer that already performs complex-text layout it
corrupts the output, because the shaping and the bidi reorder both happen twice.
The word is "welcome":
| rendered as | |
|---|---|
| correct (no preprocessing) | مرحبا بكم |
| after reshaper + bidi | مكب ابحرم |
Each string sits alone in its own table cell, because putting them either side of an arrow on one line lets the bidi algorithm reorder them - which, on a page about Arabic being silently reordered, is exactly the wrong mistake to make.
Pillow 12 links Raqm/HarfBuzz, so it already does this work. The recipe was correct when it was written; text stacks caught up and the advice did not.
Measured
3 Arabic fonts × 5 strings × 4 rendering paths, scored on shape similarity against a verified-correct reference:
| rendering path | identical | recognisable | broken |
|---|---|---|---|
| modern engine, text as-is | 15 | 0 | 0 |
| modern engine + reshaper + bidi | 0 | 1 | 14 |
| no shaping engine, text as-is | 0 | 0 | 15 |
| no shaping engine + reshaper + bidi | 0 | 9 | 6 |
The last row is the useful nuance: on a renderer without shaping the recipe is a partial rescue. Plain Arabic recovers, but digits, embedded Latin and diacritics still fail — positioning combining marks and resolving bidirectional runs needs real shaping regardless of what you pre-process.
Font coverage trap
Checked against the font cmap tables, not by eye: SF Arabic and Geeza Pro contain
no Latin letters or digits at all. في عام 2026 renders the year as .notdef boxes
while looking entirely correct to anyone not reading the number. IBM Plex Sans Arabic
has full coverage.
The practical version
- Check whether your renderer does complex-text layout — in Pillow,
PIL.features.check("raqm"). - If it does: pass Arabic through untouched. Do not reshape.
- If it does not: reshape, and test digits, Latin and diacritics separately, because those will still be wrong.
- Check the font actually contains every character you are about to draw.
Honesty about method
Two errors, both caught only by looking at the output rather than the score, and both recorded because they are instructive:
- The premise was backwards. I was confident reshaping was required, so I made it the reference the others were scored against — which meant the correct renderings scored worst.
- The metric compared position as well as shape, so a visually identical render scored zero because two layout engines place glyphs a few pixels apart. Fixed by normalising to the ink bounding box, then reporting three bands instead of pass/fail — which is what exposed the partial-rescue result above.
A benchmark inherits the assumptions of whoever wrote it. The only reliable way to find them is to look at the output.
Reproduce
python render_bench.py
Renders every combination to out/ and writes results.jsonl. Images are not shipped
— they regenerate in seconds and the fonts are system fonts.
Does Arabic Survive the Pipeline?
This is one of three reproducible benchmarks, one per stage of a real production pipeline. Each measures an Arabic failure that looks correct to anyone who does not read Arabic — which is exactly why it ships.
- ArNum-TTS — do numbers survive speech synthesis?
- ArShape — does the standard reshaping recipe survive rendering? → you are here
- ArPDF — does Arabic survive a PDF round trip?
All three are CC BY 4.0 and ship the scorer, the raw per-item results, and an explicit statement of what the measurement does not establish.
- Downloads last month
- -