Search code examples
wpflocalizationfontssatellite-assembly

How do I reference a font resource in a satellite assembly?


I have a localised WPF application and I need to embed a font for each locale. I have a font added into my project and it's Build Action is set to Resource. If I remove the <UICulture>en-US</UICulture> from my .csproj (which eliminates the creation of the satellite assemblies) the font is compiled as a resource into the project assembly. I can then add the font by:

<Button Content="My Button" FontFamily="Fonts/#Frutiger LT 87 ExtraBlackCn" />

This works perfectly. If I add en-US back into my .csproj the font gets added to the localised satelite assembly. But

<Button x:Uid="Button1" Content="My Button" FontFamily="Fonts/#Frutiger LT 87 ExtraBlackCn" />

no longer works.

How should I be referencing the localised font?


Solution

  • While this does not directly answer your question, the MSDN page on WPF Globalization and Localization Overview seems to recommends that you:

    Create a customized composite font to obtain better control of fonts that are used for different languages.

    The idea is that you use a single, "composite", font for that contains the fonts for all languages that you might want to use. For more information on Composite Fonts (including examples), see the FontFamily Documentation on MSDN.