williamr@2: // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies). williamr@2: // All rights reserved. williamr@2: // This component and the accompanying materials are made available williamr@4: // under the terms of "Eclipse Public License v1.0" williamr@2: // which accompanies this distribution, and is available williamr@4: // at the URL "http://www.eclipse.org/legal/epl-v10.html". williamr@2: // williamr@2: // Initial Contributors: williamr@2: // Nokia Corporation - initial contribution. williamr@2: // williamr@2: // Contributors: williamr@2: // williamr@2: // Description: williamr@2: // williamr@2: williamr@2: #if !defined(__GULFONT_H__) williamr@2: #define __GULFONT_H__ williamr@2: williamr@2: #include williamr@2: #include williamr@2: williamr@2: class TResourceReader; williamr@2: williamr@2: class TLogicalFont williamr@2: /** Packages the attributes of a logical font. williamr@2: williamr@2: These attributes include a UID (iFontId) and a category (iCategory), either williamr@2: of which can be used to identify a required system font. The possible values williamr@2: for the UID are defined in the UI variant's look and feel layer, so are not williamr@2: the same as the UID values that may be used to create a physical font. williamr@2: williamr@2: An object of this class can be passed by any application to CEikonEnv::Font(), williamr@2: to return the closest matching system font (a CFont-derived object). williamr@2: williamr@2: @publishedAll williamr@2: @released */ williamr@2: { williamr@2: public: williamr@2: /** Logical font categories. williamr@2: williamr@2: The font category specifies the type of font that is required. It can be specified williamr@2: as an alternative to the logical font UID. The physical fonts associated with williamr@2: these categories are specified in the LAF layer, so are UI variant-specific. */ williamr@2: enum TFontCategory williamr@2: { williamr@2: /** The normal system font. */ williamr@2: EView, williamr@2: /** The font used in buttons. */ williamr@2: EButton, williamr@2: /** The font used for annotations. This is smaller than the normal font. williamr@2: For instance, it is used to draw the page number in some applications. */ williamr@2: EAnnotation, williamr@2: /** The font used for titles. */ williamr@2: ETitle williamr@2: }; williamr@2: /** Font styles. */ williamr@2: enum TFontStyle williamr@2: { williamr@2: /** Normal style. */ williamr@2: ENormal, williamr@2: /** Bold. */ williamr@2: EBold, williamr@2: /** Italics. */ williamr@2: EItalic, williamr@2: /** Bold and italics. */ williamr@2: EBoldItalic, williamr@2: /** Superscript. */ williamr@2: ESuperscript, williamr@2: /** Subscript. */ williamr@2: ESubscript, williamr@2: /** Light. This is the opposite of bold, i.e. a smaller than normal pen size is williamr@2: used to draw it. */ williamr@2: ELight, williamr@2: /** Custom font. */ williamr@2: ECustom williamr@2: }; williamr@2: public: williamr@2: IMPORT_C TLogicalFont(); williamr@2: IMPORT_C TLogicalFont(TUid aId); williamr@2: IMPORT_C TLogicalFont(TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor); williamr@2: IMPORT_C TLogicalFont(TUid aId,TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor); williamr@2: public: williamr@2: /** The logical font ID. */ williamr@2: TUid iFontId; williamr@2: /** The logical font category. */ williamr@2: TFontCategory iCategory; williamr@2: /** The font style. */ williamr@2: TFontStyle iStyle; williamr@2: /** The zoom factor. */ williamr@2: TZoomFactor iZoomFactor; williamr@2: }; williamr@2: williamr@2: williamr@2: class CCleanupStackableFont : public CBase williamr@2: /** Wraps a font (CFbsFont) object that can be pushed onto the cleanup stack. williamr@2: williamr@2: By default, the cleanup stack only handles CBase-derived classes, and untyped williamr@2: (TAny*) objects that can be cleaned up by a simple memory free call. Fonts williamr@2: must also be released, which this class handles automatically in its destructor. williamr@2: williamr@2: The font is initialised from a resource file, and can be identified by name williamr@2: or UID. williamr@2: williamr@2: @publishedAll williamr@2: @released williamr@2: @see CFbsFont */ williamr@2: { williamr@2: public: williamr@2: IMPORT_C static CCleanupStackableFont* NewL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice); williamr@2: IMPORT_C static CCleanupStackableFont* NewLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice); williamr@2: IMPORT_C static CCleanupStackableFont* NewByNameL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice); williamr@2: IMPORT_C static CCleanupStackableFont* NewByNameLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice); williamr@2: IMPORT_C virtual ~CCleanupStackableFont(); williamr@2: public: williamr@2: IMPORT_C CFbsFont& Font() const; williamr@2: IMPORT_C CFbsFont* TakeOwnershipOfFont(); williamr@2: private: williamr@2: CCleanupStackableFont(CWsScreenDevice& aScreenDevice); williamr@2: static CCleanupStackableFont* NewLC(TBool aByUid,TResourceReader& aReader, CWsScreenDevice& aScreenDevice); williamr@2: private: williamr@2: CWsScreenDevice& iScreenDevice; williamr@2: CFbsFont* iFont; williamr@2: }; williamr@2: williamr@2: #endif