From 273f409a55bdac1ca737e449711e743166ef244d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phan=20Peccini?= Date: Sun, 8 Feb 2026 09:27:18 +0100 Subject: [PATCH] =?UTF-8?q?fix(pdf):=20Support=20des=20caract=C3=A8res=20U?= =?UTF-8?q?nicode=20(indices)=20dans=20g=C3=A9n=C3=A9ration=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- app/fiches/generer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/fiches/generer.py b/app/fiches/generer.py index 7456a9f..0d17023 100644 --- a/app/fiches/generer.py +++ b/app/fiches/generer.py @@ -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}")