epoc32/include/mw/aknfontaccess.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
parent 2 2fe1408b6811
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@2
     1
/*
williamr@2
     2
* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies).
williamr@2
     3
* All rights reserved.
williamr@2
     4
* This component and the accompanying materials are made available
williamr@4
     5
* under the terms of "Eclipse Public License v1.0"
williamr@2
     6
* which accompanies this distribution, and is available
williamr@4
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
williamr@2
     8
*
williamr@2
     9
* Initial Contributors:
williamr@2
    10
* Nokia Corporation - initial contribution.
williamr@2
    11
*
williamr@2
    12
* Contributors:
williamr@2
    13
*
williamr@2
    14
* Description: 
williamr@2
    15
*  Access to Series 60 font system
williamr@2
    16
* 
williamr@2
    17
*
williamr@2
    18
*/
williamr@2
    19
williamr@2
    20
williamr@2
    21
#ifndef __AKNFONTACCESS_H__
williamr@2
    22
#define __AKNFONTACCESS_H__
williamr@2
    23
williamr@2
    24
class CAknLayoutFont;
williamr@2
    25
class CFbsFont;
williamr@2
    26
williamr@2
    27
#include <AknFontSpecification.h>
williamr@2
    28
williamr@2
    29
class AknFontAccess
williamr@2
    30
    {
williamr@2
    31
public:
williamr@2
    32
    
williamr@2
    33
    /**
williamr@2
    34
    * Generic font family enumeration. These can be used in place of the family name descriptors
williamr@2
    35
    */
williamr@2
    36
    enum TAknFontFamily
williamr@2
    37
        {
williamr@2
    38
        EAknFontFamilyNotSpecified = 0,
williamr@2
    39
        EAknFontFamilySansSerif,
williamr@2
    40
        EAknFontFamilySerif,
williamr@2
    41
        EAknFontFamilyMonospace
williamr@2
    42
        };
williamr@2
    43
williamr@2
    44
public:
williamr@2
    45
williamr@2
    46
    /**
williamr@2
    47
    * Returns a font that matches the metrics supplied. The provider can return a scaled 
williamr@2
    48
    * or bitmap font as long as it meets the provided criteria. If an exact match isn't 
williamr@2
    49
    * found then a null is returned.
williamr@2
    50
    *
williamr@2
    51
    * @since Series 60 release 2.8
williamr@2
    52
    * 
williamr@2
    53
    * @param aBitmapDevice Device for which the font will be requested 
williamr@2
    54
    * @param aFontStyle of type TFontStyle. Use to set weight and posture of the font
williamr@2
    55
    * @param aFontSize  Font size in twips. 
williamr@2
    56
    * @param aFontFamily Font is one of the enumerations in TAknFontFamily
williamr@2
    57
    *        Note that serif and sansSerif are proportional fonts 
williamr@2
    58
    * 
williamr@2
    59
    * @return A font pointer. CBitmapDevice::ReleaseFont must be called to release the font resource on the
williamr@2
    60
    * device context when the font is no longer required. If an exact match isn't found NULL is returned
williamr@2
    61
    */
williamr@2
    62
    IMPORT_C static CFbsFont* GetFont(
williamr@2
    63
        CBitmapDevice& aBitmapDevice,        
williamr@2
    64
        const TFontStyle aFontStyle,
williamr@2
    65
        TInt aFontSizeInTwips, 
williamr@2
    66
        TAknFontFamily aFontFamily); 
williamr@2
    67
    /**
williamr@2
    68
    * Returns a font that matches the metrics supplied. The provider can return a scaled 
williamr@2
    69
    * or bitmap font as long as it meets the provided criteria. If an exact match isn't 
williamr@2
    70
    * found than a null is returned.
williamr@2
    71
    *
williamr@2
    72
    * @since Series 60 release 2.8
williamr@2
    73
    * 
williamr@2
    74
    * @param aBitmapDevice Device for which the font will be requested 
williamr@2
    75
    * @param aFontStyle of type TFontStyle. Use to set weight and posture of the font
williamr@2
    76
    * @param aFontSize Font size in twips. 
williamr@2
    77
    * @param aFontFamilyname Font family is the text name of the font family and may be, for example:
williamr@2
    78
    *               "courier", "helvetica", "times roman" etc. Font names are not case-sensitive. 
williamr@2
    79
    * 
williamr@2
    80
    * @return A font pointer. CBitmapDevice::ReleaseFont must be called to release the font resource on the
williamr@2
    81
    * device context when the font is no longer required. If an exact match isn't found NULL is returned
williamr@2
    82
    */
williamr@2
    83
    IMPORT_C static CFbsFont* GetFont(
williamr@2
    84
        CBitmapDevice& aBitmapDevice,        
williamr@2
    85
        const TFontStyle aFontStyle, 
williamr@2
    86
        TInt aFontSizeInTwips, 
williamr@2
    87
        const TDesC& aFontFamilyName); 
williamr@2
    88
    /**
williamr@2
    89
    * Returns a font that matches the metrics supplied. The provider can return a scaled 
williamr@2
    90
    * or bitmap font as long as it meets the provided criteria. A best fit is used that 
williamr@2
    91
    * is prioritized as follows: fontSize, fontStyle, fontFamily 
williamr@2
    92
    * This will succeed as long as there is at least one font on the phone. 
williamr@2
    93
    * @since Series 60 release 2.8
williamr@2
    94
    * 
williamr@2
    95
    * @param aBitmapDevice Device for which the font will be requested 
williamr@2
    96
    * @param aFontStyle of type TFontStyle. Use to set weight and posture of the font
williamr@2
    97
    * @param aFontSize Font size in twips. 
williamr@2
    98
    * @param aFontFamily Font is one of the following emumerations values: 
williamr@2
    99
    *         monospace, sansSerif, serif 
williamr@2
   100
    *        Note that serif and sansSerif are proportional fonts 
williamr@2
   101
    * 
williamr@2
   102
    * @return A font pointer. CBitmapDevice::ReleaseFont must be called to release the font resource on the
williamr@2
   103
    * device context when the font is no longer required.  A font is always returned.
williamr@2
   104
    */
williamr@2
   105
    IMPORT_C static CFbsFont* GetClosestFont(
williamr@2
   106
        CBitmapDevice& aBitmapDevice,        
williamr@2
   107
        const TFontStyle aFontStyle, 
williamr@2
   108
        TInt aFontSizeInTwips, 
williamr@2
   109
        TAknFontFamily aFontFamily); 
williamr@2
   110
    /**
williamr@2
   111
    * Returns a font that matches the metrics supplied. The provider can return a scaled 
williamr@2
   112
    * or bitmap font as long as it meets the provided criteria. A best fit is used that 
williamr@2
   113
    * is prioritized as follows: fontSize, fontStyle, fontFamily 
williamr@2
   114
    * This will succeed as long as there is at least one font on the phone.
williamr@2
   115
    * @since Series 60 release 2.8
williamr@2
   116
    * 
williamr@2
   117
    * @param aBitmapDevice Device for which the font will be requested 
williamr@2
   118
    * @param aFontStyle of type TFontStyle. Use to set weight and posture of the font
williamr@2
   119
    * @param aFontSize Font size in twips. 
williamr@2
   120
    * @param aFontFamilyname Font family is the text name of the font family and may be, for example:
williamr@2
   121
    *               "courier", "helvetica", "times roman" etc. Font names are not case-sensitive. 
williamr@2
   122
    * 
williamr@2
   123
    * @return A font pointer. CBitmapDevice::ReleaseFont must be called to release the font resource on the
williamr@2
   124
    * device context when the font is no longer required.  A font is always returned.
williamr@2
   125
    */
williamr@2
   126
    IMPORT_C static CFbsFont* GetClosestFont(
williamr@2
   127
        CBitmapDevice& aBitmapDevice,        
williamr@2
   128
        const TFontStyle aFontStyle, 
williamr@2
   129
        TInt aFontSizeInTwips, 
williamr@2
   130
        const TDesC& aFontFamilyName); 
williamr@2
   131
            
williamr@2
   132
    /**
williamr@2
   133
    * Return a fully constructed CAknLayoutFont object based upon the specification passed in.
williamr@2
   134
    * The Avkon font specifiation object uses TAknFontCategory to determine the font. 
williamr@2
   135
    *
williamr@2
   136
    * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
williamr@2
   137
    * 
williamr@2
   138
    * This method can only be used for TAknFontSpecification objects that are stored in Pixels. 
williamr@2
   139
    * (See TAknFontSpecification::Units() )
williamr@2
   140
    *
williamr@2
   141
    * @since Series 60 release 2.8
williamr@2
   142
    * @param aBitmapDevice  Device for which the font is required (not used in 2.8; CEikonEnv::ScreenDevice() is used)
williamr@2
   143
    * @param aSpec          Series 60 font specification object
williamr@2
   144
    * @return               pointer to a CAknLayoutFont object, owned by the caller
williamr@2
   145
    */
williamr@2
   146
    IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL(
williamr@2
   147
        CBitmapDevice& aBitmapDevice,   
williamr@2
   148
        const TAknFontSpecification& aSpec );
williamr@2
   149
williamr@2
   150
    /**
williamr@2
   151
    * Return a fully constructed CAknLayoutFont object based upon the typeface and specification passed in.
williamr@2
   152
    * The TTypeface object contains a typeface name that is used as the primary key to select a font.  
williamr@2
   153
    * The Series 60  font specifiation object is also used, but any value of TAknFontCategory passed in is reset to 
williamr@2
   154
    * EAknFontCategoryUndefined, and is not used to select the font. 
williamr@2
   155
    *
williamr@2
   156
    * The font object is returned as non-const, since it is owned and will eventually be deleted by the client.
williamr@2
   157
    * 
williamr@2
   158
    * This method can only be used for TAknFontSpecification objects that are stored in Pixels
williamr@2
   159
    * (See TAknFontSpecification::Units() )
williamr@2
   160
    *
williamr@2
   161
    * @since Series 60 release 2.8
williamr@2
   162
    * @param aBitmapDevice  Device for which the font is required (not used in 2.8; CEikonEnv::ScreenDevice() is used)
williamr@2
   163
    * @param aTypeface      Symbian Typface object
williamr@2
   164
    * @param aSpec             Series 60 font specification object
williamr@2
   165
    * @return                       pointer to a CAknLayoutFont object, owned by the caller
williamr@2
   166
    */
williamr@2
   167
    IMPORT_C static CAknLayoutFont* CreateLayoutFontFromSpecificationL(
williamr@2
   168
        CBitmapDevice& aBitmapDevice,        
williamr@2
   169
        const TTypeface& aTypeface, 
williamr@2
   170
        const TAknFontSpecification& aSpec);
williamr@2
   171
williamr@2
   172
           
williamr@2
   173
private:
williamr@2
   174
    /**
williamr@2
   175
    * Method containing all the real implementation for the GetFontXXX APIs
williamr@2
   176
    */
williamr@2
   177
    static CFbsFont* DoGetFont( 
williamr@2
   178
        CBitmapDevice& aBitmapDevice,        
williamr@2
   179
        const TFontStyle aFontStyle, 
williamr@2
   180
        TInt aFontSizeInTwips, 
williamr@2
   181
        const TTypeface& aFontFamilyTypeface,
williamr@2
   182
        TBool aExactMatchRequired);                 
williamr@2
   183
    };
williamr@2
   184
williamr@2
   185
#endif //  __AKNFONTACCESS_H__
williamr@2
   186
williamr@2
   187
// End of file
williamr@2
   188
williamr@2
   189
williamr@2
   190
williamr@2
   191
williamr@2
   192
williamr@2
   193
williamr@2
   194
williamr@2
   195
williamr@2
   196