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 07:54, 28 February 2008.

CS000833 - Setting font for CEikLabel

From Forum Nokia Wiki


ID CS000833 Creation date February 28, 2008
Platform S60 3rd Edition
S60 3rd Edition, FP1
Tested on devices Nokia E61i
Nokia E90 Communicator
Category Symbian C++ Subcategory UI
APIs None Classes CEikLabel
TFontSpec
CFont
CGraphicsDevice
Methods CGraphicsDevice::GetNearestFontInTwips()
CEikLabel::SetFont()
   

Overview

This code snippet demonstrates how to set the font for CEikLabel.

This snippet can be self-signed.


MMP file

The following libraries are required:

  • LIBRARY  gdi.lib


Header file

private:
    CEikLabel* iLabel;

Source file

#include <gdi.h>  // TFontSpec
iLabel = new(ELeave) CEikLabel;
 
// Set up a font specification
_LIT(KFontName, "LatinPlain12");
const TInt KFontSize = 180;  // Height of the typeface in twips
TFontSpec fontSpec(KFontName, KFontSize);
 
// Find the nearest available font to the TFontSpec and assign it to CFont
CGraphicsDevice* screenDevice = iEikonEnv->ScreenDevice();
CFont* font;
screenDevice->GetNearestFontInTwips(font, fontSpec);
 
// Set the font for the label
iLabel->SetFont(font);
 
// Destroy the font
screenDevice->ReleaseFont(font);


Postconditions

The font used by CEikLabel is set.

Related Discussions
Thread Thread Starter Forum Replies Last Post
Basic CSS Question daveyk39 Browsing and Mark-ups 0 2003-12-23 21:42
Device font in S60 Platform SDK 3rd ED jiipee63 Mobile Java Tools & SDKs 4 2006-10-02 10:09
关于N70上汉字字体大小的问题,能提示一下吗 cxg1103 Symbian 1 2007-09-18 07:35
N90 Font Problem S.S.Sudhakar Symbian User Interface 0 2006-03-02 04:25
Raccoon: system error pvma Mobile Web Server 9 2007-01-04 19:39
 
Powered by MediaWiki
     
     RDF Facets:
     
     
     qfnZtopicQUqfnTopicZseriesE5f60Q
     qfnZtypeQUqfnTypeZCommunityContentQ
     qfnZtypeQUqfnTypeZWebpageQ
     qfnZtypeQUqfnTypeZWikiContentQ
     qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX