Windows 8.1 brings alots of new API’s and support for Windows store developers and one of them which I would like to highlight today is the support of Multicolor font chars in windows 8.1

In a //Build session “Innovations in High Performance 2D Graphics with Direct X”, the speaker revealed that two new tables have been defined in the OpenType font specification that allow multi-color glyph rendering. The reason for this enhancement was primarily for rendering multicolor emoji.

The new Segoe UI Emoji font in Windows 8.1 supports these multicolor characters.

Lets write  a very basic application to demo this new capability.

  • Open your Visual Studio 2013 Preview and create a new Blank Windows Store app.
  • In your mainpage, add the following Xaml code
  • <ScrollViewer>
    <ItemsControl Name="multiColorList"
    VerticalAlignment="Center">
    <ItemsControl.ItemTemplate>
    <DataTemplate>
    <TextBlock Text="{Binding}" FontFamily="Segoe UI Emoji"
    FontSize="50" Margin="12" />
    </DataTemplate>
    </ItemsControl.ItemTemplate>
    </ItemsControl>
    </ScrollViewer>

  • Now paste the (see below) code on your onNavigatedTo event handler in your code-behind file
  • for (int code = 0x1F600; code < 0x1F700; code++)
       {
         multiColorList.Items.Add(Char.ConvertFromUtf32(code));
       }

  • Now hit F5 to run the project and you’ll see something like this.


    image

 

Happy Coding - Cheers