To preface, I am required to use:
* ClickOnce deployment
* A barcode font
* A DevExpress control that uses “FontName” with no access to the Font object, preventing me from using PrivateFontCollection.
* The fonts must install silently and work immediately after install.
The portion of DevExpress keeping me from using PFC is the CharacterProperties object in the RichEditControl. Their support site already has a ticket that ends in “sorry, we can’t make it work with PrivateFontCollection”.
I’ve read from numerous sources and keep finding that ClickOnce cannot use a font right away when it installs it. I’m using P/Invoke to install the fonts since PFC is unavailable to me. I created a completely separate console app that does this font install, and the font shows up in Word, but it does not show up in my ClickOnce application even though I opened it after Word. I can install the font manually through the normal Windows click methods and it shows up in both Word and ClickOnce.
I verified with System.Drawing.Font that it is unavailable to the entire application, not just a picky vendor control:
Font fontTester = new Font(fontName, 12, FontStyle.Regular, GraphicsUnit.Pixel);
if (fontTester.Name == fontName)
The “Name” value changes to “Microsoft Sans-Serif”, acting as though the font is unavailable.
How do I get the font to show up in ClickOnce without a reboot/logoff?
The P/Invoke method in the console app isn’t working and I haven’t the time to figure out why, but using VBScript with Shell.Application does.
I had actually started with this, but for whatever reason it didn’t work, so I moved onto other methods, including the console app.