×
Namespaces

Variants
Actions

Listing available fonts using Symbian C++

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Code ExampleTested with
Devices(s): Nokia 6220 Classic, Nokia N95 8GB, Nokia 5800 XpressMusic
Compatibility
Platform(s): S60 3rd Edition, FP1, S60 3rd Edition, FP2, S60 5th Edition
S60 5th Edition
S60 3rd Edition (initial release)
Article
Keywords: FontUtils, CGraphicsDevice, FontUtils::GetAvailableFontsL(), SystemGc().Device()
Created: tapla (22 Apr 2009)
Last edited: hamishwillee (18 Sep 2012)

Contents

Overview

This snippet demonstrates how to list fonts that are available on the device.

This snippet can be self-signed.

MMP file

This snippet requires the following libraries:

LIBRARY bafl.lib  // CDesCArrayFlat
LIBRARY egul.lib // FontUtils

Header file: CSymbianStubAppView.h

class CSymbianStubAppView : public CCoeControl
{
public: // New methods
/**
* Lists fonts available on the device
*/

void ListAvailableFontsL();
};

Source file: CSymbianStubAppView.cpp

#include <badesca.h>  // CDesCArrayFlat
#include <gdi.h> // CGraphicsDevice
#include <gulutil.h> // FontUtils
void CSymbianStubAppView::ListAvailableFontsL()
{
CGraphicsDevice *dev = SystemGc().Device();
CDesCArrayFlat *fontNames = new (ELeave) CDesCArrayFlat(5);
FontUtils::GetAvailableFontsL(*dev, *fontNames, EGulAllFonts);
 
// Print the font names on the screen
for (TInt i = 0; i < fontNames->Count(); i++)
{
LogPrintL((*fontNames)[i]);
}
}

Postconditions

Fonts that are available on the device are listed on the screen.

Supplementary material

This code snippet is part of the stub concept, which means that it has been patched on top of a template application in order to be more useful for developers. The version of the Symbian stub application used as a template in this snippet is v1.1.

  • The patched, executable application that can be used to test the features described in this snippet is available for download at Media:ListingAvailableFonts.zip.
  • You can view all the changes that are required to implement the above-mentioned features. The changes are provided in unified diff and colour-coded diff (HTML) formats in Media:ListingAvailableFonts.diff.zip.
  • For general information on applying the patch, see Using Diffs.
  • For unpatched stub applications, see Example stub.
This page was last modified on 18 September 2012, at 08:56.
74 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×