1.1 --- a/epoc32/include/gulfont.h Tue Nov 24 13:55:44 2009 +0000
1.2 +++ b/epoc32/include/gulfont.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -1,1 +1,125 @@
1.4 -gulfont.h
1.5 +// Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +// All rights reserved.
1.7 +// This component and the accompanying materials are made available
1.8 +// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.9 +// which accompanies this distribution, and is available
1.10 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.11 +//
1.12 +// Initial Contributors:
1.13 +// Nokia Corporation - initial contribution.
1.14 +//
1.15 +// Contributors:
1.16 +//
1.17 +// Description:
1.18 +//
1.19 +
1.20 +#if !defined(__GULFONT_H__)
1.21 +#define __GULFONT_H__
1.22 +
1.23 +#include <gdi.h>
1.24 +#include <w32std.h>
1.25 +
1.26 +class TResourceReader;
1.27 +
1.28 +class TLogicalFont
1.29 +/** Packages the attributes of a logical font.
1.30 +
1.31 +These attributes include a UID (iFontId) and a category (iCategory), either
1.32 +of which can be used to identify a required system font. The possible values
1.33 +for the UID are defined in the UI variant's look and feel layer, so are not
1.34 +the same as the UID values that may be used to create a physical font.
1.35 +
1.36 +An object of this class can be passed by any application to CEikonEnv::Font(),
1.37 +to return the closest matching system font (a CFont-derived object).
1.38 +
1.39 +@publishedAll
1.40 +@released */
1.41 + {
1.42 +public:
1.43 + /** Logical font categories.
1.44 +
1.45 + The font category specifies the type of font that is required. It can be specified
1.46 + as an alternative to the logical font UID. The physical fonts associated with
1.47 + these categories are specified in the LAF layer, so are UI variant-specific. */
1.48 + enum TFontCategory
1.49 + {
1.50 + /** The normal system font. */
1.51 + EView,
1.52 + /** The font used in buttons. */
1.53 + EButton,
1.54 + /** The font used for annotations. This is smaller than the normal font.
1.55 + For instance, it is used to draw the page number in some applications. */
1.56 + EAnnotation,
1.57 + /** The font used for titles. */
1.58 + ETitle
1.59 + };
1.60 + /** Font styles. */
1.61 + enum TFontStyle
1.62 + {
1.63 + /** Normal style. */
1.64 + ENormal,
1.65 + /** Bold. */
1.66 + EBold,
1.67 + /** Italics. */
1.68 + EItalic,
1.69 + /** Bold and italics. */
1.70 + EBoldItalic,
1.71 + /** Superscript. */
1.72 + ESuperscript,
1.73 + /** Subscript. */
1.74 + ESubscript,
1.75 + /** Light. This is the opposite of bold, i.e. a smaller than normal pen size is
1.76 + used to draw it. */
1.77 + ELight,
1.78 + /** Custom font. */
1.79 + ECustom
1.80 + };
1.81 +public:
1.82 + IMPORT_C TLogicalFont();
1.83 + IMPORT_C TLogicalFont(TUid aId);
1.84 + IMPORT_C TLogicalFont(TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
1.85 + IMPORT_C TLogicalFont(TUid aId,TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
1.86 +public:
1.87 + /** The logical font ID. */
1.88 + TUid iFontId;
1.89 + /** The logical font category. */
1.90 + TFontCategory iCategory;
1.91 + /** The font style. */
1.92 + TFontStyle iStyle;
1.93 + /** The zoom factor. */
1.94 + TZoomFactor iZoomFactor;
1.95 + };
1.96 +
1.97 +
1.98 +class CCleanupStackableFont : public CBase
1.99 +/** Wraps a font (CFbsFont) object that can be pushed onto the cleanup stack.
1.100 +
1.101 +By default, the cleanup stack only handles CBase-derived classes, and untyped
1.102 +(TAny*) objects that can be cleaned up by a simple memory free call. Fonts
1.103 +must also be released, which this class handles automatically in its destructor.
1.104 +
1.105 +The font is initialised from a resource file, and can be identified by name
1.106 +or UID.
1.107 +
1.108 +@publishedAll
1.109 +@released
1.110 +@see CFbsFont */
1.111 + {
1.112 +public:
1.113 + IMPORT_C static CCleanupStackableFont* NewL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
1.114 + IMPORT_C static CCleanupStackableFont* NewLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
1.115 + IMPORT_C static CCleanupStackableFont* NewByNameL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
1.116 + IMPORT_C static CCleanupStackableFont* NewByNameLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
1.117 + IMPORT_C virtual ~CCleanupStackableFont();
1.118 +public:
1.119 + IMPORT_C CFbsFont& Font() const;
1.120 + IMPORT_C CFbsFont* TakeOwnershipOfFont();
1.121 +private:
1.122 + CCleanupStackableFont(CWsScreenDevice& aScreenDevice);
1.123 + static CCleanupStackableFont* NewLC(TBool aByUid,TResourceReader& aReader, CWsScreenDevice& aScreenDevice);
1.124 +private:
1.125 + CWsScreenDevice& iScreenDevice;
1.126 + CFbsFont* iFont;
1.127 + };
1.128 +
1.129 +#endif