rootx Posted March 6, 2017 Posted March 6, 2017 (edited) I try to resolve my question with _WinAPI_AddFontResourceEx(@ScriptDir & "\font\myfont.ttf", $FR_PRIVATE, False) unsuccessful.. THX Edited March 7, 2017 by rootx
genius257 Posted March 6, 2017 Posted March 6, 2017 Hi @rootx Does _WinAPI_AddFontResourceEx return 0? If not, you need to set the font(s) for a control or the likes. (See the example in the function reference). To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
rootx Posted March 6, 2017 Author Posted March 6, 2017 now it works, I used a hidden label to force to load him.
rootx Posted March 7, 2017 Author Posted March 7, 2017 With this fonts doen't work! Why? I try on Windows 10 64bit. Thx #include <APIGdiConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> _WinAPI_AddFontResourceEx(@ScriptDir&"\font\Android.ttf", $FR_PRIVATE,False) GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 100) GUICtrlCreateLabel('Simple Text', 10, 25, 380, 50, $SS_CENTER) GUICtrlSetFont(-1, 38, -1, -1, 'Android') GUICtrlSetColor(-1, 0xF06000) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE http://www.dafont.com/it/android.font
genius257 Posted March 7, 2017 Posted March 7, 2017 I assume you double checked the path you specified is correct? You should try and add a check to see if the font is loaded or not. Like so: #include <APIGdiConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> $iSuccess = _WinAPI_AddFontResourceEx(@ScriptDir&"\font\Android.ttf", $FR_PRIVATE,False) If $iSuccess=0 Then Exit MsgBox(0, "", "Font did not load successfully") GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 400, 100) GUICtrlCreateLabel('Simple Text', 10, 25, 380, 50, $SS_CENTER) GUICtrlSetFont(-1, 38, -1, -1, 'Android') GUICtrlSetColor(-1, 0xF06000) GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE I have no problems with the script, but i am currently testing on my Windows 7 Ultimate 64bit, but if my answer do not help you, i can try it on my win10 machine also. Thanks for the link to the font, helps a lot To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
rootx Posted March 7, 2017 Author Posted March 7, 2017 (edited) ???? The file.... does not appear to be a valid font. WTF??? If I try to open a .ttf file outside the FONTS folder I receive this error. What does the firewall with fonts! https://www.youtube.com/watch?v=pzzIQq1mjDI My Firewall is active, I have Administrative permissions! Edited March 7, 2017 by rootx
genius257 Posted March 7, 2017 Posted March 7, 2017 Seems to be a weird one. I would suggest trying this: Unable to install fonts on Windows 10 It seems some people experience problems with fonts on removable media. Guess it's something that will be fixed at some point... A solution for your application could be to use FileInstall to the @TempDir. I would imagine it would help, but with the firewall strangeness also being a possibility, who knows. To show your appreciation My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now