epoc32/include/gulfont.h
branchSymbian2
changeset 2 2fe1408b6811
parent 0 061f57f2323e
equal deleted inserted replaced
1:666f914201fb 2:2fe1408b6811
     1 gulfont.h
     1 // Copyright (c) 1997-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // 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
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 #if !defined(__GULFONT_H__)
       
    17 #define __GULFONT_H__
       
    18 
       
    19 #include <gdi.h>
       
    20 #include <w32std.h>
       
    21 
       
    22 class TResourceReader;
       
    23 
       
    24 class TLogicalFont
       
    25 /** Packages the attributes of a logical font.
       
    26 
       
    27 These attributes include a UID (iFontId) and a category (iCategory), either 
       
    28 of which can be used to identify a required system font. The possible values 
       
    29 for the UID are defined in the UI variant's look and feel layer, so are not 
       
    30 the same as the UID values that may be used to create a physical font.
       
    31 
       
    32 An object of this class can be passed by any application to CEikonEnv::Font(), 
       
    33 to return the closest matching system font (a CFont-derived object). 
       
    34 
       
    35 @publishedAll 
       
    36 @released */
       
    37 	{
       
    38 public:
       
    39 	/** Logical font categories.
       
    40 	
       
    41 	The font category specifies the type of font that is required. It can be specified 
       
    42 	as an alternative to the logical font UID. The physical fonts associated with 
       
    43 	these categories are specified in the LAF layer, so are UI variant-specific. */
       
    44 	enum TFontCategory
       
    45 		{
       
    46 		/** The normal system font. */
       
    47 		EView,
       
    48 		/** The font used in buttons. */
       
    49 		EButton,
       
    50 		/** The font used for annotations. This is smaller than the normal font. 
       
    51 		For instance, it is used to draw the page number in some applications. */
       
    52 		EAnnotation,
       
    53 		/** The font used for titles. */
       
    54 		ETitle
       
    55 		};
       
    56 	/** Font styles. */
       
    57 	enum TFontStyle
       
    58 		{
       
    59 		/** Normal style. */
       
    60 		ENormal,
       
    61 		/** Bold. */
       
    62 		EBold,
       
    63 		/** Italics. */
       
    64 		EItalic,
       
    65 		/** Bold and italics. */
       
    66 		EBoldItalic,
       
    67 		/** Superscript. */
       
    68 		ESuperscript,
       
    69 		/** Subscript. */
       
    70 		ESubscript,
       
    71 		/** Light. This is the opposite of bold, i.e. a smaller than normal pen size is 
       
    72 		used to draw it. */
       
    73 		ELight,
       
    74 		/** Custom font. */
       
    75 		ECustom
       
    76 		};
       
    77 public:
       
    78 	IMPORT_C TLogicalFont();
       
    79 	IMPORT_C TLogicalFont(TUid aId);
       
    80 	IMPORT_C TLogicalFont(TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
       
    81 	IMPORT_C TLogicalFont(TUid aId,TFontCategory aCategory,TFontStyle aStyle,const TZoomFactor& aZoomFactor);
       
    82 public:
       
    83 	/** The logical font ID. */
       
    84 	TUid iFontId;
       
    85 	/** The logical font category. */
       
    86 	TFontCategory iCategory;
       
    87 	/** The font style. */
       
    88 	TFontStyle iStyle;
       
    89 	/** The zoom factor. */
       
    90 	TZoomFactor iZoomFactor;
       
    91 	};
       
    92 
       
    93 
       
    94 class CCleanupStackableFont : public CBase
       
    95 /** Wraps a font (CFbsFont) object that can be pushed onto the cleanup stack.
       
    96 
       
    97 By default, the cleanup stack only handles CBase-derived classes, and untyped 
       
    98 (TAny*) objects that can be cleaned up by a simple memory free call. Fonts 
       
    99 must also be released, which this class handles automatically in its destructor.
       
   100 
       
   101 The font is initialised from a resource file, and can be identified by name 
       
   102 or UID.
       
   103 
       
   104 @publishedAll 
       
   105 @released 
       
   106 @see CFbsFont */
       
   107 	{
       
   108 public:
       
   109 	IMPORT_C static CCleanupStackableFont* NewL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
       
   110 	IMPORT_C static CCleanupStackableFont* NewLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
       
   111 	IMPORT_C static CCleanupStackableFont* NewByNameL(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
       
   112 	IMPORT_C static CCleanupStackableFont* NewByNameLC(TResourceReader& aReader,CWsScreenDevice& aScreenDevice);
       
   113 	IMPORT_C virtual ~CCleanupStackableFont();
       
   114 public:
       
   115 	IMPORT_C CFbsFont& Font() const;
       
   116 	IMPORT_C CFbsFont* TakeOwnershipOfFont();
       
   117 private:
       
   118 	CCleanupStackableFont(CWsScreenDevice& aScreenDevice);
       
   119 	static CCleanupStackableFont* NewLC(TBool aByUid,TResourceReader& aReader, CWsScreenDevice& aScreenDevice);
       
   120 private:
       
   121 	CWsScreenDevice& iScreenDevice;
       
   122 	CFbsFont* iFont;
       
   123 	};
       
   124 
       
   125 #endif