What Font does QNX UI Components on the PlayBook Use?

Posted on December 10, 2010 | Comments Off

The default font that Flash Player and AIR assigns to TextField is: Times New Roman (or Times on Mac OS X). If you set the TextFormat‘s font name of a TextField to a invalid font name it will then revert to the OS’s default font, not the Flash Player and AIR default of Times New Roman. I wanted to find out how this works on the BlackBerry Tablet OS, which is the PlayBook’s OS.

I went ahead and whipped up some code with a bunch of TextFields and various TextFormat font values. I also added the QNX Label component see what font the QNX components are using. Here what the app looks like running on the PlayBook simulator:

TextField and QNX Label Fonts

Here is the code for the font test:

    import flash.display.Sprite;
    import flash.display.StageAlign;
    import flash.display.StageScaleMode;
    import flash.text.TextField;
    import flash.text.TextFormat;
    import qnx.ui.text.Label;
    public class RIMMobileAIR extends Sprite
        public function RIMMobileAIR()
            stage.align = StageAlign.TOP_LEFT;
            stage.scaleMode = StageScaleMode.NO_SCALE;
            var input:Label = new Label();
            input.width = 400;
            input.x = 20;
            input.y = 70;
            input.text = "QNX Label FONT 12345 *** " + input.format.font;
            createTextField(10, "Times New Roman22");
            createTextField(20, "Verdana");
            createTextField(30, "BBAlpha Sans");
            createTextField(50, "Times New Roman");
            createTextField(60, "BBAlpha Sans");
        private function createTextField(y:int, font:String = ""):void
            var lbl:TextField = new TextField();
            lbl.text = "TextField FONT 12345 *** " + font;
            lbl.width = 400;
            lbl.x = 20;
            lbl.y = y;
            if (font != "")
                var format:TextFormat = new TextFormat();
                format.font = font;

As you can see the default PlayBook font used in the QNX UI components and with invalid font names is BBAlpha Sans. There are a few device fonts available on the device and you can look at those by writing code that enumerates over Font.enumerateFonts(true).

Why is this post useful? If you are developing your PlayBook application and using adl on the desktop to test and develop the application your Fonts will not look the same as on the device with out the BBAlpha Sans installed on your machine.