fokan commited on
Commit
2760df1
·
verified ·
1 Parent(s): 0134048

Upload 55 files

Browse files
Files changed (2) hide show
  1. ARABIC_FONTS_FIX.md +64 -0
  2. Dockerfile +10 -2
ARABIC_FONTS_FIX.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Arabic Fonts Installation Fix for Ubuntu 22.04
2
+
3
+ ## Problem Identified
4
+ The Docker build was failing because:
5
+ 1. `fonts-scheherazade-new` is not available in Ubuntu 22.04
6
+ 2. `fonts-scheherazade` is also not available in Ubuntu 22.04
7
+
8
+ ## Root Cause
9
+ Ubuntu 22.04 (jammy) does not include the Scheherazade font packages in its official repositories.
10
+
11
+ ## Solution Implemented
12
+ 1. **Used Available Arabic Fonts**: Replaced unavailable font packages with officially available ones:
13
+ - `fonts-noto-naskh-arabic`
14
+ - `fonts-noto-kufi-arabic`
15
+ - `fonts-hosny-amiri`
16
+
17
+ 2. **Manual Font Installation**: Added direct download of Scheherazade New font from Google Fonts repository:
18
+ ```dockerfile
19
+ RUN mkdir -p /usr/share/fonts/truetype/scheherazade \
20
+ && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Regular.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Regular.ttf \
21
+ && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Bold.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Bold.ttf \
22
+ && fc-cache -fv
23
+ ```
24
+
25
+ ## Changes Made
26
+
27
+ ### Dockerfile
28
+ - Removed unavailable font packages (`fonts-scheherazade-new`, `fonts-scheherazade`)
29
+ - Added available Arabic font packages for Ubuntu 22.04
30
+ - Added manual installation of Scheherazade New font from Google Fonts
31
+ - Kept all other packages and configuration the same
32
+
33
+ ## Expected Results
34
+ These changes should resolve the build error and provide comprehensive Arabic font support:
35
+
36
+ ✅ **Build Success**: Docker image will build without font package errors
37
+ ✅ **Arabic Support**: Multiple Arabic fonts available for document rendering
38
+ ✅ **Scheherazade New**: Manually installed for users who specifically need this font
39
+ ✅ **Compatibility**: Maintained Ubuntu 22.04 base image for Hugging Face Spaces compatibility
40
+
41
+ ## Font Options Now Available
42
+ 1. **Noto Naskh Arabic** - General Arabic text rendering
43
+ 2. **Noto Kufi Arabic** - Modern Arabic UI text
44
+ 3. **Amiri** - Classical Arabic typography
45
+ 4. **Scheherazade New** - Manually installed from Google Fonts
46
+ 5. **Liberation Fonts** - Latin text with Arabic support
47
+ 6. **DejaVu Fonts** - Extended character set support
48
+
49
+ ## Verification Steps
50
+ 1. Rebuild the Docker image
51
+ 2. Verify the image builds without errors
52
+ 3. Check that all fonts are properly installed:
53
+ ```bash
54
+ fc-list | grep -i arabic
55
+ fc-list | grep -i scheherazade
56
+ fc-list | grep -i amiri
57
+ ```
58
+ 4. Test document conversion with Arabic text
59
+
60
+ ## Additional Benefits
61
+ - Better font diversity for Arabic document rendering
62
+ - Fallback options if one font is not available
63
+ - Manual installation ensures latest font versions
64
+ - No dependency on Ubuntu repository availability
Dockerfile CHANGED
@@ -34,6 +34,10 @@ RUN apt-get update && apt-get install -y \
34
  fonts-noto-ui-core \
35
  fonts-noto-mono \
36
  fonts-noto-color-emoji \
 
 
 
 
37
  fontconfig \
38
  wget \
39
  curl \
@@ -41,12 +45,16 @@ RUN apt-get update && apt-get install -y \
41
  locales \
42
  # Add Microsoft fonts for Arial support
43
  fonts-freefont-ttf \
44
- # FIXED: Use correct package name for Ubuntu 22.04
45
- fonts-scheherazade \
46
  # Add unoconv for fallback conversion
47
  unoconv \
48
  && rm -rf /var/lib/apt/lists/*
49
 
 
 
 
 
 
 
50
  # Generate Arabic locale
51
  RUN locale-gen ar_SA.UTF-8
52
 
 
34
  fonts-noto-ui-core \
35
  fonts-noto-mono \
36
  fonts-noto-color-emoji \
37
+ # ADDED: Available Arabic fonts in Ubuntu 22.04
38
+ fonts-noto-naskh-arabic \
39
+ fonts-noto-kufi-arabic \
40
+ fonts-hosny-amiri \
41
  fontconfig \
42
  wget \
43
  curl \
 
45
  locales \
46
  # Add Microsoft fonts for Arial support
47
  fonts-freefont-ttf \
 
 
48
  # Add unoconv for fallback conversion
49
  unoconv \
50
  && rm -rf /var/lib/apt/lists/*
51
 
52
+ # Manually install Scheherazade New font from Google Fonts
53
+ RUN mkdir -p /usr/share/fonts/truetype/scheherazade \
54
+ && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Regular.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Regular.ttf \
55
+ && wget -q https://github.com/google/fonts/raw/main/ofl/scheherazadenew/ScheherazadeNew-Bold.ttf -O /usr/share/fonts/truetype/scheherazade/ScheherazadeNew-Bold.ttf \
56
+ && fc-cache -fv
57
+
58
  # Generate Arabic locale
59
  RUN locale-gen ar_SA.UTF-8
60