If you are doing software packaging, chances are that you also had the task to just install a special font that your company or customer needs.
In this blog I will show you how this can be done with an MSIX, created with Microsoft’s free MSIX Packaging Tool.
But bevor we start a great thank you to Alex Marin. His blog post helped me to get started and find the solution I will describe for you here.
Creating the font package
|So, firs you need a font file. In this example where going to use the font “28 Days Later.ttf” If you like the movie I’m legend with Will Smith or the walking dead and you don’t know this movie then you should definitely check it out later.|
|Just start the MSIX Packaging Tool on your packaging VM and select Application Package|
|If you are running the tool inside a VM just leave the default value.If your environment is different select the option that fits it.
Click on Next
|Let the Tool prepare your VM and hit Next.|
|Fill out the options about signing. But do not select an installer unless your font come’s with one.Hit Next|
|Fill out the information about the package and klick on Next|
|Once that screen shows up, hold your horses, and don’t click Next.Now is the time to install your font.|
|To install the font simply do a right click on it and select “install for all users”.After that, a progress bar will quickly appear.
Once it is gone the font is installed.
|Now it is time to click on Next|
|Since our package doesn’t really contain an app there are no entry points shown it that list.
For our font package this absolutely correct, and you can again click on Next.
|Click on Yes, move on|
|Since there are also no services there’s nothing to do here either besides clicking on Next.|
|If we would leave it like that, our package would install fine, but the font would not be available and visible to other apps on our system.
Therefor we need wo do some manifest tweaking.
To do that when start the Package editor.
|If you want to check if the font is inside the package, select Package Files on the left and then navigate your way to Package\VFS\Fonts.Here you should now see your font.
But here we need to do nothing.
So, we switch back to the Package information Tab on the left.
|On the Package information tab, we scroll down all the way until you see the Open file button.Click on the Open file button.|
|So now comes the tricky part, you need to copy the following text into the manifest.Right to where the red line is.
But don’t forget to adjust
%YourFontName% to the real FileName of the font
At the end of the blog I will explain in detail what we added here.
<Applications> <Application Id="Font" StartPage="https://www.wpninjas.ch"> <uap:VisualElements BackgroundColor="transparent" Description="Font" DisplayName="Font" Square150x150Logo="Assets\StoreLogo.png" Square44x44Logo="Assets\StoreLogo.png" AppListEntry="none" /> <Extensions> <uap4:Extension Category="windows.sharedFonts"> <uap4:SharedFonts> <uap4:Font File="VFS\Fonts\%YourFontName%"/> </uap4:SharedFonts> </uap4:Extension> </Extensions> </Application> </Applications>
Install and test the font package
|The Test your package simply install it on a test machine.But did you notice when you double click the file to install it. The little check box on the left lower corner is missing. There it usually says Launch when ready.
I will explain why this is missing a bit later.
For now, just click Install
|Now click on Close|
|If you now open an app that shows fonts like Wordpad does, you will see your font and you can select it.|
|Now you can use your font.|
||But be aware that when you browse to the C:\Windows\Fonts folder you will not see it.
That’s because it is not installed there since it is living inside the MSIX Container.
So, let us have a look at what we added to that manifest in detail.
1. Since our Package does not contain any shortcuts or exe files, there was no <Applications> section and we had to add it and also the actual <Application> section.
2. So every Application needs an Id and we give it the name Font. But that could be any name you like.
3. Every App needs either an Executable Entry to an exe that needs to be inside the package or a StartPage Entry. Since we do not have an exe we can use the StartPage Entry and give it any website URL you like. More info about that can be found here.
4. The VisualElemtents Entry is also Mandatory for an Application and therefor all those other entries in that line are also mandatory.
As a Logo we can us the Assets\StoreLogo.png file that the MSIX Packaging Tool added to the package.
Only exception that is not mandatory is the AppListEntry=”none” but if you don’t us this, you would get a useless entry in your start menu that says Font. That Entry is also the reason why you could not see the usual Launch when ready check box. More Info about that is here.
5. So now comes the really important part. Since we want to make out font visible outside of the Package and make it usable by other Apps on the System, we need this Extension of the Category “windows.sharedFonts”
6. For our sharedFonts we then need to specify the path to the font file inside the VFS of the Package.
If you’ve been reading until here, I really thank you and I hope you learned a new skill.
Again, great thank you to Alex Marin for his blog post about MSIX and Fonts. That opened the door for me to find out how to do this.
You can find his blog about this topic and a lot of other great articles on the website site of the Advanced Installer Team.
- Installing a font with MSIX so that other apps on your system can see it - July 17, 2020
- MSIX Commander 10.7.5 released with contributions by Tim Mangan and now available as AppInstaller with AutoUpdate - April 25, 2020
- Disable Automatic Updates of Windows Store Apps on your packaging machine - April 13, 2020