Q-Vector (qcf4_lite.qvec): Decoupled Archetype Compression, Surgical Waqf Separation, and Rate-Distortion Optimization for High-Fidelity Mobile Rendering of the Medina Mushaf
Digital preservation and mobile rendering of the 15-line Medina Mushaf (al-Muṣḥaf al-Madanī), hand-calligraphed in Naskh script by Master Calligrapher Uthman Taha, faces a severe engineering dilemma between typographic authenticity and asset footprint. Standard dynamic OpenType/Metafont fonts (e.g., Digital Khatt V2, 214 KB) reduce file size by shaping characters dynamically, but rely on algorithmic spacing that distorts the calligrapher's line-ending elongation (kashida) and vertical ligature stacking (tarkīb), disrupting the spatial memory anchors relied upon by memorizers (Ḥuffāẓ). Conversely, official pre-composed glyph-per-word suites from the King Fahd Glorious Quran Printing Complex (KFGQPC)—such as QCF V2 (604 files, 93.3 MB) and QCF V4 (47 files, 37.8 MB, 31,091,362 raw non-Z path points)—preserve authentic handwriting at the cost of prohibitive mobile storage overhead, cross-page duplication across 84,000 isolated glyphs, and millions of redundant Bézier control points inherited from 1990s optical scanning noise. We introduce Q-Vector (qcf4_lite.qvec), an open-source, font-engine-independent binary vector format and mathematical optimization pipeline that reduces the complete 604-page Medina Mushaf from 37.8 MB to 9.51 MB (a 74.8% net reduction over QCF V4 and 89.8% over QCF V2) while preserving authentic 15-line page layout, word-level interactivity, and line-break fidelity. First, we explain why a purely procedural 1D medial-axis/Minkowski model aiming for < 1 MB was analytically evaluated and rejected prior to implementation due to differential envelope singularities, variable pen-tip tapering (at-tashʿīr), multi-tiered vocalization (tashkīl), and mobile GPU constraints. Second, we resolve the combinatorial blowup of 2D word glyphs through a 3-stage Human-in-the-Loop Waqf Surgery that isolates all 4,272 pause marks (ʿalāmāt al-waqf) across 2,939 bearer words into 5 reusable canonical glyphs decoupled from archetype identity via a per-word layout table (layout_waqfs). Third, we apply 3-tier Kashida clustering across exact vocalized strings (respecting the theological lower bound of 21,269 unique strings) to consolidate 84,000 glyphs into 25,707 dense archetypes (including 286 unified verse-end rosettes), followed by an exhaustive 480-point 4D Rate-Distortion Optimization (RDO) batch executed over 105.53 wall-clock hours (~738 CPU-hours) that prunes 1,519,933 noise points down to 2,697,282 quadratic Bézier/line primitives (a 91.3% total primitive reduction from QCF V4's 31.09M raw points, and -40.9% from our 4,560,517-point deduplicated baseline). Evaluated across all 25,707 archetypes, 11% RDO and ZigZag-VarInt quantization introduce a mean symmetric Chamfer error of just 15.2 UPM (0.29 px at mobile 600 px width) and an archetype SSIM of 0.9498 (while preserving crisp legibility at mobile scale, with only minor curve faceting visible under 350% zoom). Deployed inside the Tarsikh mobile application on a 2018 Snapdragon 630 device (Nokia 6.1, Android WebView), qcf4_lite.qvec achieves 60 FPS steady rendering (105.30 ms warm render, 23.37 MB JS heap) while saving 28.3 MB of application storage.
Authors
- Tarsikh Team
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-12-01
- DOI
- https://doi.org/10.5281/zenodo.24711524
- Primary Topic
- Graphic Design and Typography
- Type
- preprint