如何在wpf中为字体空间设置字体大小 [英] howw to set a Font size for typespace in wpf

查看:354
本文介绍了如何在wpf中为字体空间设置字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我需要在WPF中创建一个通用字体类.我需要设置fontstyle,size,family等.
所以我发现Typespace很适合它,但是没有设置字体大小的选项(比如说我需要将字体大小设置为20).
我该如何设置.

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.

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);


}


}

推荐答案

在印刷术中,字体是一组字符的视觉表示或解释.是他们的外观.

字体和字体的大小传统上以磅为单位来衡量,我们不能说像素的总大小以像素为单位.

请检查此字体的WPF定义 [
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[^]


这篇关于如何在wpf中为字体空间设置字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