pdf / arabic_fonts_setup.sh
fokan's picture
Upload 50 files
30b350e verified
#!/bin/bash
# Arabic Fonts Setup Script for Enhanced RTL Support
# This script ensures optimal Arabic font support for LibreOffice PDF conversion
set -e
echo "🔤 Setting up Arabic fonts for perfect RTL support..."
# Create fonts directory in /tmp to avoid permission issues
FONTS_DIR="/tmp/fonts/truetype/arabic-enhanced"
mkdir -p "$FONTS_DIR"
# Download and install Amiri font (best for Traditional Arabic)
echo "📥 Installing Amiri font..."
cd /tmp
wget -q "https://github.com/aliftype/amiri/releases/download/0.117/Amiri-0.117.zip" -O amiri.zip
unzip -q amiri.zip
cp Amiri-0.117/*.ttf "$FONTS_DIR/"
rm -rf amiri.zip Amiri-0.117/
# Download and install Scheherazade New font
echo "📥 Installing Scheherazade New font..."
wget -q "https://github.com/silnrsi/font-scheherazade/releases/download/v3.300/ScheherazadeNew-3.300.zip" -O scheherazade.zip
unzip -q scheherazade.zip
cp ScheherazadeNew-3.300/*.ttf "$FONTS_DIR/"
rm -rf scheherazade.zip ScheherazadeNew-3.300/
# Set proper permissions
chmod 644 "$FONTS_DIR"/*.ttf
# Update font cache
echo "🔄 Updating font cache..."
fc-cache -fv
# Verify Arabic fonts installation
echo "✅ Verifying Arabic fonts installation..."
fc-list | grep -i "amiri\|scheherazade\|noto.*arabic" | head -10
echo "🎯 Arabic fonts setup completed successfully!"
echo "Available Arabic fonts:"
fc-list | grep -i "arabic\|amiri\|scheherazade" | cut -d: -f2 | sort | uniq