#!/bin/bash # Download Noto Sans fonts for multilingual PDF generation # Supports: CJK (Chinese, Japanese, Korean), Thai, Vietnamese, Russian, etc. set -e FONT_DIR="backend/fonts" echo "🔤 Downloading fonts for multilingual PDF generation..." # Create font directory mkdir -p "$FONT_DIR" # Function to download font download_font() { local url="$1" local file="$2" local desc="$3" if [ -f "$FONT_DIR/$file" ]; then echo "✓ $desc already exists" else echo "Downloading $desc..." if wget -q "$url" -O "$FONT_DIR/$file"; then SIZE=$(du -h "$FONT_DIR/$file" | cut -f1) echo "✓ $desc downloaded: $SIZE" else echo "✗ Failed to download $desc" return 1 fi fi } # NotoSansSC - Chinese (Simplified), also covers Japanese and basic CJK download_font \ "https://github.com/notofonts/noto-cjk/raw/main/Sans/Variable/TTF/Subset/NotoSansSC-VF.ttf" \ "NotoSansSC-Regular.ttf" \ "Noto Sans SC (Chinese/Japanese)" # NotoSansKR - Korean download_font \ "https://github.com/notofonts/noto-cjk/raw/main/Sans/Variable/TTF/Subset/NotoSansKR-VF.ttf" \ "NotoSansKR-Regular.ttf" \ "Noto Sans KR (Korean)" # NotoSansThai - Thai download_font \ "https://github.com/notofonts/noto-fonts/raw/main/hinted/ttf/NotoSansThai/NotoSansThai-Regular.ttf" \ "NotoSansThai-Regular.ttf" \ "Noto Sans Thai" echo "" echo "✅ Font setup complete!" echo "Supported languages: Chinese (zh-CN/zh-TW), Japanese (ja), Korean (ko)," echo " Thai (th), Russian (ru), Vietnamese (vi)," echo " and all Latin-based languages (en, de, fr, es, etc.)"