Tutorial 5: Quran Script End-to-End
This tutorial is for users who want to download Quran Script data and render Arabic text reliably in apps.
1) What This Resource Is
Quran Script resources provide Arabic Quran text in script-specific formats (for example: word-by-word and ayah-by-ayah variants).
Depending on the selected package, script data can include:
- Verse-level text (
verse_key,text) - Script metadata (
script_type,font_family) - Word-level arrays (
words[].position,words[].text,words[].location) - Navigation metadata (
page_number,juz_number,hizb_number)
Primary category:
2) When to Use It
Use Quran Script data when you are building:
- Arabic Quran readers
- Word-by-word reading and study interfaces
- Features that require stable ayah or word keys for joins (translation, tafsir, audio sync)
3) How to Get Your First Example Resource
- Open https://qul.tarteel.ai/resources/quran-script.
- Keep the default listing order and open the first published card.
- Confirm the detail page includes:
-
Previewtab -
Helptab
-
- Confirm available downloads:
sqlitejson
- Confirm whether the package is marked
Word by wordorAyah by ayah.
This keeps onboarding concrete without hardcoding a resource ID.
4) What the Preview Shows (Website-Aligned)
On the script detail page:
-
Previewtab:-
Jump to Ayahselector - Previous/next ayah navigation
- Rendered Arabic script output (often word-by-word blocks in word resources)
-
-
Helptab:- Sample JSON structure
- Field descriptions (
verse_key,text,script_type,font_family,words) - Rendering notes and usage examples (CSS + JS)
Practical meaning:
- You should treat
verse_keyandwords[].locationas canonical join keys. - You should apply the provided
font_family(or compatible fallback) for accurate rendering.
5) Download and Use (Step-by-Step)
- Download selected script package (
jsonorsqlite). - Inspect core fields:
-
verse_keyinsurah:ayah textscript_typefont_family-
words(if word-by-word package)
-
- Normalize keys in your app:
- Ayah key:
surah:ayah - Word key:
surah:ayah:word
- Ayah key:
- Store verse and word rows in indexed tables/maps.
- Join with translation/tafsir/recitation by shared ayah keys.
- Apply RTL direction + script font in UI.
- Validate on one full surah and several random ayahs.
Starter integration snippet (JavaScript):
JavaScript
// Build fast verse lookup by canonical ayah key.
const buildVerseIndex = (rows) =>
rows.reduce((index, row) => {
index[row.verse_key] = {
text: row.text,
scriptType: row.script_type,
fontFamily: row.font_family,
words: Array.isArray(row.words) ? row.words : []
};
return index;
}, {});
// Render one verse with script-aware font + RTL settings.
const renderVerse = (container, verseRecord) => {
container.dir = "rtl";
container.style.textAlign = "right";
container.style.fontFamily = `${verseRecord.fontFamily || "serif"}, "Amiri Quran", "Noto Naskh Arabic", serif`;
container.textContent = verseRecord.text;
};
// Optional: render word-by-word blocks when word data exists.
const renderWordBlocks = (container, words) => {
container.innerHTML = "";
words
.slice()
.sort((a, b) => a.position - b.position)
.forEach((word) => {
const chip = document.createElement("span");
chip.textContent = word.text;
chip.title = word.location; // e.g., 1:1:2
chip.style.display = "inline-block";
chip.style.padding = "6px 10px";
chip.style.margin = "4px";
chip.style.border = "1px solid #e2e8f0";
chip.style.borderRadius = "8px";
container.appendChild(chip);
});
};
6) Real-World Example: Render One Ayah (Verse + Words)
Goal:
- User selects an ayah and sees both full Arabic verse text and word-by-word chips.
Inputs:
- Quran Script package (word-by-word variant)
Processing:
- User selects ayah key (example:
73:4). - App loads verse row by
verse_key. - App renders full verse text using script-aware font.
- App renders sorted
words[]as chips.
Expected output:
- Correct Arabic script display.
- Word order remains stable by
position. - Keys remain compatible with translation/tafsir/audio joins.
Interactive preview (temporary sandbox):
You can edit this code for testing. Edits are not saved and may not persist after refresh.
JavaScript Playground
Editor
Preview
7) Common Mistakes to Avoid
- Joining script data to other resources using row order instead of keys.
- Ignoring
font_familyand then assuming text is wrong when rendering is visually off. - Treating word-by-word and ayah-by-ayah packages as interchangeable shapes.
- Ignoring
words[].positionand rendering words out of order.
8) When to Request Updates or Changes
Open an issue if you find:
- Missing ayah rows or mismatched
verse_keyvalues - Broken json/sqlite links for script resources
- Incorrect word order/location keys in word-by-word exports
- Metadata inconsistencies in
script_typeorfont_family
Issue tracker: