Multicolor font characters in Windows 8.1

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. 

 

Happy Coding – Cheers

Advertisements

About Muhammad Umer

I love to work on emerging technologies, i am currently associated with Microsoft as Technology Consultant.

Posted on July 20, 2013, in Uncategorized. Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: