Custom font in WPF application only works in design mode but not in the build -
recently have problem when using custom font in wpf application. added custom font in project using methods described in packaging fonts applications. works fine in design mode when run application, doesn't work , seems use default font instead. find reason:
i downloaded free font internet, , used same way refer it. worked in both situations.
i created new wpf project, , added custom font in new project. unexpectedly worked. compared new project , problem project, difference use .net 3.5 in old project, , .net 4.0 in new project. after changed old project use .net 4.0, problem resolved. however, .net 4.0 not allowed in old project, want find solution based on .net 3.5.
by way. tried build font file both content , resource. also, tried use absolute , relevant path. didn't work.
looking forward help. much.
regards, yupeng
i have found font family name includes medium/light or other font key words have problem described above. when used code load font files, loaded font family names different shown in font files. assuming key words in font name removed automatically when loading.
to solve problem, recoded names(loaded code) , used them refer custom font family. works in build work in design mode now. comment/uncomment helpful switch.
i think easiest way should change font family name removing key words, don't have permission , didn't try it.
Comments
Post a Comment