epoc32/include/mw/AknFontSpecification.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@4
     1
/*
williamr@4
     2
* Copyright (c) 2002-2008 Nokia Corporation and/or its subsidiary(-ies).
williamr@4
     3
* All rights reserved.
williamr@4
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@4
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@4
     8
*
williamr@4
     9
* Initial Contributors:
williamr@4
    10
* Nokia Corporation - initial contribution.
williamr@4
    11
*
williamr@4
    12
* Contributors:
williamr@4
    13
*
williamr@4
    14
* Description: 
williamr@4
    15
*
williamr@4
    16
*/
williamr@4
    17
williamr@4
    18
williamr@4
    19
williamr@4
    20
#ifndef AKNFONTSPECIFICATION_H
williamr@4
    21
#define AKNFONTSPECIFICATION_H
williamr@4
    22
williamr@4
    23
#include <gdi.h>
williamr@4
    24
#include <AknFontCategory.hrh>
williamr@4
    25
#include <babitflags.h>
williamr@4
    26
williamr@4
    27
/**
williamr@4
    28
* Object representing the series 60 requirements for a font. It contains information
williamr@4
    29
* from the layout specification that fonts bound to the given font id should honor.
williamr@4
    30
* 
williamr@4
    31
* It formst the basis of the request to font provisioning to provide a suitable font
williamr@4
    32
*
williamr@4
    33
*  @lib FontUtils.lib
williamr@4
    34
*  @since 2.8
williamr@4
    35
*
williamr@4
    36
*  @internal
williamr@4
    37
*/
williamr@4
    38
