MDL2信息符号 [英] MDL2 Info Symbol

查看:153
本文介绍了MDL2信息符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Microsoft出于参考目的使用特定符号,它是一个带字母i的圆圈,其中符号.我查看了有关Segoe MDL2 Assets字体的所有资源,但没有找到该符号.有人知道这个符号是字体的一部分还是仅仅是另一幅图像?

Microsoft uses a specific symbol for informationial purposes it is a circle with the letter i inside Image of the Symbol. I looked at every resource about the Segoe MDL2 Assets Font but did not find that symbol. Does anyone know if this symbol is part of the font or is it just another image?

推荐答案

符号代码点为E946.

以下WPF代码段创建了一个IEnumerable<int>,其中包含Segoe MDL2 Assets中的所有符号代码点.

The following WPF code snippet creates an IEnumerable<int> that contains all symbol code points in Segoe MDL2 Assets.

var typeface = new Typeface(
    new FontFamily("Segoe MDL2 Assets"),
    FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

GlyphTypeface glyphTypeface;
typeface.TryGetGlyphTypeface(out glyphTypeface);

var codePoints = glyphTypeface.CharacterToGlyphMap.Keys.Where(c => c > 0x20);

您可以通过设置DataContext = codePoints并编写如下的ItemsControl来轻松可视化此集合:

You can easily visualize this collection by setting DataContext = codePoints and writing an ItemsControls like this:

<ItemsControl ItemsSource="{Binding}">
    <ItemsControl.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock
                    Margin="2" VerticalAlignment="Center"
                    Text="{Binding StringFormat={}{0:X4}}"/>
                <TextBlock
                    Margin="2" FontFamily="Segoe MDL2 Assets" FontSize="24"
                    Text="{Binding Converter={StaticResource CodePointConverter}}"/>
            </StackPanel>
        </DataTemplate>
    </ItemsControl.ItemTemplate>
</ItemsControl>

使用此CodePointConverter类:

with this CodePointConverter class:

public class CodePointConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
    {
        return new string((char)(int)value, 1);
    }

    public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
    {
        throw new NotSupportedException();
    }
}

这篇关于MDL2信息符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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