Un peu de ménage dans le git

This commit is contained in:
2024-12-02 20:51:28 +01:00
parent 0e6450f8c8
commit 9b2a314262
102 changed files with 49818 additions and 27 deletions

View File

@@ -0,0 +1,33 @@
package fr.monkhanny.dorfromantik.utils;
import fr.monkhanny.dorfromantik.enums.Fonts;
import java.awt.*;
import java.io.File;
import java.io.IOException;
/**
* Classe utilitaire pour charger des polices à partir de fichiers.
* @version 1.0
* @author Moncef STITI
* @see Fonts
* @see Font
*/
public class FontLoader {
/**
* Charge une police à partir du fichier spécifié.
* @param fontEnumName Enumération de la police à charger.
* @return La police chargée.
* @throws IOException Si une erreur se produit lors de la lecture du fichier.
* @throws FontFormatException Si une erreur se produit lors de la création de la police.
*/
public static Font loadFont(Fonts fontEnumName) throws IOException, FontFormatException {
String fontFilePath = fontEnumName.getFontPath();
File fontFile = new File(fontFilePath);
Font customFont = Font.createFont(Font.TRUETYPE_FONT, fontFile);
GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
ge.registerFont(customFont);
return customFont;
}
}