class TAknFontSpecification
williamr@4
    39
    {
williamr@4
    40
public:
williamr@4
    41
williamr@4
    42
    enum TAknFontSpecificationUnits
williamr@4
    43
        {
williamr@4
    44
        EPixels = 0,
williamr@4
    45
        ETwips
williamr@4
    46
        };
williamr@4
    47
williamr@4
    48
public:
williamr@4
    49
    /**
williamr@4
    50
    * Construct font specification from Font ID.
williamr@4
    51
    *
williamr@4
    52
    *@param aFontId     Series 60 font id from which to create a font.
williamr@4
    53
    */
williamr@4
    54
    IMPORT_C TAknFontSpecification( TInt aFontId );
williamr@4
    55
williamr@4
    56
    /**
williamr@4
    57
    * Construct the font specifiation from Symbian OS TFontSpec and MGraphicsDeviceMap
williamr@4
    58
    * The Symbian OS TFontSpec must be set in Twips.  The MGraphicsDeviceMap is used to convert to
williamr@4
    59
    * pixels for the text pane height.
williamr@4
    60
    *
williamr@4
    61
    * Note that the units policy during and in effect at the end of this constructor is EPixels.
williamr@4
    62
    * 
williamr@4
    63
    * Note that the TTypeface part of the TFontSpec is lost in this construction
williamr@4
    64
    *
williamr@4
    65
    * @param aCategory      Series 60 Font category to use
williamr@4
    66
    * @param aFontSpec      Provides the metrics and Style information to use for the match
williamr@4
    67
    * @param aDeviceMap     Device map used to convert the aFontSpec's twips to pixels
williamr@4
    68
    * 
williamr@4
    69
    */
williamr@4
    70
    IMPORT_C TAknFontSpecification(  
williamr@4
    71
        TAknFontCategory aCategory, 
williamr@4
    72
        const TFontSpec& aFontSpec, 
williamr@4
    73
        const MGraphicsDeviceMap* aDeviceMap );
williamr@4
    74
    
williamr@4
    75
    /**
williamr@4
    76
    * Sets the Series 60 font category.
williamr@4
    77
    * 
williamr@4
    78
    * @param aCategory  New category to set.
williamr@4
    79
    */
williamr@4
    80
    IMPORT_C void SetFontCategory( TAknFontCategory aCategory );
williamr@4
    81
    
williamr@4
    82
    /**
williamr@4
    83
    * Series 60 Layout Specification font category: 
williamr@4
    84
    *   Primary, Secondary, Title etc.
williamr@4
    85
    *
williamr@4
    86
    * @return   Series 60 font category
williamr@4
    87
    */
williamr@4
    88
    IMPORT_C TAknFontCategory FontCategory() const;
williamr@4
    89
williamr@4
    90
    /**
williamr@4
    91
    * The requested height for a font. This represents the maximum vertical range that can be 
williamr@4
    92
    * guraranteed to draw in the text pane.
williamr@4
    93
    *
williamr@4
    94
    * Note also that this value is the height requested by layout or the client, and might not correspond to 
williamr@4
    95
    * the design height, ascent + descent, or max height reported by the attached font. See the APIs
williamr@4
    96
    * CAknLayoutFont::TextPaneTopToBaseline and BaselineToTextPaneBottom. 
williamr@4
    97
    *
williamr@4
    98
    * If TextPaneHeightIsDesignHeight() is EFalse, then the font will be requested to fit entirely within
williamr@4
    99
    * this range.  
williamr@4
   100
    *
williamr@4
   101
    * If TextPaneHeightIsDesignHeight() is set, then this value is passed to the font request as the font
williamr@4
   102
    * design height, in which case the font may not render entirely within the "text pane height".
williamr@4
   103
    * 
williamr@4
   104
    * @param aNewHeight     Text pane height to be used by the font.
williamr@4
   105
    */
williamr@4
   106
    IMPORT_C void SetTextPaneHeight( TInt aNewHeight );
williamr@4
   107
williamr@4
   108
    /**
williamr@4
   109
    * The requested height of the font. This represents the maximum vertical range that can be 
williamr@4
   110
    * guaranteed to draw in the text pane.
williamr@4
   111
    *
williamr@4
   112
    * Note also that this value is the height requested by layout or the client, and may not correspond to 
williamr@4
   113
    * the design height, ascent + descent, or max height reported by the attached font. See the APIs
williamr@4
   114
    * CAknLayoutFont::TextPaneTopToBaseline and BaselineToTextPaneBottom. 
williamr@4
   115
    * 
williamr@4
   116
    * If TextPaneHeightIsDesignHeight() is EFalse, then the font is to be requested to fit entirely within
williamr@4
   117
    * this range.  
williamr@4
   118
    *
williamr@4
   119
    * If TextPaneHeightIsDesignHeight() is set, then this value is passed to the font request as the font
williamr@4
   120
    * design height, in which case the font may not render entirely within the "text pane height".
williamr@4
   121
    *
williamr@4
   122
    * Depending upon the value of TextPaneHeightIsInTwips(), the value returned is in Pixels or Twips. 
williamr@4
   123
    * Note that calling SetTextPaneHeightIsInTwips() does not perform any conversion of the text pane height;
williamr@4
   124
    * It retains its set value.
williamr@4
   125
    * 
williamr@4
   126
    * @return Requested text pane height.
williamr@4
   127
    */
williamr@4
   128
    IMPORT_C TInt TextPaneHeight() const;
williamr@4
   129
       
williamr@4
   130
    /**
williamr@4
   131
    * Set the stoke weight to request using the Symbian OS stroke weight enumeration. 
williamr@4
   132
    *
williamr@4
   133
    * @aParam aWeight   The stroke weight. 
williamr@4
   134
    */
williamr@4
   135
    IMPORT_C void SetWeight( TFontStrokeWeight aWeight );
williamr@4
   136
    
williamr@4
   137
    /**
williamr@4
   138
    * Sets the posture (e.g. upright, italic) of requested font using the Symbian OS enumeration.
williamr@4
   139
    * @param aPostore   posture to request
williamr@4
   140
    */
williamr@4
   141
    IMPORT_C void SetPosture( TFontPosture aPosture );
williamr@4
   142
    
williamr@4
   143
    /**
williamr@4
   144
    * Sets the policy to use in requesting the font height. Fonts may be requested either by "design height" (which is 
williamr@4
   145
    * usually approximately the ascent + descent) or by maximum height.
williamr@4
   146
    * If false, this setting means the number set by SetTextPaneHeight is intended to match
williamr@4
   147
    * the font's maximum extent; all characters will fit within the text pane.
williamr@4
   148
    * If true, then the value passed by SetTextPaneHeight will be used to request design height.
williamr@4
   149
    *
williamr@4
   150
    * This API has no effect if called on a TAknFontSpecification that has already been bound to a font
williamr@4
   151
    *
williamr@4
   152
    * The default value upon construction is EFalse.
williamr@4
   153
    *
williamr@4
   154
    * @param aTextPaneHeightIsDesignHeight  If EFalse, ensure that the font fits entirely
williamr@4
   155
    *                                       within the text pane height
williamr@4
   156
    *                                       If not EFalse, then the text pane height is treated as the font
williamr@4
   157
    *                                       design height.
williamr@4
   158
    */
williamr@4
   159
    IMPORT_C void SetTextPaneHeightIsDesignHeight( TBool aTextPaneHeightIsDesignHeight );
williamr@4
   160
    
williamr@4
   161
    /**
williamr@4
   162
    * Accessor API for the height policy.
williamr@4
   163
    * 
williamr@4
   164
    * @return   EFalse if text pane height is to be the maximum font extent.
williamr@4
   165
    *           ETrue if text pane height is to be treated as the font's design height 
williamr@4
   166
    */
williamr@4
   167
    IMPORT_C TBool TextPaneIsDesignHeight() const;
williamr@4
   168
williamr@4
   169
    /**
williamr@4
   170
    * Sets a flag indicating to font requests whether they should insist upon an exact match.
williamr@4
   171
    * Whether a font match is treated as exact or not depends upon various things, including:
williamr@4
   172
    *     - if a request is made via a generic font family or via a font family enumeration, then typeface is not tested for "exactness"
williamr@4
   173
    *     - fonts may be forced to be rendered at certain sizes (within a small number of pixels). This still counts as an exact match
williamr@4
   174
    * 
williamr@4
   175
    * The default value upon construction is EFalse;
williamr@4
   176
    *
williamr@4
   177
    * @param aRequiresExactMatch       
williamr@4
   178
    */
williamr@4
   179
    IMPORT_C void SetExactMatchRequired ( TBool aRequiresExactMatch );
williamr@4
   180
    
williamr@4
   181
    /**
williamr@4
   182
    * Accessor API for whether an exact match is required for the font (See SetExactMatchRequired() )
williamr@4
   183
    *
williamr@4
   184
    * @return   whether an exact match is required or not.
williamr@4
   185
    */
williamr@4
   186
    IMPORT_C TBool ExactMatchRequired() const;
williamr@4
   187
williamr@4
   188
    /**
williamr@4
   189
    * Sets the units for the Text Pane Height APIs.  Note that calling this API does not 
williamr@4
   190
    * result in the numerical value of the text pane height being recalculated. 
williamr@4
   191
    * Upon construction, TAknFontSpecification objects store TextPaneHeight in pixels. 
williamr@4
   192
    * If you then call SetUnits to Twips, you will also have to call SetTextPaneHeight to pass in the new
williamr@4
   193
    * (twips) value. 
williamr@4
   194
    *
williamr@4
   195
    * @param aUnits
williamr@4
   196
    */
williamr@4
   197
    IMPORT_C void SetUnits( TAknFontSpecification::TAknFontSpecificationUnits aUnits );
williamr@4
   198
williamr@4
   199
    /**
williamr@4
   200
    * Accessor API for the units being used.
williamr@4
   201
    *
williamr@4
   202
    * @return units currently being used.
williamr@4
   203
    */
williamr@4
   204
    IMPORT_C TAknFontSpecification::TAknFontSpecificationUnits Units() const;     
williamr@4
   205
   
williamr@4
   206
    /**
williamr@4
   207
    * Accessor for the requested weight
williamr@4
   208
    *
williamr@4
   209
    * @return Symbian OS stroke weight enumeration (e.g. EStrokeWeightBold)
williamr@4
   210
    */
williamr@4
   211
    IMPORT_C TFontStrokeWeight Weight() const ;
williamr@4
   212
    
williamr@4
   213
    /**
williamr@4
   214
    * Accessor for the requested posture
williamr@4
   215
    *
williamr@4
   216
    * @return Symbian OS font posture enumeration (e.g. EPostureItalic)
williamr@4
   217
    */
williamr@4
   218
    IMPORT_C TFontPosture Posture() const;
williamr@4
   219
williamr@4
   220
    /**
williamr@4
   221
    * Accessor for the requested outline effect 
williamr@4
   222
    *
williamr@4
   223
    * @since 5.0
williamr@4
   224
    *
williamr@4
   225
    * @return ETrue iff outline font effect has been requested
williamr@4
   226
    */
williamr@4
   227
    IMPORT_C TBool IsOutlineEffectOn() const;
williamr@4
   228
williamr@4
   229
private:
williamr@4
   230
    void LoadAnyCDLFontInstanceL();
williamr@4
   231
williamr@4
   232
private:
williamr@4
   233
    TAknFontCategory iBaseFontCategory;
williamr@4
   234
    TInt iTextPaneHeight;
williamr@4
   235
    // Symbian OS Font Style object convenient for holding style info
williamr@4
   236
    TFontStyle iRequiredStyle;
williamr@4
   237
    TBitFlags iFlags;
williamr@4
   238
    TInt iSpare2; 
williamr@4
   239
    };
williamr@4
   240
williamr@4
   241
#endif
williamr@4
   242
// End of File