On Windows, I'm having a lot of trouble getting a web gadget to load a font resource. This is more a problem with Internet Explorer than PureBasic itself, however PB is inheriting this problem by design.
All of the non-local css examples are confirmed to work with Chrome but do not work with Internet Explorer. How can I reference a font resource in a web gadget which is not available on the system?
When running the embedded web gadget of Windows 7, the web control is derived from IE 8. Font formats .ttf and .otf are unsupported. As of IE9, .woff is supported, but even after installing IE9 or higher, the embedded control still uses the old renderer; at least PureBasic does.
However, IE8 and earlier support Embedded OpenType (.eot) and this DOES work when loaded from disk! This is described on MSDN for the "@font-face rule":
This feature enables you to use specific fonts that might not be available on your local system. In Internet Explorer 8 and earlier, the URL must point to an Embedded OpenType (EOT) file (.eot or .ote format). No other font formats are supported.
Well, given that EOT has already been superseded by WOFF, and that EOT is limited to IE, it's probably easier to distribute the ttf, given that installation of a font is trivial anyway.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Just register the TTF file on program startup as a font (AddFontResourceEx_()).
I didn't test it, but I think it should work.
-> To refer to it, it should be enough to just write the name.
Do note that the name might differ from the filename, this might be why your attempt didn't work.
Shield wrote:Just register the TTF file on program startup as a font (AddFontResourceEx_()).
I didn't test it, but I think it should work.
I mentioned this in my post. I used AddFontMemResourceEx_() which is the same thing. I can confirm that the font loads by using it in an editor gadget but it does NOT work with the web gadget. I thought the same thing. It SHOULD work! But it does not.
IdeasVacuum wrote:Well, given that EOT has already been superseded by WOFF, and that EOT is limited to IE, it's probably easier to distribute the ttf, given that installation of a font is trivial anyway.
You might think so but then the application is not guaranteed to run as expected if the user does not have permission to install system-wide fonts. This is what AddFontResourceEx and AddFontMemResourceEx are for. Unfortunately, they do not appear to work with an IE ActiveX control.