WPF does not render Windows OpenType font name -


i cannot figure out how determine how render specific opentype font correctly in wpf (.net 4.5 / vs2012 / windows 8). have font installed on computer called "dinpro-blackitalic".

the file name is: dinpro-blackitalic.otf

windows reports font name is: dinpro-blackitalic

windows font preview dinpro-blackitalic

in wpf, simple, this:

<textblock text="this sample sentence in dinpro-blackitalic"                fontfamily="dinpro-blackitalic" fontsize="24" /> 

or fontfamily="#dinpro-blackitalic"

this doesn't work (clearly not italic) , falls default font. i've tried lots of other variations work other fonts in font directory.

for example, comic sans works: fontfamily="comic sans ms" (awesome...)

now, why confused: if guess @ different way punctuate font name, renders correctly!

this works: fontfamily="din pro black italic"

in summary, here screen shot of different fontfamily settings in wpf: several fontfamily settings in wpf

two questions:

1) how supposed guess @ right way tell wpf render font? must have canonical name registered somewhere isn't visible in filename, file properties, or font name windows reports after has parsed file.

2) what's worse if i'm attempting render same font in desktop application , on web, browsers chrome on windows and ie expect "dinpro-blackitalic" , not render spaced out version of name. seems wpf , windows browsers make mutually exclusive decisions font name use index fonts. how work around arbitrary fonts?

dinpro font rendering in chrome , ie

you can pack font application, , can refer project directory. if place font inside fonts directory in project.

you can add follows,

<textblock fontfamily=”/fonts/dinpro-blackitalic.otf#dinpro-blackitalic”/> 

so can sure the, font gets deployed application.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -