Archived:How to use fonts in PySymbian

From Nokia Developer Wiki
Jump to: navigation, search

Archived.pngAquivado: Este artigo foi arquivado, pois o conteúdo não é mais considerado relevante para se criar soluções comerciais atuais. Se você achar que este artigo ainda é importante, inclua o template {{ForArchiveReview|escreva a sua justificativa}}.

All PySymbian articles have been archived. PySymbian is no longer maintained by Nokia and is not guaranteed to work on more recent Symbian devices. It is not possible to submit apps to Nokia Store.

Article Metadata
Tested with
Devices(s): S60 3rd Edition FP1 SDK
Platform(s): S60 2nd Edition, S60 3rd Edition
Keywords: fonts
Created: bogdan.galiceanu (22 Nov 2007)
Last edited: hamishwillee (31 May 2013)


This article provides information about the types of fonts used in Category:PySymbian.

Code Snippet

import appuifw
print appuifw.available_fonts() #To display all available fonts, use this commands

This displays "Nokia Hindi S60", "Nokia Hindi TitleSmBd S6", "S60 ZDigi" as shown in the following figure.

Python Fonts 1.jpg

The size and style of a font can be changed by the following code snippet and screenshot.

fnt.font=u"Nokia Hindi S6016b" # sets font to Nokia Hindi S60 16 bold

Python Fonts 2.jpg

The fonts can also have attributes like bold, italics and underlined. For example, setting bold fonts is shown in screenshot.

Python Fonts 3.jpg

On a canvas, fonts are bit different. If you use their names as given by available_fonts(), these names must be in unicode format. More common names for the most used fonts are:

font='normal' # displays large text
font='title' # displays very large text
font='annotation' #or 'legend' or 'symbol' displays small text
font='dense' # displays slightly thinner text

If the font is not specified in canvas.text, the default font is used, which displays very small text.


canvas.text((20,20), u"Text here", font='normal')
canvas.text((20,20), u"Text here", font=u"Nokia Hindi S6016b")

Canvas fonts.jpg

This page was last modified on 31 May 2013, at 04:09.
58 page views in the last 30 days.