Rank: Advanced Member
Groups: Guest
Joined: 6/9/2016(UTC) Posts: 34
Thanks: 22 times
|
In the software product we are about to launch, for text zones you can select a font. So far we've been displaying the fonts using FontRegistry.Installed.Families and when we create the Font objects we use the family name and then generate the style name using bold/italic etc. properties we have. This has been working ok. In some cases when we use the formatted text <span> etc. I'm getting a font missing exception when using certain fonts and i think it is due to the font name in the formatted text requiring the postscript name where as we are putting the family name in there. My question is what approach is best for handling fonts? Assuming that formatted text requires postscript names, should we only be dealing with postscript names and ignore family names? If so, how does the bold/italic properties and style names fit into this? Thanks
|
|
|
|
Rank: Advanced Member
Groups: Guest
Joined: 9/19/2006(UTC) Posts: 505
Was thanked: 41 time(s) in 41 post(s)
|
Hello Chris, Sorry for the late answer. Each font has a postscript name as well as a pair of family & style properties. Postscript name uniquely identifies the font with one string and can be used as ID. A bundle of family and style also identifies the font, and they have a more readable form for a human. Bold/italic properties are called "FauxBold" and "FauxItalic", they are responsible for emulating missing styles. For example, if you have some well-known font like "Arial Bold", it means that boldness was applied manually by the font designer. And it looks good. Sometimes there is no bold style shipped, but you can emulate the same effect with the FauxBold property. It also looks good, but not as good as a manually designed font. The same thing applies to FauxItalic. Inside a formatted text, you can achieve the same effects as well. Code:style = 'bold:true; italic:true'
In general, generating a postscript name is a bad idea. Sometimes "postscriptName" is not equal to "Family-Style". Here is as a sample how you can get font information from FontRegistry: Code:foreach (var fontInfo in FontRegistry.Installed.Fonts)
{
Console.WriteLine(string.Format("Postscript: {0}, Family: {1}, Style: {2}",
fontInfo.PostscriptName,
fontInfo.Family,
fontInfo.Style));
}
Then you need to use family&style bundle for GUI elements and postscript name for making a rich text. |
Best regards, Eugene Kosmin The Aurigma Development Team
|
1 user thanked Eugene Kosmin for this useful post.
|
|
|
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.