Click here to Skip to main content
15,893,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Description

Currently i'm working on a project that requires to have certain assets to be exchangeable, i.e. can be replaced by the user. For convenience everything is collected in different ResourceDictionaries and merged within ApplicationResources.

This works fine, except for FontFamilies that aren't referenced via an URI, i.e.
XML
<Object UriSource="pack://siteoforigin:,,,/Path/To/Asset.ext" />


Already Tested
Working:
XML
<FontFamily x:Key="fontMain">X:\Path\To\Asset\FontFile.ttf#FontName</FontFamily>

Not working:
XML
<FontFamily x:Key="fontMain">./Assets/Fonts/FontFile.ttf#FontName</FontFamily>
<FontFamily x:Key="fontMain">./Assets/Fonts/#FontName</FontFamily>
<FontFamily x:Key="fontMain">/Assets/Fonts/FontFile.ttf#FontName</FontFamily>
<FontFamily x:Key="fontMain">/Assets/Fonts/#FontName</FontFamily>
<FontFamily x:Key="fontMain">/AssemblyName;component/Assets/Fonts/FontFile.ttf#FontName</FontFamily>
<FontFamily x:Key="fontMain">/AssemblyName;component/Assets/Fonts/#FontName</FontFamily>


Question
This part should be obvious, but i write it anyway.
What do i have to do, to make it work? Don't want to add them via code, they are needed for the GUI design. Otherwise this won't be an issue, right?

Bonus
This "Question" is also up on StackOverflow[^], so you can grab some Reputation there as well.
Posted
Updated 22-Feb-15 14:14pm
v2
Comments
Kuthuparakkal 22-Feb-15 20:35pm    
Take a look here : http://blogs.msdn.com/b/text/archive/2006/07/10/font-families-and-friendly-names.aspx
Daniel Lieberwirth (BrainInBlack) 22-Feb-15 20:42pm    
Already read this article, it doesn't solve this problem.
Kuthuparakkal 22-Feb-15 20:48pm    
Create variable and determine local path, then use this variable to build exact path and apply!
Daniel Lieberwirth (BrainInBlack) 22-Feb-15 20:54pm    
"[...]Don't want to add them via code, they are needed for the GUI design[...]"

That's exactly what i try to avoid...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900