Archived:Custom font files don't work properly on S60 3rd Edition (Known Issue)
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.
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.