diff -r 000000000000 -r 15bf7259bb7c uiacceltk/hitchcock/coretoolkit/src/huifontmanager.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/uiacceltk/hitchcock/coretoolkit/src/huifontmanager.cpp Tue Feb 02 07:56:43 2010 +0200 @@ -0,0 +1,84 @@ +/* +* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: Implementation of THuiFontManager. Handles the management +* of Hitchcock UI Toolkit specific fonts. The implementation +* consists only of Symbian / S60 specific implementation but +* the interface is designed so that alternative platforms can be +* utilized. +* +*/ + + + +#include +#include +#include + +// ======== MEMBER FUNCTIONS ======== + +// --------------------------------------------------------------------------- +// Creates the THuiFontManager. Sets parameters to default values. +// --------------------------------------------------------------------------- +// +EXPORT_C THuiFontManager::THuiFontManager() + { + } + +// --------------------------------------------------------------------------- +// Destroys the THuiFontManager. Makes sure all allocated resources are freed. +// --------------------------------------------------------------------------- +// +EXPORT_C THuiFontManager::~THuiFontManager() + { + // Close the array of fonts + iFonts.Close(); + } + +// --------------------------------------------------------------------------- +// Returns font specifications of all platform-supported fonts. +// --------------------------------------------------------------------------- +// +EXPORT_C void THuiFontManager::EnumerateFontsL(RArray& aArray) const + { + // Add all font specification objects into the output array. + CWsScreenDevice* screenDevice = CHuiStatic::ScreenDevice(); + TInt numSystemFonts = screenDevice->NumTypefaces(); + for(TInt i = 0; i < numSystemFonts; ++i) + { + THuiFontSpecification fontSpecification; + TTypefaceSupport typefaceSupport; + + // Retrieve the typeface support information from the system + screenDevice->TypefaceSupport(typefaceSupport, i); + + // Retrieve the typeface family name from typeface support + fontSpecification.SetTypefaceFamily(typefaceSupport.iTypeface.iName.Des()); + + // Append font specification to the array. + aArray.AppendL(fontSpecification); + } + } + +// --------------------------------------------------------------------------- +// Creates a new font instance. +// --------------------------------------------------------------------------- +// +EXPORT_C TInt THuiFontManager::CreateFontL(const THuiFontSpecification& aSpecification) + { + // Include the specified font into the array of fonts. + iFonts.AppendL(aSpecification); + + // Return the unique ID of the font. + return iFonts.Count() - 1; + }