#include-once ; #INDEX# ======================================================================================================================= ; Titre .........: Font ; AutoIt Version : 3.1.1++ ; Language ......: Français ; Description ...: Permet de charger et décharger une police de caractère sans l'installer ; Author(s) .....: Mano78170 ; Dll(s) ........: gdi32.dll ; =============================================================================================================================== ; #CURRENT# ===================================================================================================================== ;_LoadFont ;_UnloadFont ; =============================================================================================================================== ; #FONCTION# ==================================================================================================================== ; Nom...........: _LoadFont ; Description ...: Charge un fichier de police en mémoire ; Syntaxe.........: _LoadFont($FontFile) ; Parameters ....: $FontFile - Path du fichier de police ; Valeur de retour .: - Si la fonction échoue: 0 ; - Si elle réussit: 1 ; Auteur ........: Mano78170 ; Remarques .......: Prend en charge les fichiers .fon,.fnt,.ttf,.ttc,.fot,.ocf,.mmm,.pfb,.pfm ; Related .......: _UnloadFont ; Lien ..........: http://msdn.microsoft.com/en-us/library/dd183326%28v=vs.85%29.aspx ; Exemple .......: Non ; =============================================================================================================================== Func _LoadFont($FontFile) $Struct = DllStructCreate("char[" & StringLen($FontFile) + 1 & "]") DllStructSetData($Struct, 1, $FontFile) $DllMsg = DllCall("gdi32.dll", "int", "AddFontResource", "ptr", DllStructGetPtr($Struct)) Return $DllMsg[0] EndFunc ;==>_LoadFont ; #FONCTION# ==================================================================================================================== ; Nom...........: _UnloadFont ; Description ...: Décharge un fichier de police en mémoire ; Syntaxe.........: _UnloadFont($FontFile) ; Parameters ....: $FontFile - Path du fichier de police ; Valeur de retour .: - Si la fonction échoue: False ; - Si elle réussit: True ; Auteur ........: Mano78170 ; Remarques .......: Prend en charge les fichiers .fon,.fnt,.ttf,.ttc,.fot,.ocf,.mmm,.pfb,.pfm ; Related .......: _LoadFont ; Lien ..........:http://msdn.microsoft.com/en-us/library/dd162922%28v=vs.85%29.aspx ; Exemple .......: Non ; =============================================================================================================================== Func _UnloadFont($FontFile) $Struct = DllStructCreate("char[" & StringLen($FontFile) + 1 & "]") DllStructSetData($Struct, 1, $FontFile) $DllMsg = DllCall("gdi32.dll", "BOOL", "RemoveFontResource", "ptr", DllStructGetPtr($Struct)) Return $DllMsg[0] EndFunc ;==>_UnloadFont