fix(pdf): Support des caractères Unicode (indices) dans génération PDF

Problème:
- Warning lors de la génération PDF: Missing character U+2083 (₃)
- La police Latin Modern Roman ne supporte pas les indices Unicode

Cause:
- XeLaTeX utilise par défaut lmroman10-regular qui ne contient pas
  les caractères Unicode étendus (indices, exposants, symboles)

Solution:
- Configuration de polices Liberation qui supportent pleinement Unicode
  * mainfont=Liberation Serif (texte principal)
  * sansfont=Liberation Sans (titres, interface)
  * monofont=Liberation Mono (code, technique)
- Polices Liberation sont des équivalents open-source de Times/Arial/Courier
- Pré-installées sur Fedora/RHEL et disponibles sur toutes distributions

Avantages:
- Support complet Unicode (indices ₀₁₂₃, exposants ⁰¹²³, etc.)
- Polices open-source et largement disponibles
- Meilleur rendu pour caractères scientifiques et mathématiques
- Compatibles avec la métrique des polices Microsoft

Impact:
- Plus de warnings pour les caractères Unicode
- PDF générés avec caractères spéciaux correctement affichés
This commit is contained in:
Stéphan Peccini 2026-02-08 09:27:18 +01:00
parent 64f041f04f
commit 273f409a55
Signed by: stephan
GPG Key ID: 3A9774E9CCBF3501

View File

@ -192,7 +192,13 @@ def generer_fiche(md_source: str, dossier: str, nom_fichier: str, seuils: dict)
md_path,
to="pdf",
outputfile=pdf_path,
extra_args=["--pdf-engine=xelatex", "-V", "geometry:margin=2cm"]
extra_args=[
"--pdf-engine=xelatex",
"-V", "geometry:margin=2cm",
"-V", "mainfont=Liberation Serif",
"-V", "sansfont=Liberation Sans",
"-V", "monofont=Liberation Mono"
]
)
except Exception as e:
st.error(f"[ERREUR] Génération PDF échouée pour {md_path}: {e}")