Q:

Winform webbrowser custom fonts not showing

I'm using the C# WebBrowser control (Winforms) and am passing markup into it via the .DocumentText property.
The document links to some css that uses the @font-face rule, which works when running locally (and from a server), but not when being consumed by the webbrowser control.
The css is pretty basic, it looks like this:
@font-face {
    font-family: FontName;
    src: url("/fonts/fontname.ttf") format("truetype");
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

I've tried the various Registry suggestions from over here (to no avail): https://weblog.west-wind.com/posts/2011/May/21/Web-Browser-Control-Specifying-the-IE-Version#FeatureDelegationviaRegistryHacks
Another common suggestion is to include a meta tag in the mark-up (which I have done) like this:
<meta http-equiv="X-UA-Compatible" content="IE=edge">

My font is already marked as installable (and works fine in IE), so there is obviously something specific about the webbrowser control that's the problem - but having spent hours trying to figure out, I'm at a loss as to what that could be.
Does anyone know what I'm missing here?
Thanks!

A:

It turns out that there were two problems here. I finally managed to work my way around them, so I'll share the problems and their solutions here in the hope I can save someone else some time in future.
Issue #1
The browser control was presenting security warnings (which were being suppressed because .ScriptErrorsSuppressed was set to false). After looking into how to automatically suppress the security errors, I came across Sheng Jiang's excellent blog entry on the subject here - https://jiangsheng.net/2013/07/17/howto-ignoring-web-browser-certificate-errors-in-webbrowser-host/
Issue #2
After getting frustrated, I looked into a couple of commercial alternatives and the one from Essential Objects looked promising (https://www.essentialobjects.com) - although this still wasn't rendering my page (although their sample app did).
After digging into their WebView control a bit, I hooked all of the javascript console events it exposed and I got a useful error message out when accessing my page:
Access to Font at 'https://localhost:1234/fonts/foo.ttf' from origin 'https://localhost:1234' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access.
Finally, something to work with! I temporarily allowed any origin on my server and the page started rendering properly (Note - You really don't want to do this on a production server - this was just to test).
This also worked for the Winforms control (albeit sub-classed with Sheng Jiang's interop to solve the first issue) so the solution here was just to configure the CORS policy properly for my font assets.

