Listing available fonts using Symbian C++
This snippet demonstrates how to list fonts that are available on the device.
This snippet can be self-signed.
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
Source file: CSymbianStubAppView.cpp
#include <badesca.h> // CDesCArrayFlat
#include <gdi.h> // CGraphicsDevice
#include <gulutil.h> // FontUtils
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++)
Fonts that are available on the device are listed on the screen.
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.