Click here to Skip to main content
15,924,507 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
i need create a Generic Font class in WPF.i need to set fontstyle,size,family etc..
so i found the Typespace is good for it but there is no option to set font size(say i need to set size as 20)
how can i set it.

C#
internal class FontGeneric {
    internal static Typeface Header = new Typeface(new FontFamily("GenericSansSerif"),FontStyles.Normal,FontWeights.Bold,
                                                   FontStretches.Normal);

    internal static Typeface Section = new Typeface(new FontFamily("GenericSansSerif"),FontStyles.Normal,
                                                    FontWeights.Bold,FontStretches.Normal);

    internal static Typeface Body = new Typeface(new FontFamily("GenericSansSerif"),FontStyles.Normal,FontWeights.Normal,
                                                 FontStretches.Normal);

}
Posted

1 solution

In typography, a typeface is the visual representation or interpretation of a set of characters; it is their appearance.

The size of typefaces and fonts is traditionally measured in points and we cannot say size of points in pixels at general scale.

Please check this for WPF defination of Typeface[^]
 
Share this answer
 

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