Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
htmlpath := A_scriptdir . "\Htmlfile.html"
gui Window:default
gui, add, edit, h0 w0
gui, font, s10
gui +Border +lastfound
menuwidth := A_screenwidth / 3
menuheight := A_screenheight / 2
Gui, Add, ActiveX, x0 y0 w%menuwidth% h%menuheight% vmenu, Shell.Browser
menu.navigate(htmlpath)
gui, show
return
F11::
Reload
return
Code: Select all
<!DOCTYPE html>
<html>
<head>
<title>a</title>
<meta charset='UTF-8'>
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
<meta http-equiv='X-UA-Compatible' content='ie=edge'>
<style type=text/css>
html {
overflow:hidden;
height:100%;
}
body {
background:#888888;
width:100%;
height: 100%;
}
@font-face {
font-family:'Myfont';
src:url('opensans-bold.woff') format('woff');
}
.custom{
font-family:'Myfont';
}
</style>
</head>
<body>
<p class='custom'>Aa</p>
</body>
</html>
However the font does NOT work when navigating to the html page using the script
Any clues on how to solve this. I already have this problem with no solution already for over a week.
One more thing. It seems like showing the font on the ahk script does work for some time until I start doing various things on my computer. For example. Saving an image anywhere in paint.net breaks all ahk script that navigate to a html file with a font until I restart my pc.
Also here's a download link to the file where I got a script, font and html file so you could test for yourself. Link