microsoft / xaml-standard

XAML Standard : a set of principles that drive XAML dialect alignment
Other
807 stars 54 forks source link

Support for Color Fonts #200

Open birbilis opened 7 years ago

birbilis commented 7 years ago

Quoting from https://blogs.windows.com/buildingapps/2017/06/06/using-color-fonts-beautiful-text-icons

The XAML platform’s text elements (like TextBlock, TextBox, RichEditBox, and FontIcon) support color fonts by default. Simply style your text with a color font, and the styled text will be rendered in color. The following code example shows how to style a TextBlock with a color font that has been packaged with your app assets. (The same technique applies to regular fonts.)

<TextBlock FontFamily="Assets/MyColorFont.otf#MyFontFamilyName">Here is some text.</TextBlock>

The FontFamily property points to the relative location of a font file that has been added to the app package. Since a single font file may include multiple font families, you also need to specify the desired font family using the hash syntax illustrated above.

If you never want your XAML text element to render multicolor text, set its IsColorFontEnabled property to false. For example, you may choose to have your app render monochromatic text when accessibility features are enabled.

links to more info are at the above URL

michael-hawker commented 6 years ago

@birbilis If you explicitly specify a Foreground color would that override the color font completely? Or just for non-colored symbols? Or would you need to turn the IsColorFontEnabled off to recolor the monochrome versions of the color symbols?