Home · All Namespaces · All Classes · Grouped Classes · Modules · Functions codeless banner

Setting Display Size

Introduction

Qt Extended provides a resolution independent UI so that it appears as close as possible to its intended design, regardless of the resolution and physical dimensions of the display.

The physical display size can be specified as part of the Qt for Embedded Linux display specification. The mmWidth and mmHeight parameters specify the width and height of the display in millimeters. This allows Qt Extended to determine the correct font and icon size for the display. For example, a display with a 35mm x 45mm display can be specified as:

    export QWS_DISPLAY="LinuxFb:mmWidth35:mmHeight45:0"

QWS_DISPLAY can also be set in the QVFb skin being used by The Virtual Framebuffer. For additional information on how this ties into Qt Extended startup also see Running Qt Extended.

Font Sizes

The default Qt Extended configuration installs many font sizes, however it is only necessary to install a small selection. The standard Qt Extended font size is 9 point (1 point = 1/72inch). In addition, several other fonts sizes are used. A recommended selection of point sizes is: 5, 7, 9, 11, 14.

The .qpf font files included in Qt Extended are specified by pixel size. Qt for Embedded Linux will use the nearest pixel size available if the exact size is not present. In order to determine the desired pixel sizes to be installed on the device the following formulas can be used:

  1. Determine DPI of the display
            DPI = 25.4 * resY / mmHeight
    
            Consider a 240x320 display with 35mm x 45mm physical size:
    
            DPI = 25.4 * 320 / 45 = 180dpi
  2. Determine the font pixel size
            pixelSize = DPI * pointSize / 72
    
            Consider a 9pt font on the above display:
    
            pixelSize = 180 * 9 / 72 = 22pixels

Once the desired font pixels sizes have been determined, they can be passed to configure via the -font switch. For example to use the DejaVu font with the pixel sizes of 10, 12, 16 and 28:

        configure -font dejavu_sans_condensed:10,12,16,28:50


Copyright © 2009 Trolltech Trademarks
Qt Extended 4.4.3