PETZOLD BOOK BLOG

Charles Petzold on writing books, reading books, and exercising the internal UTM


Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

Multicolor Font Characters in Windows 8.1

June 28, 2013
San Francisco, California

I've been attending the Microsoft Build Conference this week learning about the new features in Windows 8.1. In a session entitled Innovations in High Performance 2D Graphics with Direct X, Dan McLachlan revealed that two new tables have been defined in the OpenType font specification that allow multi-color glyph rendering. The impetus for this enhancement was primarily for rendering multicolor emoji — that collection of often whimsical ideograms that originated in Japan and have become increasingly popular in electronic messaging, and sometimes user interface icons.

Examining these multicolor font characters was the first thing I tried when I installed the Windows 8.1 Preview and Visual Studio 2013 Preview. The new Segoe UI Emoji font in Windows 8.1 supports these multicolor characters, so I wrote some XAML to display characters from this font in a horizontal ItemsControl:

<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
    <ScrollViewer VerticalScrollMode="Disabled"
                  VerticalScrollBarVisibility="Hidden"
                  HorizontalScrollMode="Enabled"
                  HorizontalScrollBarVisibility="Auto">
        <ItemsControl Name="itemsControl"
                      VerticalAlignment="Center">
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding}"
                               FontFamily="Segoe UI Emoji"
                               FontSize="96"
                               Margin="12" />
                </DataTemplate>
            </ItemsControl.ItemTemplate>

            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <StackPanel Orientation="Horizontal" />
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
    </ScrollViewer>
</Grid>

The code-behind file adds strings to the ItemsControl in the Unicode range 0x1F300 through 0x1F6FF (although not all codepoints in this range correspond to glyphs):

public sealed partial class MainPage : Page
{
    public MainPage()
    {
        this.InitializeComponent();

        for (int code = 0x1F300; code < 0x1F600; code++)
            itemsControl.Items.Add(Char.ConvertFromUtf32(code));
    }
}

The ZoomMode of the ScrollViewer is left at it's default value of Enabled so you can use your fingers to stretch out the list of characters, and view them close up. Here's a typical screen shot. Click it to see it in full size:

Rendering multicolor emoji as font characters is obviously preferable to bitmaps because they can be freely scaled, and it's also preferable to vector graphic renditions because the font characters potentially contain hints that allow greater legibility at smaller sizes.

I suspect that multicolor fonts will become increasingly popular for user interface icons and symbols for the same reason. The multiple colors are automatically enabled when using the font through the Windows Runtime. In DirectX, a new flag is involved, and a new method to get access to the glyph layers used in implementing the colors. Check out Dan McLachlan's talk for more details.

Here's the ShowColorCharacters project showing just the Emoji range of the new Segoe UI Emoji font, and a slightly modified version of the SegoeSymbols project from Chapter 8 of my Windows 8 book that lets you view much of the rest of the Segoe UI Emoji font. Some additional characters have color.

The ability to have multicolor font characters doesn't sound like a big deal, but I think it's going to help significantly in creating resolution-independent user interfaces.


Programming Windows, 6th edition


Comments:

Will the sixth edition of your e-book be upgradeable to the six point oneth edition?

— Maybe for point one dollar?, Sat, 6 Jul 2013 01:58:08 -0400

If all you're willing to pay is a dime, I don't see how it can be possible. — Charles

Those were two separate questions. I almost wanted to ask if the price would be the same as an upgrade from Windows 8 to 8.1, but branched onto another point instead.

— ok, I rect that point, Mon, 8 Jul 2013 03:52:15 -0400

It is the publisher — not the author — who decides if a book should be updated or revised, and so far Microsoft Press / O'Reilly has not requested that I begin revising Programming Windows for Windows 8.1. Considering the weak sales of the 6th edition of Programming Windows, it seems unlikely.

Look at the feedback (or rather, lack of feedback) I get on my blog entries about Windows 8 programming. Do you really think there's an audience out there who wants to read a whole book on the subject? — Charles

Windows 8 for PCs is a pretty weak market. If Windows 8.1 fixes enough problems, maybe it will attract more users, and then maybe it will attract more developers again.

— chicken and egg, Tue, 9 Jul 2013 01:18:54 -0400

Charles don't give up: do you know that Russian publisher (Piter "�Yи�,е�?") will present your last book this fall (in early September)?

I will quote (Russian)

>�s�?оме �^�f�,ок. Э�,а книга �Yе�,�?ол�Oда в�<йде�, �f нас в на�?але осени :-)

http://habrahabr.ru/company/piter/blog/182398/#comment_6335670

This non official site of publisher but that official blog at thematic media resource present by one of delegate from the publisher.

(Your books publish by Piter http://www.piter.com/e-shop/author/163491/A25576/ )

Yea in middle of 90x your Russian version will more popular than original in Russian language countries, but some think suggests me, that publisher did not pay in something that he can not be sold. I don't no how sell of translated version represent on your royalty, but in beginners community (where no free to read in English) it may be more popular.

About auditory and response: do you have account on some off the Microsoft communities?

For example on http://stackoverflow.com/ ?

It seems to me that people more free speak on outside off vendor of platform site, I think.

Even Microsoft Russian publish (that not free for corporation on that resource (also Piter pay for publish on that)) on that thematic media they articles.

Thanks for all, who read to end of this message.

— Guest, Mon, 22 Jul 2013 17:46:52 -0400

Royalties are not paid on books translated into other languages. The foreign-language publisher pays the original publisher a flat fee (which the publisher splits 50/50 with the author) for translation rights. — Charles

If you are interested in making your own color fonts, then take a look at this video that shows how to do this with FontCreator:

http://m.youtube.com/watch?v=J4BSK_ASOlw

Erwin Denissen, Sat, 3 Aug 2013 13:10:08 -0400


Recent Entries
< PreviousBrowse the ArchivesNext >
Subscribe to the RSS Feed

(c) Copyright Charles Petzold
www.charlespetzold.com