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