ClementGre / PDF4Teachers

PDF editing software in large quantities. Designed for teachers, this app keeps recorded previous annotations, and offers features like marking scale, PDF conversion, vectorial drawing...
https://pdf4teachers.org/
Apache License 2.0
136 stars 17 forks source link

PDF4Teachers crée de nombreux fichiers temporaires de polices #119

Closed ysalmon closed 2 years ago

ysalmon commented 2 years ago

Describe the bug Dès le démarrage du logiciel (et même si aucun document n'est ouvert), de nombreux fichiers +JXF….tmp sont générés dans /tmp. Ce sont des fichiers de polices de caractères (TrueType, etc.). Sur ma machine, cela fait 3564 fichiers, représentant une taille totale de 856 Mo.

Ces fichiers sont supprimés lorsqu'on ferme le logiciel.

Comme j'ai un SSD, ça va assez vite (ça prend quand même plusieurs secondes). Mais sur une machine avec un disque dur, ça doit prendre un certain temps. C'est de plus de l'espace (temporairement) gâché, et ça dénote une énumération des polices de caractères qui n'est pas a priori utile (en tout cas pas à ce stade).

Idéalement, seules les polices effectivement utilisées devraient être énumérées. Je ne suis pas sûr qu'on ait besoin que la liste des polices disponibles affiche chacune avec son propre style : il ne s'agit pas d'un logiciel à visée artistique, on ne va pas aller chercher une police fantaisiste.

To Reproduce Steps to reproduce the behavior:

  1. Démarrer PDF4Teachers

Check the console

Starting PDF4Teachers... (Java 17.0.1)
Executing with toOpenPath = []
Instance locked: true

(PDF4Teachers:12705): Gdk-WARNING **: 21:57:11.404: XSetErrorHandler() called with a GDK error trap pushed. Don't do that.
java.lang.ClassCastException: class [B cannot be cast to class java.lang.String ([B and java.lang.String are in module java.base of loader 'bootstrap')
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.datasaving.simpleconfigs.SystemFontsData.manageLoadedData(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.datasaving.simpleconfigs.SimpleConfig.lambda$loadData$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Unable to load sysfonts_cache
Indexing system fonts... (2498 fonts)
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:14 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:15 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:17 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
java.io.FileNotFoundException: /home/yann/.fonts/Roboto-Regular.ttf (Aucun fichier ou dossier de ce type)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.utils.fonts.SystemFontsMapper.lambda$loadFontsFromSystemFiles$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: /home/yann/.fonts/Roboto-Italic.ttf (Aucun fichier ou dossier de ce type)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.utils.fonts.SystemFontsMapper.lambda$loadFontsFromSystemFiles$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: /home/yann/.fonts/Roboto Condensed-Regular.ttf (Aucun fichier ou dossier de ce type)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.utils.fonts.SystemFontsMapper.lambda$loadFontsFromSystemFiles$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: /home/yann/.fonts/Roboto-Medium.ttf (Aucun fichier ou dossier de ce type)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.utils.fonts.SystemFontsMapper.lambda$loadFontsFromSystemFiles$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
java.io.FileNotFoundException: /home/yann/.fonts/Roboto-Bold.ttf (Aucun fichier ou dossier de ce type)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at java.base/java.io.FileInputStream.<init>(Unknown Source)
        at fr.clementgre.pdf4teachers/fr.clementgre.pdf4teachers.utils.fonts.SystemFontsMapper.lambda$loadFontsFromSystemFiles$0(Unknown Source)
        at java.base/java.lang.Thread.run(Unknown Source)
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:18 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:19 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:19 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Feb 08, 2022 9:57:19 PM org.apache.fontbox.ttf.CmapSubtable processSubtype14
AVERTISSEMENT: Format 14 cmap table is not supported and will be ignored
Loaded 2073/2498 fonts in 6.59s (430 unable to load due to PDFBox restrictions, usually missing tables)

Edits If applicable, export the concerned edit with Tools > Export Edit/Grade scale > Export edit You can rename file(s) name/text elements or delete all texts: section if the text elements are not concerned.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

ClementGre commented 2 years ago

Bonjour, Cette opération d'indexation des polices d'écriture permet de déterminer si une police est compatible avec la bibliothèque utilisée pour éditer les documents PDF. En effet, je ne peut pas me permettre de proposer des polices d'écriture qui ne pourront pas être exportées par la suite. Je peut accéder à la liste des polices et les utiliser sans avoir à toutes les charger, mais je dois les récupérer sous forme de fichier pour pouvoir tester leur compatibilité, et plus tard pour inclure leur fichier .ttf, .otf ou .ttc dans le PDF.

Cette opération est donc nécessaire, et elle ne s'exécute que au premier démarrage ou quand une nouvelle police a été ajoutée, mais c'est vrai que les polices n'ont pas besoin de rester en cache.

Étant donné que cette indexation ne s'effectue qu'au premier démarrage et quand une nouvelle police a été ajoutée, ce n'est peut-être ajouter une option dans les paramètres pour activer les polices systèmes, mais ce serait dommage de ne pas les proposer par défaut.

Ce fonctionnement de JavaFX, de cacher les polices, semble être une notion de base du framework, qui pourrait être évité qu'en utilisant une autre bibliothèque pour lire les polices.

Sinon, comme cette tache de mise en cache est asynchrone, ça n'affectera pas les performances de l'application, mais pour les personnes qui ont beaucoup de polices installées, l'ordinateur peut en effet être ralentis. À voir s'il est nécessaire de passer du temps là dessus.

- Clément G.

ysalmon commented 2 years ago

Bonjour, merci pour ces précisions mais ce n'est pas ce que j'observe. Les fichiers temporaires sont créés à chaque fois que je démarre le logiciel.

ClementGre commented 2 years ago

J'ai moi aussi la création de environ 15Mo de fichiers temporaires au démarrage de l'application, mais c'est très loin des 400Mo que j'ai au premier démarrage.

Est ce que vous voyez à chaque démarrage Indexing system fonts... (2498 fonts) dans la console ?

ysalmon commented 2 years ago

Oui, je viens de refaire un test et cette ligne apparait. Si je ferme et que je réouvre tout de suite, ça apparait aussi. Autre truc bizarre (qui n'a sans doute pas de rapport mais je constate à force d'ouvrir le logiciel plein de fois) : le fichier PDF qui est réouvert automatiquement est marqué d'une étoile, comme si on l'avait modifié depuis la dernière sauvegarde. Ce qui ne parait guère possible dès l'ouverture du logiciel.

ClementGre commented 2 years ago

Il s'agit alors d'un problème de PDF4Teachers qui ré-indexe les polices alors que ce n'est pas nécessaire.

Cela est fait que si le nombre de polices détectés, affiché dans la console ici :

Indexing system fonts... (2498 fonts)

est différent du nombre de polices détectés lors du dernier démarrage.

Vous pouvez vérifier que ces deux nombres correspondent en vérifiant dans le fichier sysfonts_cache.yml, ligne 1, vous devriez avoir :

systemFontsCount: 2498 (disponible dans Outils > Débogue > Ouvrir le dossier de données)

Au vus des logs que vous avez publié dans votre premier message, je peut dire qu'il y a un problème lors de la lecture du fichier cache des polices. Ce serait parfait si vous pouviez me l'envoyer pour que j'essaye de voir la raison précise (sysfonts_cache.yml).

le fichier PDF qui est rouvert automatiquement est marqué d'une étoile, comme si on l'avait modifié depuis la dernière sauvegarde. Ce qui ne parait guère possible dès l'ouverture du logiciel.

C'est un bug assez courant sur PDF4Teachers, souvent lié au système de notation chiffrée. Est ce que cela vous arrive sur tous les documents, même ceux sans édition ? Autrement, vous pouvez m'envoyer le fichier d'édition en question pour voir si j'arrive à reproduire le bug. (Outils > Exporter/Importer des éditions/barèmes > Exporter l'édition)

ysalmon commented 2 years ago

Oui, c'est la même valeur. Le fichier yaml se lit bien avec python, sans erreur de forme. sysfonts_cache.zip

ClementGre commented 2 years ago

J'ai réussi à reproduire le problème. Dans sysfonts_cache.yml ligne 2933, on a !!binary "Ln8=":, une donnée binaire alors que ça devrait être un String. Je ne vois pas comment cela a pu arriver, mais la lecture du fichier n'échouera plus à la rencontre de ce type de valeurs dans le futur.

En attendant la prochaine version, vous pouvez supprimer la ligne 2933, ainsi que la 2934 et 2935 qui vont avec (ou juste rennomer le !!binary "Ln8=": en une chaine de caractères classiques).

ysalmon commented 2 years ago

Le phénomène se produit toujours avec le master lancé avec gradlew run (ce qui ne me permet pas de voir la sortie console), y compris après avoir effacé le précédent sysfonts_cache.yml. Remplacer le !!binary par une chaine normale n'aide pas non plus.

ClementGre commented 2 years ago

Normalement avec gradlew run vous devriez avoir la console, sinon, passez cette variable à true : https://github.com/ClementGre/PDF4Teachers/blob/master/src/main/java/fr/clementgre/pdf4teachers/Main.java#L57 pour activer la console dans l'application.

Comme ça vous pourriez me dire si

systemFontsCount: xxxx

dans sysfont_cache.yml correspond bien à ce qui est dit dans la console :

Indexing system fonts... (xxxx fonts)

ysalmon commented 2 years ago

En changeant la variable, je vois apparaitre dans l'app un menu pour afficher une console. Celle-ci ne contient que

Starting PDF4Teachers... (Java 17.0.2)
Executing with toOpenPath = []
Instance locked: true

ce qui est déjà affiché dans ma console système par gradlew.

ClementGre commented 2 years ago

Je n'arrive pas à retrouver le dossier contenant ces fichiers temporaires. Pouvez-vous préciser dans quel dossier vous voyez apparaître ces fichiers ?

ysalmon commented 2 years ago

C'est /tmp.

ClementGre commented 2 years ago

D'accord merci, Après l'indexation de 400 polices sous KUbuntu, j'ai 144Mo de fichiers temporaires générés. Sans indexation, je n'ai que 15Mo de fichiers temporaires.

Je pense que ces 15Mo sont nécessaires au fonctionnement de PDF4Teachers, étrangement, je ne charge que 4-5 polices pour l'interface de PDF4Teachers, mais JavaFX doit décider d'en cacher plus pour une raison qui m’échappe.

C'est donc uniquement au moment de l'indexation (qui ne se produit plus inutilement de votre côté), qu'autant de fichiers temporaires sont générés. Vous pouvez vérifier de vôtre côté, mais il n'y a plus de réel problème.

ysalmon commented 2 years ago

Effectivement, il y en a moins qu'avant. J'ai 130 fichiers, pour 30Mo.

ClementGre commented 2 years ago

C'est étrange, ça semble dépendre du nombre de polices sur l'ordinateur, je pense que JavaFX doit se faire un petit cache pour éventuellement utiliser ces polices par la suite.