epoc32/include/mw/AknFontSpecification.h
branchSymbian3
changeset 4 837f303aceeb
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/mw/AknFontSpecification.h	Wed Mar 31 12:33:34 2010 +0100
     1.3 @@ -0,0 +1,242 @@
     1.4 +/*
     1.5 +* Copyright (c) 2002-2008 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 "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.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 +
    1.21 +
    1.22 +
    1.23 +#ifndef AKNFONTSPECIFICATION_H
    1.24 +#define AKNFONTSPECIFICATION_H
    1.25 +
    1.26 +#include <gdi.h>
    1.27 +#include <AknFontCategory.hrh>
    1.28 +#include <babitflags.h>
    1.29 +
    1.30 +/**
    1.31 +* Object representing the series 60 requirements for a font. It contains information
    1.32 +* from the layout specification that fonts bound to the given font id should honor.
    1.33 +* 
    1.34 +* It formst the basis of the request to font provisioning to provide a suitable font
    1.35 +*
    1.36 +*  @lib FontUtils.lib
    1.37 +*  @since 2.8
    1.38 +*
    1.39 +*  @internal
    1.40 +*/
    1.41 +class TAknFontSpecification
    1.42 +    {
    1.43 +public:
    1.44 +
    1.45 +    enum TAknFontSpecificationUnits
    1.46 +        {
    1.47 +        EPixels = 0,
    1.48 +        ETwips
    1.49 +        };
    1.50 +
    1.51 +public:
    1.52 +    /**
    1.53 +    * Construct font specification from Font ID.
    1.54 +    *
    1.55 +    *@param aFontId     Series 60 font id from which to create a font.
    1.56 +    */
    1.57 +    IMPORT_C TAknFontSpecification( TInt aFontId );
    1.58 +
    1.59 +    /**
    1.60 +    * Construct the font specifiation from Symbian OS TFontSpec and MGraphicsDeviceMap
    1.61 +    * The Symbian OS TFontSpec must be set in Twips.  The MGraphicsDeviceMap is used to convert to
    1.62 +    * pixels for the text pane height.
    1.63 +    *
    1.64 +    * Note that the units policy during and in effect at the end of this constructor is EPixels.
    1.65 +    * 
    1.66 +    * Note that the TTypeface part of the TFontSpec is lost in this construction
    1.67 +    *
    1.68 +    * @param aCategory      Series 60 Font category to use
    1.69 +    * @param aFontSpec      Provides the metrics and Style information to use for the match
    1.70 +    * @param aDeviceMap     Device map used to convert the aFontSpec's twips to pixels
    1.71 +    * 
    1.72 +    */
    1.73 +    IMPORT_C TAknFontSpecification(  
    1.74 +        TAknFontCategory aCategory, 
    1.75 +        const TFontSpec& aFontSpec, 
    1.76 +        const MGraphicsDeviceMap* aDeviceMap );
    1.77 +    
    1.78 +    /**
    1.79 +    * Sets the Series 60 font category.
    1.80 +    * 
    1.81 +    * @param aCategory  New category to set.
    1.82 +    */
    1.83 +    IMPORT_C void SetFontCategory( TAknFontCategory aCategory );
    1.84 +    
    1.85 +    /**
    1.86 +    * Series 60 Layout Specification font category: 
    1.87 +    *   Primary, Secondary, Title etc.
    1.88 +    *
    1.89 +    * @return   Series 60 font category
    1.90 +    */
    1.91 +    IMPORT_C TAknFontCategory FontCategory() const;
    1.92 +
    1.93 +    /**
    1.94 +    * The requested height for a font. This represents the maximum vertical range that can be 
    1.95 +    * guraranteed to draw in the text pane.
    1.96 +    *
    1.97 +    * Note also that this value is the height requested by layout or the client, and might not correspond to 
    1.98 +    * the design height, ascent + descent, or max height reported by the attached font. See the APIs
    1.99 +    * CAknLayoutFont::TextPaneTopToBaseline and BaselineToTextPaneBottom. 
   1.100 +    *
   1.101 +    * If TextPaneHeightIsDesignHeight() is EFalse, then the font will be requested to fit entirely within
   1.102 +    * this range.  
   1.103 +    *
   1.104 +    * If TextPaneHeightIsDesignHeight() is set, then this value is passed to the font request as the font
   1.105 +    * design height, in which case the font may not render entirely within the "text pane height".
   1.106 +    * 
   1.107 +    * @param aNewHeight     Text pane height to be used by the font.
   1.108 +    */
   1.109 +    IMPORT_C void SetTextPaneHeight( TInt aNewHeight );
   1.110 +
   1.111 +    /**
   1.112 +    * The requested height of the font. This represents the maximum vertical range that can be 
   1.113 +    * guaranteed to draw in the text pane.
   1.114 +    *
   1.115 +    * Note also that this value is the height requested by layout or the client, and may not correspond to 
   1.116 +    * the design height, ascent + descent, or max height reported by the attached font. See the APIs
   1.117 +    * CAknLayoutFont::TextPaneTopToBaseline and BaselineToTextPaneBottom. 
   1.118 +    * 
   1.119 +    * If TextPaneHeightIsDesignHeight() is EFalse, then the font is to be requested to fit entirely within
   1.120 +    * this range.  
   1.121 +    *
   1.122 +    * If TextPaneHeightIsDesignHeight() is set, then this value is passed to the font request as the font
   1.123 +    * design height, in which case the font may not render entirely within the "text pane height".
   1.124 +    *
   1.125 +    * Depending upon the value of TextPaneHeightIsInTwips(), the value returned is in Pixels or Twips. 
   1.126 +    * Note that calling SetTextPaneHeightIsInTwips() does not perform any conversion of the text pane height;
   1.127 +    * It retains its set value.
   1.128 +    * 
   1.129 +    * @return Requested text pane height.
   1.130 +    */
   1.131 +    IMPORT_C TInt TextPaneHeight() const;
   1.132 +       
   1.133 +    /**
   1.134 +    * Set the stoke weight to request using the Symbian OS stroke weight enumeration. 
   1.135 +    *
   1.136 +    * @aParam aWeight   The stroke weight. 
   1.137 +    */
   1.138 +    IMPORT_C void SetWeight( TFontStrokeWeight aWeight );
   1.139 +    
   1.140 +    /**
   1.141 +    * Sets the posture (e.g. upright, italic) of requested font using the Symbian OS enumeration.
   1.142 +    * @param aPostore   posture to request
   1.143 +    */
   1.144 +    IMPORT_C void SetPosture( TFontPosture aPosture );
   1.145 +    
   1.146 +    /**
   1.147 +    * Sets the policy to use in requesting the font height. Fonts may be requested either by "design height" (which is 
   1.148 +    * usually approximately the ascent + descent) or by maximum height.
   1.149 +    * If false, this setting means the number set by SetTextPaneHeight is intended to match
   1.150 +    * the font's maximum extent; all characters will fit within the text pane.
   1.151 +    * If true, then the value passed by SetTextPaneHeight will be used to request design height.
   1.152 +    *
   1.153 +    * This API has no effect if called on a TAknFontSpecification that has already been bound to a font
   1.154 +    *
   1.155 +    * The default value upon construction is EFalse.
   1.156 +    *
   1.157 +    * @param aTextPaneHeightIsDesignHeight  If EFalse, ensure that the font fits entirely
   1.158 +    *                                       within the text pane height
   1.159 +    *                                       If not EFalse, then the text pane height is treated as the font
   1.160 +    *                                       design height.
   1.161 +    */
   1.162 +    IMPORT_C void SetTextPaneHeightIsDesignHeight( TBool aTextPaneHeightIsDesignHeight );
   1.163 +    
   1.164 +    /**
   1.165 +    * Accessor API for the height policy.
   1.166 +    * 
   1.167 +    * @return   EFalse if text pane height is to be the maximum font extent.
   1.168 +    *           ETrue if text pane height is to be treated as the font's design height 
   1.169 +    */
   1.170 +    IMPORT_C TBool TextPaneIsDesignHeight() const;
   1.171 +
   1.172 +    /**
   1.173 +    * Sets a flag indicating to font requests whether they should insist upon an exact match.
   1.174 +    * Whether a font match is treated as exact or not depends upon various things, including:
   1.175 +    *     - if a request is made via a generic font family or via a font family enumeration, then typeface is not tested for "exactness"
   1.176 +    *     - fonts may be forced to be rendered at certain sizes (within a small number of pixels). This still counts as an exact match
   1.177 +    * 
   1.178 +    * The default value upon construction is EFalse;
   1.179 +    *
   1.180 +    * @param aRequiresExactMatch       
   1.181 +    */
   1.182 +    IMPORT_C void SetExactMatchRequired ( TBool aRequiresExactMatch );
   1.183 +    
   1.184 +    /**
   1.185 +    * Accessor API for whether an exact match is required for the font (See SetExactMatchRequired() )
   1.186 +    *
   1.187 +    * @return   whether an exact match is required or not.
   1.188 +    */
   1.189 +    IMPORT_C TBool ExactMatchRequired() const;
   1.190 +
   1.191 +    /**
   1.192 +    * Sets the units for the Text Pane Height APIs.  Note that calling this API does not 
   1.193 +    * result in the numerical value of the text pane height being recalculated. 
   1.194 +    * Upon construction, TAknFontSpecification objects store TextPaneHeight in pixels. 
   1.195 +    * If you then call SetUnits to Twips, you will also have to call SetTextPaneHeight to pass in the new
   1.196 +    * (twips) value. 
   1.197 +    *
   1.198 +    * @param aUnits
   1.199 +    */
   1.200 +    IMPORT_C void SetUnits( TAknFontSpecification::TAknFontSpecificationUnits aUnits );
   1.201 +
   1.202 +    /**
   1.203 +    * Accessor API for the units being used.
   1.204 +    *
   1.205 +    * @return units currently being used.
   1.206 +    */
   1.207 +    IMPORT_C TAknFontSpecification::TAknFontSpecificationUnits Units() const;     
   1.208 +   
   1.209 +    /**
   1.210 +    * Accessor for the requested weight
   1.211 +    *
   1.212 +    * @return Symbian OS stroke weight enumeration (e.g. EStrokeWeightBold)
   1.213 +    */
   1.214 +    IMPORT_C TFontStrokeWeight Weight() const ;
   1.215 +    
   1.216 +    /**
   1.217 +    * Accessor for the requested posture
   1.218 +    *
   1.219 +    * @return Symbian OS font posture enumeration (e.g. EPostureItalic)
   1.220 +    */
   1.221 +    IMPORT_C TFontPosture Posture() const;
   1.222 +
   1.223 +    /**
   1.224 +    * Accessor for the requested outline effect 
   1.225 +    *
   1.226 +    * @since 5.0
   1.227 +    *
   1.228 +    * @return ETrue iff outline font effect has been requested
   1.229 +    */
   1.230 +    IMPORT_C TBool IsOutlineEffectOn() const;
   1.231 +
   1.232 +private:
   1.233 +    void LoadAnyCDLFontInstanceL();
   1.234 +
   1.235 +private:
   1.236 +    TAknFontCategory iBaseFontCategory;
   1.237 +    TInt iTextPaneHeight;
   1.238 +    // Symbian OS Font Style object convenient for holding style info
   1.239 +    TFontStyle iRequiredStyle;
   1.240 +    TBitFlags iFlags;
   1.241 +    TInt iSpare2; 
   1.242 +    };
   1.243 +
   1.244 +#endif
   1.245 +// End of File