Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 10:26, 27 July 2007.

Custom font

From Forum Nokia Wiki

Here are the steps for creating a custom fonts for your Symbian 2nd edition & 3rd Edition phones.

Step 1: First get/download the .ttf file of the font which you want to use in your mobile.You can also use the .ttf files of your Windows operation system go to Control Panel > Fonts or C:\WINDOWS\Fonts and select the .ttf file of the font.

Step 2: Get a copy of Easy GDR creator from www.symbian-freak.com, which is a freeware application used for converting a .ttf to a .gdr.

Step 3: After creating the .gdr file, you can place the .gdr file at any location in your mobile (say for example c:\system\myfolder\abc.gdr).

Step 4: Load the font file with the Draw() function.

CGraphicsDevice* iDevice = iCoeEnv->ScreenDevice();
 
TFileName iFileName;
iFileName.Copy(_L("c:\\system\\myfolder\\abc.gdr"));
 
CFbsTypefaceStore* iFontStore = CFbsTypefaceStore::NewL(iDevice);
CWsScreenDevice* iScrDevice =iCoeEnv->ScreenDevice();
 
TInt aid =10001;//use any value 
iScrDevice->AddFile(iFileName,aid);
 
TFontSpec myFontSpec;
iDevice->GetNearestFontInTwips(myFont,myFontSpec);
 
gc.UseFont(myFont);
gc.SetPenColor(KRgbBlack);
gc.DrawText(_L("hello"),TPoint(5,20));

Step 5: Unload the font file.

iScrDevice->ReleaseFont(myFont);
iScrDevice->RemoveFile(aid);


Custom fonts for Symbian 3rd editon

#include <aknutils.h>
LIBRARY   gdi.lib 
LIBRARY   fbscli.lib 
 
CFont* iFont;
TInt iFontUid;
 
CEikonEnv::Static()->ScreenDevice()->AddFile(_L("c:\\system\\fonts\\GARABD.gdr"),
iFontUid);
 
const CFont* logical_font =
AknLayoutUtils::FontFromId(EAknLogicalFontSecondaryFont);
 
TFontSpec font_spec = logical_font->FontSpecInTwips();
TFontSpec myFontSpec(_L("Garamond"),font_spec.iHeight);
 
CEikonEnv::Static()->ScreenDevice()->GetNearestFontToDesignHeightInTwips(iFont,
myFontSpec);
  • Unloading the font
CEikonEnv::Static()->ScreenDevice()->ReleaseFont(iFont);
CEikonEnv::Static()->ScreenDevice()->RemoveFile(iFontUid);

Related Discussions
Thread Thread Starter Forum Replies Last Post
strange Font error...HELP! etamburini Mobile Java Tools & SDKs 4 2008-03-14 07:55
Changing the font of a CAknDoubleGraphicStyleListBox KevinD Symbian User Interface 2 2005-11-04 21:34
Menu Size a_barbs Symbian User Interface 0 2003-07-22 18:30
Multi key capturers nadav70 Symbian User Interface 7 2008-05-25 20:47
Does Symbian support Unicode? noman_csedu General Symbian C++ 4 2007-12-11 11:54
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX