Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries. Thanks for all your past and future contributions.

Archived:Custom font files don't work properly on S60 3rd Edition (Known Issue)

From Wiki
Jump to: navigation, search

Archived.pngArchived: This article is archived because it is not considered relevant for third-party developers creating commercial solutions today. If you think this article is still relevant, let us know by adding the template {{ReviewForRemovalFromArchive|user=~~~~|write your reason here}}.

Article Metadata
Tested with
Devices(s): Tested on Nokia N73
Platform(s): S60 3rd Edition
S60 3rd Edition (initial release)
Keywords: CWsScreenDevice::AddFile
Created: User:Symbian expert 0 (17 Sep 2009)
Last edited: hamishwillee (07 Sep 2012)


Custom (TTF of GDR) fonts can be used in an application by loading the font file using the CWsScreenDevice::AddFile() function. In S60 3rd Edition devices, adding a new font file works only the first time. Once the application is restarted, adding the custom font fails (a system font is selected instead).

How to reproduce

The issue can be reproduced using the following code snippet.

CFont* font;
TInt fontId;
CWsScreenDevice* dev = CEikonEnv::Static()->ScreenDevice();
dev->AddFile( _L("c:\\data\\sample.ttf"), fontId );
const CFont* logicalFont = AknLayoutUtils::FontFromId( EAknLogicalFontSecondaryFont );
TFontSpec fontSpec = logicalFont->FontSpecInTwips();
TFontSpec myFontSpec( _L("MyTypeface"), fontSpec.iHeight );
dev->GetNearestFontToDesignHeightInTwips( font, myFontSpec );


This issue is fixed in S60 3rd Edition, Feature Pack 1 devices (and onwards).

Workaround for affected devices:

As a workaround, implement a check at application startup for whether the font file is already added to the typeface store; ie. only call AddFile() once.

This page was last modified on 7 September 2012, at 06:56.
78 page views in the last 30 days.