pdf / ARABIC_FONTS_FIX.md
fokan's picture
Upload 55 files
2760df1 verified

Arabic Fonts Installation Fix for Ubuntu 22.04

Problem Identified

The Docker build was failing because:

  1. fonts-scheherazade-new is not available in Ubuntu 22.04
  2. fonts-scheherazade is also not available in Ubuntu 22.04

Root Cause

Ubuntu 22.04 (jammy) does not include the Scheherazade font packages in its official repositories.

Solution Implemented

  1. Used Available Arabic Fonts: Replaced unavailable font packages with officially available ones:

    • fonts-noto-naskh-arabic
    • fonts-noto-kufi-arabic
    • fonts-hosny-amiri
  2. Manual Font Installation: Added direct download of Scheherazade New font from Google Fonts repository:

    RUN mkdir -p /usr/share/fonts/truetype/scheherazade \
        && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Regular.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Regular.ttf \
        && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Bold.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Bold.ttf \
        && fc-cache -fv
    

Changes Made

Dockerfile

  • Removed unavailable font packages (fonts-scheherazade-new, fonts-scheherazade)
  • Added available Arabic font packages for Ubuntu 22.04
  • Added manual installation of Scheherazade New font from Google Fonts
  • Kept all other packages and configuration the same

Expected Results

These changes should resolve the build error and provide comprehensive Arabic font support:

Build Success: Docker image will build without font package errors ✅ Arabic Support: Multiple Arabic fonts available for document rendering ✅ Scheherazade New: Manually installed for users who specifically need this font ✅ Compatibility: Maintained Ubuntu 22.04 base image for Hugging Face Spaces compatibility

Font Options Now Available

  1. Noto Naskh Arabic - General Arabic text rendering
  2. Noto Kufi Arabic - Modern Arabic UI text
  3. Amiri - Classical Arabic typography
  4. Scheherazade New - Manually installed from Google Fonts
  5. Liberation Fonts - Latin text with Arabic support
  6. DejaVu Fonts - Extended character set support

Verification Steps

  1. Rebuild the Docker image
  2. Verify the image builds without errors
  3. Check that all fonts are properly installed:
    fc-list | grep -i arabic
    fc-list | grep -i scheherazade
    fc-list | grep -i amiri
    
  4. Test document conversion with Arabic text

Additional Benefits

  • Better font diversity for Arabic document rendering
  • Fallback options if one font is not available
  • Manual installation ensures latest font versions
  • No dependency on Ubuntu repository availability