os/textandloc/fontservices/textbase/inc/textbase.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// This file is a subset of original gdi.h.
sl@0
    15
//
sl@0
    16
// IMPORTANT NOTE to maintainer:
sl@0
    17
//     If you add new exports, to make sure they are exported by GDI.DLL,
sl@0
    18
//     remember to update /graphics/graphicsdeviceinterface/gdi/sgdi/TextBaseStub.cpp.
sl@0
    19
//
sl@0
    20
// Text related types/consts are moved from gdi.h to this file, as listed below.
sl@0
    21
//
sl@0
    22
// enum TFontPosture
sl@0
    23
// enum TFontStrokeWeight
sl@0
    24
// enum TFontPrintPosition
sl@0
    25
//
sl@0
    26
// const KMaxTypefaceNameLength
sl@0
    27
// class TTypeface
sl@0
    28
// enum TGlyphBitmapType
sl@0
    29
// class FontEffect
sl@0
    30
// class TFontStyle
sl@0
    31
// class TFontSpec
sl@0
    32
// class TTypefaceSupport
sl@0
    33
// const KSuperSubScalingPercentage
sl@0
    34
// const KSuperscriptOffsetPercentage
sl@0
    35
// const KSubscriptOffsetPercentage
sl@0
    36
// class CTypefaceStore
sl@0
    37
// const KMaxFontCacheEntries
sl@0
    38
// class CFontCache
sl@0
    39
//
sl@0
    40
// const KFontCapitalAscent
sl@0
    41
// const KFontMaxAscent
sl@0
    42
// const KFontStandardDescent
sl@0
    43
// const KFontMaxDescent
sl@0
    44
// const KFontLineGap
sl@0
    45
// const KFontGetFontTable
sl@0
    46
// const KFontGetGlyphOutline
sl@0
    47
// const KFontReleaseGlyphOutline
sl@0
    48
// const KFontReleaseFontTable
sl@0
    49
// class CFont
sl@0
    50
sl@0
    51
sl@0
    52
#ifndef __TEXTBASE_H__
sl@0
    53
#define __TEXTBASE_H__
sl@0
    54
sl@0
    55
#include <e32base.h>
sl@0
    56
#include <f32file.h>
sl@0
    57
#include <s32std.h>
sl@0
    58
sl@0
    59
class TOpenFontCharMetrics;
sl@0
    60
class RShapeInfo;
sl@0
    61
sl@0
    62
sl@0
    63
#ifndef __GLYPHSEL_TEXTBASE_H__
sl@0
    64
#define __GLYPHSEL_TEXTBASE_H__
sl@0
    65
/**
sl@0
    66
This enumeration holds the possible panic codes that may be raised 
sl@0
    67
by the TextBase API on detecting an unrecoverable error. */
sl@0
    68
enum TTextBasePanic
sl@0
    69
	{
sl@0
    70
	/** Not used */
sl@0
    71
	ETextBasePanic_Unknown				= 0,
sl@0
    72
	/** One or more of the input parameters to the interface were invalid */
sl@0
    73
	ETextBasePanic_InvalidInputParam		= 1,
sl@0
    74
	/** Insufficient text for successful completion of the method */
sl@0
    75
	ETextBasePanic_OutOfText				= 2,
sl@0
    76
	/** Internal failure. */
sl@0
    77
	ETextBasePanic_Invariant				= 3,
sl@0
    78
	/** Reserved panic codes. Not to be used. */
sl@0
    79
	ETextBasePanic_Reserved1				= 4,
sl@0
    80
	ETextBasePanic_Reserved2				= 5,
sl@0
    81
	/** Setting a typeface name that is too long */
sl@0
    82
	ETextBasePanic_TypefaceNameOverflow	= 6,
sl@0
    83
	};
sl@0
    84
#endif
sl@0
    85
sl@0
    86
sl@0
    87
/**
sl@0
    88
Font posture flags.
sl@0
    89
Fonts can be either upright or italic. 
sl@0
    90
@publishedAll	
sl@0
    91
@released
sl@0
    92
*/
sl@0
    93
enum TFontPosture
sl@0
    94
	{
sl@0
    95
	/** Font posture is normal (upright). */
sl@0
    96
	EPostureUpright,
sl@0
    97
	/** Font posture is italic. */
sl@0
    98
	EPostureItalic
sl@0
    99
	};
sl@0
   100
sl@0
   101
sl@0
   102
/**
sl@0
   103
Font stroke weight flags. 
sl@0
   104
@publishedAll	
sl@0
   105
@released
sl@0
   106
*/
sl@0
   107
enum TFontStrokeWeight
sl@0
   108
	{
sl@0
   109
	/** Font stroke weight is normal. */
sl@0
   110
	EStrokeWeightNormal,
sl@0
   111
	/** Font stroke weight is bold. */
sl@0
   112
	EStrokeWeightBold
sl@0
   113
	};
sl@0
   114
sl@0
   115
/**
sl@0
   116
Font print position flags.
sl@0
   117
Fonts can be normal, superscript or subscript. 
sl@0
   118
@publishedAll	
sl@0
   119
@released
sl@0
   120
*/
sl@0
   121
enum TFontPrintPosition
sl@0
   122
	{
sl@0
   123
	/** Font is normal. */
sl@0
   124
	EPrintPosNormal,
sl@0
   125
	/** Font is superscript. */
sl@0
   126
	EPrintPosSuperscript,
sl@0
   127
	/** Font is subscript. */
sl@0
   128
	EPrintPosSubscript
sl@0
   129
	};
sl@0
   130
sl@0
   131
sl@0
   132
/**
sl@0
   133
The maximum length of a typeface name (in characters). 
sl@0
   134
@publishedAll	
sl@0
   135
@released
sl@0
   136
*/
sl@0
   137
const TInt KMaxTypefaceNameLength=0x18;
sl@0
   138
sl@0
   139
sl@0
   140
/** Typeface name and attributes.
sl@0
   141
sl@0
   142
This class identifies a typeface by name, and contains the combination of 
sl@0
   143
attributes of the typeface. These attributes define whether it is a symbol 
sl@0
   144
typeface, whether the typeface is proportional, and whether it is serif or 
sl@0
   145
sans-serif. 
sl@0
   146
sl@0
   147
The combination of attributes for a typeface are stored in a bitmask, with 
sl@0
   148
the various bits indicating different attributes. The bitmask is calculated 
sl@0
   149
for any particular attribute combination by ORing the enumerated value for 
sl@0
   150
each individual attribute. 
sl@0
   151
@publishedAll 
sl@0
   152
@released
sl@0
   153
*/
sl@0
   154
class TTypeface
sl@0
   155
    {
sl@0
   156
public:
sl@0
   157
	enum
sl@0
   158
		{
sl@0
   159
		/** Typeface is a proportional typeface (e.g. Swiss)
sl@0
   160
		*/
sl@0
   161
		EProportional = 1,
sl@0
   162
		/** Typeface is a serif typeface (e.g. Times)
sl@0
   163
		*/
sl@0
   164
		ESerif = 2,
sl@0
   165
		/** Typeface is a symbol typeface (e.g. Symbol)
sl@0
   166
		*/
sl@0
   167
		ESymbol = 4,
sl@0
   168
		};
sl@0
   169
public:
sl@0
   170
	IMPORT_C TTypeface();
sl@0
   171
	IMPORT_C TBool operator==(const TTypeface& aTypeface) const;
sl@0
   172
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   173
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   174
	IMPORT_C void SetAttributes(TInt aAttributes);
sl@0
   175
	IMPORT_C void SetIsProportional(TBool aIsProportional);
sl@0
   176
	IMPORT_C void SetIsSerif(TBool aIsSerif);
sl@0
   177
	IMPORT_C void SetIsSymbol(TBool aIsSymbol);
sl@0
   178
	IMPORT_C TInt Attributes() const;
sl@0
   179
	IMPORT_C TBool IsProportional() const;
sl@0
   180
	IMPORT_C TBool IsSerif() const;
sl@0
   181
	IMPORT_C TBool IsSymbol() const;
sl@0
   182
	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
sl@0
   183
	IMPORT_C void SetScriptTypeForMetrics(TInt aScript);
sl@0
   184
	IMPORT_C TInt ScriptTypeForMetrics() const;
sl@0
   185
	IMPORT_C void SetName(const TDesC& aName);
sl@0
   186
	IMPORT_C const TDesC& Name() const;
sl@0
   187
private:
sl@0
   188
	void ResetAttributes();
sl@0
   189
	void ResetScriptType();
sl@0
   190
public:
sl@0
   191
	/** The typeface name. */
sl@0
   192
    TBufC<KMaxTypefaceNameLength> iName;
sl@0
   193
private:
sl@0
   194
    TUint32 iFlags;
sl@0
   195
    };
sl@0
   196
sl@0
   197
sl@0
   198
/**
sl@0
   199
An enumerated type for the format of a glyph bitmap. This type is currently 
sl@0
   200
used to indicate whether glyph bitmaps for scalable fonts are drawn anti-aliased. 
sl@0
   201
Additional values may be defined in the future.
sl@0
   202
sl@0
   203
@see TFontStyle::SetBitmapType()
sl@0
   204
@see CFbsTypefaceStore::SetDefaultBitmapType() 
sl@0
   205
@publishedAll
sl@0
   206
@released	
sl@0
   207
*/
sl@0
   208
enum TGlyphBitmapType
sl@0
   209
	{
sl@0
   210
	/** The font store's default glyph bitmap format is used. */
sl@0
   211
	EDefaultGlyphBitmap = 0,
sl@0
   212
	/** The standard monochrome format: no anti-aliasing, 1 bit per pixel, 
sl@0
   213
	run-length encoded. */
sl@0
   214
	EMonochromeGlyphBitmap,
sl@0
   215
	/** Standard 8-bits-per-pixel with anti-aliasing. */
sl@0
   216
	EAntiAliasedGlyphBitmap,
sl@0
   217
	/** The format used when sub-pixel font rendering is used. */
sl@0
   218
	ESubPixelGlyphBitmap,
sl@0
   219
	/** The format used when outline and shadow font rendering is used. 
sl@0
   220
sl@0
   221
	If the raterizer supports the outline and shadow fonts, it will set the bitmaptype as 
sl@0
   222
	EFourColourBlendGlyphBitmap but only when glyph bitmap type is set as EAntiAliasedGlyphBitmap and 
sl@0
   223
	when any of the EDropShadow or EOutline effect is on. Only rasterizer providers can use this enum.
sl@0
   224
	*/
sl@0
   225
	EFourColourBlendGlyphBitmap,
sl@0
   226
	/**
sl@0
   227
	This is used for glyphs, and not fonts, and is needed to inform the font drawing routines
sl@0
   228
	that the character should be drawn using the overall font setting. 
sl@0
   229
	For Internal Use Only.
sl@0
   230
	*/
sl@0
   231
	EGlyphBitmapTypeNotDefined,
sl@0
   232
	/**
sl@0
   233
	This is used to inform the rasterizer that the best match should be
sl@0
   234
	found for the bitmap type based upon its knowledge.
sl@0
   235
	For Internal Use Only.
sl@0
   236
	*/
sl@0
   237
	EAntiAliasedOrMonochromeGlyphBitmap,
sl@0
   238
	};
sl@0
   239
sl@0
   240
/**
sl@0
   241
Defines a set of font effects flags.
sl@0
   242
sl@0
   243
@publishedAll 
sl@0
   244
@released
sl@0
   245
WARNING: This Class is for use by system/UI software ONLY.
sl@0
   246
*/
sl@0
   247
NONSHARABLE_CLASS(FontEffect)
sl@0
   248
	{
sl@0
   249
public:
sl@0
   250
	enum TEffect
sl@0
   251
		{
sl@0
   252
		ENone			= 0x0,		// No effects.
sl@0
   253
		EAlgorithmicBold= 0x10,		// Font is algorithmic bold (a.k.a pseudo bold.)
sl@0
   254
		EDropShadow		= 0x20,		// Font has a drop shadow.
sl@0
   255
		EOutline		= 0x40,		// Font is an outline font.
sl@0
   256
		EEmbossed		= 0x80,		// Font is embossed.
sl@0
   257
		EEngraved		= 0x100,	// Font is engraved.
sl@0
   258
		ESoftEdge		= 0x200,	// Font is soft edged.
sl@0
   259
		EReserved1		= 0x400,	// Reserved for Symbian use.
sl@0
   260
		EReserved2		= 0x800,	// Reserved for Symbian use.
sl@0
   261
		EReserved3		= 0x1000,	// Reserved for Symbian use.
sl@0
   262
		EReserved4		= 0x2000,	// Reserved for Symbian use.
sl@0
   263
		EReserved5		= 0x4000,	// Reserved for Symbian use.
sl@0
   264
		EReserved6		= 0x8000,	// Reserved for Symbian use.
sl@0
   265
		};
sl@0
   266
public:
sl@0
   267
	IMPORT_C static TBool IsEffectOn(TEffect aEffect, TUint32 aFontEffect);
sl@0
   268
	IMPORT_C static void SetEffect(TEffect aEffect, TBool aOn, TUint32& aFontEffect);
sl@0
   269
	};
sl@0
   270
sl@0
   271
/** Encapsulates a font style. 
sl@0
   272
sl@0
   273
The font style information is comprised of:
sl@0
   274
sl@0
   275
the posture of the font upright or italic
sl@0
   276
sl@0
   277
the stroke weight of the font  normal or bold
sl@0
   278
sl@0
   279
the print position of the font normal, subscript or superscript
sl@0
   280
sl@0
   281
Note that the underline and strike-through attributes are not included in 
sl@0
   282
this class, but are set in the graphics context.
sl@0
   283
sl@0
   284
@see CGraphicsContext::SetUnderlineStyle()
sl@0
   285
@see CGraphicsContext::SetStrikethroughStyle() 
sl@0
   286
@publishedAll
sl@0
   287
@released
sl@0
   288
*/
sl@0
   289
class TFontStyle
sl@0
   290
	{
sl@0
   291
public:
sl@0
   292
	IMPORT_C TFontStyle();
sl@0
   293
	IMPORT_C TFontStyle(TFontPosture aPost,TFontStrokeWeight aStrWgt,TFontPrintPosition aPrintPos);
sl@0
   294
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   295
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   296
	IMPORT_C TFontPosture Posture() const;
sl@0
   297
	IMPORT_C TFontStrokeWeight StrokeWeight() const;
sl@0
   298
	IMPORT_C TFontPrintPosition PrintPosition() const;
sl@0
   299
	IMPORT_C void SetPosture(TFontPosture aPosture);
sl@0
   300
	IMPORT_C void SetStrokeWeight(TFontStrokeWeight aStrokeWeight);
sl@0
   301
	IMPORT_C void SetPrintPosition(TFontPrintPosition aPrintPosition);
sl@0
   302
	inline TGlyphBitmapType BitmapType() const;
sl@0
   303
	inline void SetBitmapType(TGlyphBitmapType aBitmapType);
sl@0
   304
	IMPORT_C TBool operator==(const TFontStyle& aFontStyle) const;
sl@0
   305
	IMPORT_C TUint32 Effects() const;
sl@0
   306
	IMPORT_C TBool IsEffectOn(FontEffect::TEffect aEffect) const;
sl@0
   307
	IMPORT_C void SetEffects(TUint32 aEffects);
sl@0
   308
	IMPORT_C void SetEffects(FontEffect::TEffect aEffect, TBool aOn);
sl@0
   309
private:
sl@0
   310
	enum
sl@0
   311
		{
sl@0
   312
		EItalic=0x1,
sl@0
   313
		EBold=0x2,
sl@0
   314
		ESuper=0x4,
sl@0
   315
		ESub=0x8
sl@0
   316
		};
sl@0
   317
private:
sl@0
   318
	TUint32 iFlags; // bitmap type - 16 bits (high), font effects - 12 bits (middle), style - 4 bits (low)
sl@0
   319
	TAny* iReserved1;
sl@0
   320
	TAny* iReserved2;
sl@0
   321
	};
sl@0
   322
sl@0
   323
sl@0
   324
sl@0
   325
/**
sl@0
   326
Specifies the font specification in device independent terms.
sl@0
   327
@publishedAll 
sl@0
   328
@released
sl@0
   329
*/
sl@0
   330
class TFontSpec
sl@0
   331
	{
sl@0
   332
public:
sl@0
   333
	IMPORT_C TFontSpec();
sl@0
   334
	IMPORT_C TFontSpec(const TDesC& aTypefaceName,TInt aHeight);
sl@0
   335
	IMPORT_C TBool operator==(const TFontSpec& aFontSpec) const;
sl@0
   336
	IMPORT_C void InternalizeL(RReadStream& aStream);
sl@0
   337
	IMPORT_C void ExternalizeL(RWriteStream& aStream) const;
sl@0
   338
	IMPORT_C void SetScriptTypeForMetrics(TLanguage aLanguage);
sl@0
   339
	IMPORT_C TInt ScriptTypeForMetrics() const;
sl@0
   340
public:
sl@0
   341
	/** The typeface. */
sl@0
   342
	TTypeface iTypeface;
sl@0
   343
	/** The height of the typeface (in twips). */
sl@0
   344
	TInt iHeight;
sl@0
   345
	/** The font style of the typeface. */
sl@0
   346
	TFontStyle iFontStyle;
sl@0
   347
	};
sl@0
   348
sl@0
   349
sl@0
   350
sl@0
   351
/** Typeface family support information.
sl@0
   352
sl@0
   353
This data-only class includes the name and attributes of a typeface, how many 
sl@0
   354
font heights are available, its minimum and maximum heights, and whether or 
sl@0
   355
not it is scaleable  a typeface is scaleable if it supports heights at 
sl@0
   356
fixed intervals between the minimum and maximum heights. 
sl@0
   357
@publishedAll 
sl@0
   358
@released
sl@0
   359
*/
sl@0
   360
class TTypefaceSupport
sl@0
   361
    {
sl@0
   362
public:
sl@0
   363
	/** The name and attributes of the typeface. */
sl@0
   364
    TTypeface iTypeface;
sl@0
   365
	/** The number of distinct font heights available in the typeface. */
sl@0
   366
    TInt iNumHeights;
sl@0
   367
	/** The typeface's minimum font height, in twips. */
sl@0
   368
    TInt iMinHeightInTwips;
sl@0
   369
	/** The typeface's maximum font height, in twips. */
sl@0
   370
    TInt iMaxHeightInTwips;
sl@0
   371
	/** Whether the typeface is scaleable. ETrue if it is scaleable, otherwise 
sl@0
   372
	EFalse. */
sl@0
   373
    TBool iIsScalable; // supports heights from min to max at fixed interval
sl@0
   374
    };
sl@0
   375
sl@0
   376
/**
sl@0
   377
The percentage used to multiply a normal font height when calculating its 
sl@0
   378
superscript or subscript height. 
sl@0
   379
@publishedAll	
sl@0
   380
@released
sl@0
   381
*/
sl@0
   382
const TInt KSuperSubScalingPercentage=67;
sl@0
   383
sl@0
   384
/**
sl@0
   385
The percentage of a font height used to calculate its baseline offset for a 
sl@0
   386
superscript print position. 
sl@0
   387
@publishedAll	
sl@0
   388
@released
sl@0
   389
*/
sl@0
   390
const TInt KSuperscriptOffsetPercentage=-28;
sl@0
   391
sl@0
   392
/**
sl@0
   393
The percentage of a font height used to calculate its baseline offset for a 
sl@0
   394
subscript print position. 
sl@0
   395
@publishedAll	
sl@0
   396
@released
sl@0
   397
*/
sl@0
   398
const TInt KSubscriptOffsetPercentage=14;
sl@0
   399
sl@0
   400
class CFont;
sl@0
   401
sl@0
   402
/** Typeface store abstract base interface.
sl@0
   403
sl@0
   404
This class provides the interface to a store for typefaces.
sl@0
   405
sl@0
   406
See also CFontStore. 
sl@0
   407
@publishedAll
sl@0
   408
@released
sl@0
   409
*/
sl@0
   410
class CTypefaceStore : public CBase
sl@0
   411
	{
sl@0
   412
public:
sl@0
   413
	IMPORT_C ~CTypefaceStore();
sl@0
   414
sl@0
   415
	/**
sl@0
   416
	Gets the font which is the nearest to the given font specification.
sl@0
   417
sl@0
   418
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   419
sl@0
   420
	Note that this deprecated function is replaced by the new @c GetNearestFontToDesignHeightInTwips() 
sl@0
   421
	yielding (virtually) the same result. However clients are strongly encouraged to use the new
sl@0
   422
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
   423
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
   424
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
   425
	may result in cropped characters.
sl@0
   426
sl@0
   427
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   428
	@param aFontSpec The specification of the font to be matched.
sl@0
   429
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   430
	@publishedAll
sl@0
   431
	@deprecated Use GetNearestFontToDesignHeightInTwips
sl@0
   432
	*/
sl@0
   433
	virtual TInt GetNearestFontInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
sl@0
   434
sl@0
   435
	/**
sl@0
   436
	Gets the font which is the nearest to the given font specification.
sl@0
   437
	
sl@0
   438
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   439
sl@0
   440
	This new function replaces the deprecated @c GetNearestFontInTwips() yielding (virtually) the 
sl@0
   441
	same result. However clients are strongly encouraged to use the new
sl@0
   442
	@c GetNearestFontToMaxHeightInTwips() function instead. This will guarantee that every 
sl@0
   443
	character within any given text string will fit within the given amount of twips, whereas the design 
sl@0
   444
	height is an aesthetic unit decided by the font designer without strict physical meaning, which 
sl@0
   445
	may result in cropped characters.
sl@0
   446
sl@0
   447
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   448
	@param aFontSpec The specification of the font to be matched.
sl@0
   449
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   450
	@publishedAll
sl@0
   451
	@released
sl@0
   452
	*/
sl@0
   453
	virtual TInt GetNearestFontToDesignHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec) = 0;
sl@0
   454
	
sl@0
   455
	/**
sl@0
   456
	Gets the font which is the nearest to the given font specification.
sl@0
   457
	
sl@0
   458
	When the font is no longer needed, call @c ReleaseFont().
sl@0
   459
sl@0
   460
	The font and bitmap server returns a pointer to the nearest matching font 
sl@0
   461
	from those available. Matches to max height of font - this does its best 
sl@0
   462
	to return a font that will fit within the maximum height specified (but 
sl@0
   463
	note that variations due to hinting algorithms may rarely result in this 
sl@0
   464
	height being exceeded by up to one pixel). Problems can also be 
sl@0
   465
	encountered with bitmap fonts where the typeface exists but doesn't have 
sl@0
   466
	a font small enough.
sl@0
   467
sl@0
   468
	@param aFont On return, contains a pointer to the nearest font.
sl@0
   469
	@param aFontSpec The specification of the font to be matched.
sl@0
   470
	@param aMaxHeight The maximum height within which the font must fit.
sl@0
   471
	@return KErrNone if successful; a system-wide error code otherwise.
sl@0
   472
	@publishedAll
sl@0
   473
	@released
sl@0
   474
	*/
sl@0
   475
	virtual TInt GetNearestFontToMaxHeightInTwips(CFont*& aFont, const TFontSpec& aFontSpec, TInt aMaxHeight) = 0;
sl@0
   476
sl@0
   477
	/** Gets the number of typefaces supported by the typeface store.
sl@0
   478
	
sl@0
   479
	@return The number of supported typefaces. */
sl@0
   480
	virtual TInt NumTypefaces() const=0;
sl@0
   481
sl@0
   482
	/** Gets typeface information for a specified typeface index.
sl@0
   483
 
sl@0
   484
 	This information is returned in aTypefaceSupport, and
sl@0
   485
	includes the typeface name and typeface attributes, the number of font
sl@0
   486
 	heights, the maximum and minimum font heights, and whether it is a
sl@0
   487
	scaleable typeface.
sl@0
   488
 
sl@0
   489
 	@param aTypefaceSupport On return, if the function executed successfully, 
sl@0
   490
 	this object contains the typeface information.
sl@0
   491
  	@param aTypefaceIndex A typeface index number, in the range: zero to
sl@0
   492
             (NumTypefaces() - 1). */
sl@0
   493
	virtual void TypefaceSupport(TTypefaceSupport& aTypefaceSupport,TInt aTypefaceIndex) const=0;
sl@0
   494
sl@0
   495
	/** Gets the height of the font with specified height and typeface indices, 
sl@0
   496
	in twips.
sl@0
   497
	
sl@0
   498
	The value returned is rounded up or down to the nearest font height in twips.
sl@0
   499
	
sl@0
   500
	@param aTypefaceIndex A typeface index number, in the range: 0 to 
sl@0
   501
	(NumTypefaces() - 1). 
sl@0
   502
	@param aHeightIndex A font height index number.
sl@0
   503
	@return The height of the font, in twips. */
sl@0
   504
	virtual TInt FontHeightInTwips(TInt aTypefaceIndex,TInt aHeightIndex) const=0;
sl@0
   505
	IMPORT_C void ReleaseFont(CFont* aFont);
sl@0
   506
	IMPORT_C static TInt BaselineOffset(TInt aHeight,TFontPrintPosition aPos);
sl@0
   507
	IMPORT_C static TInt SuperSubHeight(TInt aHeight,TFontPrintPosition aPos);
sl@0
   508
protected:
sl@0
   509
	IMPORT_C CTypefaceStore();
sl@0
   510
	IMPORT_C void ConstructL();
sl@0
   511
	IMPORT_C void AddFontL(CFont* aFont);
sl@0
   512
	IMPORT_C TBool IncrementFontCount(const CFont* aFont);
sl@0
   513
private:
sl@0
   514
	TBool FindFont(const CFont* aFont, TInt& aIdx) const;
sl@0
   515
	NONSHARABLE_CLASS(TFontAccess)
sl@0
   516
	/**
sl@0
   517
	Pairs a font with a count of how many clients of the typeface store 
sl@0
   518
	are accessing that font. 
sl@0
   519
    */
sl@0
   520
		{
sl@0
   521
	public:
sl@0
   522
		/** A device specific font. */
sl@0
   523
		CFont* iFont;
sl@0
   524
		/** The number of clients accessing the font. */
sl@0
   525
		TInt iAccessCount;
sl@0
   526
		};
sl@0
   527
protected:
sl@0
   528
	/** A list of fonts accessed by clients of the typeface store, which pairs 
sl@0
   529
	a font with a count of the number of clients accessing the font.
sl@0
   530
	
sl@0
   531
	Implemented as an array of TFontAccess objects.
sl@0
   532
	
sl@0
   533
	An object is added to this array for every font accessed. If the font is 
sl@0
   534
	released by all clients, and the access count drops to zero, the font is 
sl@0
   535
	removed from the list. */
sl@0
   536
	CArrayFixFlat<TFontAccess>* iFontAccess;
sl@0
   537
	};
sl@0
   538
sl@0
   539
/** The maximum number of entries in the font cache.
sl@0
   540
sl@0
   541
@see CFontCache */
sl@0
   542
const TInt KMaxFontCacheEntries=32;
sl@0
   543
sl@0
   544
/** Font cache. 
sl@0
   545
sl@0
   546
When a CFont* needs to be found for a particular TFontSpec, the cache can 
sl@0
   547
be searched to see if the TFontSpec is already in the cache. If the TFontSpec 
sl@0
   548
is in the cache, its corresponding CFont* can be returned. Otherwise 
sl@0
   549
GetNearestFontInTwips() must be used to search all of the available fonts for 
sl@0
   550
the nearest CFont- a procedure which takes much longer than a simple cache
sl@0
   551
search.
sl@0
   552
sl@0
   553
The current font cache should be destroyed and a new cache created whenever 
sl@0
   554
the zoom factor or device map changes, as these changes break the relation 
sl@0
   555
between CFont and TFontSpec. 
sl@0
   556
@publishedAll
sl@0
   557
@released
sl@0
   558
*/
sl@0
   559
class CFontCache : public CBase
sl@0
   560
	{
sl@0
   561
public:
sl@0
   562
	IMPORT_C CFontCache();
sl@0
   563
	IMPORT_C CFontCache(TInt aMaxEntries);
sl@0
   564
	IMPORT_C ~CFontCache();
sl@0
   565
	IMPORT_C CFont* Search(const TFontSpec& aFontSpec);
sl@0
   566
	IMPORT_C CFont* AddEntryL(CFont* aFont,const TFontSpec& aFontSpec);
sl@0
   567
	IMPORT_C CFont* RemoveFirstEntry();
sl@0
   568
public:
sl@0
   569
	/** The number of cache hits since the font cache was created i.e. 
sl@0
   570
	successful results from CFontCache::Search(). */
sl@0
   571
	TInt iNumHits;
sl@0
   572
	/** The number of cache misses since the font cache was created i.e. 
sl@0
   573
	unsuccessful results from CFontCache::Search(). */
sl@0
   574
	TInt iNumMisses;
sl@0
   575
private:
sl@0
   576
	class CFontCacheEntry : public CBase
sl@0
   577
		{
sl@0
   578
	public:
sl@0
   579
		CFontCacheEntry(CFont* aFont,const TFontSpec& aFontSpec,CFontCacheEntry* aNext);
sl@0
   580
	public:
sl@0
   581
		CFont* iFont;
sl@0
   582
		TFontSpec iSpec;
sl@0
   583
		CFontCacheEntry* iNext;
sl@0
   584
		};
sl@0
   585
private:
sl@0
   586
	TInt iNumEntries;
sl@0
   587
	TInt iMaxEntries;
sl@0
   588
	CFontCacheEntry* iFirst;
sl@0
   589
	};
sl@0
   590
sl@0
   591
/**
sl@0
   592
WARNING: this Class is for internal use ONLY.  Compatibility is not guaranteed in future releases.
sl@0
   593
UIDs corresponding to the CFont API extension functions
sl@0
   594
@internalTechnology
sl@0
   595
*/
sl@0
   596
const TUid KFontCapitalAscent	= {0x1020498E};
sl@0
   597
const TUid KFontMaxAscent		= {0x10204B10};
sl@0
   598
const TUid KFontStandardDescent	= {0x10204B11};
sl@0
   599
const TUid KFontMaxDescent		= {0x10205AFC};
sl@0
   600
const TUid KFontLineGap			= {0x10204B12};
sl@0
   601
const TUid KFontGetFontTable    = {0x102872C1};
sl@0
   602
const TUid KFontGetGlyphOutline = {0x102872C2};
sl@0
   603
const TUid KFontReleaseGlyphOutline = {0x2002A1FD};
sl@0
   604
const TUid KFontReleaseFontTable = {0x2002AC24};
sl@0
   605
sl@0
   606
sl@0
   607
/** Abstract font interface.
sl@0
   608
sl@0
   609
The CFont class provides a device-independent interface to a device-dependent 
sl@0
   610
font usually obtained from a call to GetNearestFont...() on a graphics device. 
sl@0
   611
It is used as a handle in CGraphicsContext::UseFont() and to obtain 
sl@0
   612
device-dependent information about the font - notably the pixel width of a text 
sl@0
   613
string.
sl@0
   614
sl@0
   615
@see CFbsFont
sl@0
   616
@see CGraphicsContext::UseFont() 
sl@0
   617
@publishedAll 
sl@0
   618
@released
sl@0
   619
*/
sl@0
   620
class CFont : public CBase
sl@0
   621
	{
sl@0
   622
	friend class CTypefaceStore;
sl@0
   623
public:
sl@0
   624
sl@0
   625
	/** Text direction flags.
sl@0
   626
sl@0
   627
	This enum is used in TMeasureTextInput and determines whether the text is 
sl@0
   628
	drawn horizontally or vertically. Note: text is drawn vertically in some 
sl@0
   629
	styles of Japanese, etc.
sl@0
   630
sl@0
   631
	@see TMeasureTextInput */
sl@0
   632
	enum TTextDirection
sl@0
   633
		{
sl@0
   634
	/** Text is drawn horizontally. */
sl@0
   635
 		/** Text is drawn horizontally. */
sl@0
   636
   		EHorizontal,
sl@0
   637
 		/** Text is drawn vertically. */
sl@0
   638
		EVertical
sl@0
   639
		};
sl@0
   640
sl@0
   641
	/** Complicated parameter block used for contextual glyph selection, 
sl@0
   642
	ligature creation and diacritic placement when drawing text in complex 
sl@0
   643
	scripts
sl@0
   644
sl@0
   645
	This class declares a constructor, another scoped class, and several other 
sl@0
   646
	enums. However this class is unlikely to be useful to third party developers.
sl@0
   647
sl@0
   648
	@see CFont::GetCharacterPosition()
sl@0
   649
	@see CFont::GetCharacterPosition2()
sl@0
   650
	@publishedAll
sl@0
   651
	@released
sl@0
   652
	*/
sl@0
   653
	class TPositionParam
sl@0
   654
		{
sl@0
   655
	public:
sl@0
   656
		/** Standard constructor. */
sl@0
   657
		TPositionParam():
sl@0
   658
			iDirection(EHorizontal),
sl@0
   659
			iFlags(0),
sl@0
   660
			iPosInText(0),
sl@0
   661
			iOutputGlyphs(0)
sl@0
   662
			{
sl@0
   663
			}
sl@0
   664
sl@0
   665
		enum
sl@0
   666
			{
sl@0
   667
			EMaxInputChars = 18,	// ligatures cannot be made from more than 18 components
sl@0
   668
			EMaxOutputGlyphs = 8	// output can consist of up to 8 characters (one base and 7 combining characters)
sl@0
   669
			};
sl@0
   670
sl@0
   671
		/**Flags for TPositionParam::iFlags. */
sl@0
   672
		enum TFlags
sl@0
   673
			{
sl@0
   674
			/** Input text is logically ordered not visually ordered. */
sl@0
   675
			EFLogicalOrder = 1
sl@0
   676
			};
sl@0
   677
sl@0
   678
		/** Input: Orientation (EHorizontal or EVertical) in which to draw
sl@0
   679
		the text. */
sl@0
   680
		TInt16 iDirection;
sl@0
   681
		/** Input: Flags from TFlags. */
sl@0
   682
		TUint16 iFlags;
sl@0
   683
		/** Input: Text containing the characters to be positioned. */
sl@0
   684
		TPtrC iText;
sl@0
   685
sl@0
   686
		/** Input and output: Position within iText to shape. On exit
sl@0
   687
		it will index the first character not positioned */
sl@0
   688
		TInt iPosInText;
sl@0
   689
		/** Input and output: Pen position. */
sl@0
   690
		TPoint iPen;			
sl@0
   691
sl@0
   692
		/** Output of GetCharacterPosition and GetCharacterPosition2.
sl@0
   693
		@see CFont::GetCharacterPosition
sl@0
   694
		@see CFont::GetCharacterPosition2
sl@0
   695
		@publishedAll
sl@0
   696
		@released */
sl@0
   697
		class TOutput
sl@0
   698
			{
sl@0
   699
		public:
sl@0
   700
			/** Standard constructor. */
sl@0
   701
			TOutput() : iBitmapSize(TSize::EUninitialized),
sl@0
   702
				iBounds(TRect::EUninitialized) {}
sl@0
   703
			/** Character or glyph code. */
sl@0
   704
			TUint iCode;			
sl@0
   705
			/** Bitmap data for the glyph, if available */
sl@0
   706
			const TUint8* iBitmap;	
sl@0
   707
			/** Size of the bitmap before algorithmic bolding, size 
sl@0
   708
			multiplication, etc. */
sl@0
   709
			TSize iBitmapSize;		
sl@0
   710
			/** Bitmap bounds relative to the original pen position. */
sl@0
   711
			TRect iBounds;			
sl@0
   712
			};
sl@0
   713
sl@0
   714
		/** Information about the glyphs that were output. */
sl@0
   715
		TOutput iOutput[EMaxOutputGlyphs];	
sl@0
   716
		/** Number of glyphs actually output. */
sl@0
   717
		TInt iOutputGlyphs;					
sl@0
   718
		};	
sl@0
   719
sl@0
   720
sl@0
   721
	/** Input parameter block.
sl@0
   722
sl@0
   723
	This is optionally used by CFont::MeasureText(), which is the powerful text 
sl@0
   724
	measurement function underlying all the other text measurement functions.
sl@0
   725
sl@0
   726
	@see CFont::MeasureText() 
sl@0
   727
	@publishedAll
sl@0
   728
	@released
sl@0
   729
	*/
sl@0
   730
	class TMeasureTextInput
sl@0
   731
		{
sl@0
   732
	public:
sl@0
   733
		TMeasureTextInput():
sl@0
   734
			iStartInputChar(0),
sl@0
   735
			iEndInputChar(KMaxTInt),
sl@0
   736
			iDirection(EHorizontal),
sl@0
   737
			iFlags(0),
sl@0
   738
			iMaxAdvance(KMaxTInt),
sl@0
   739
			iMaxBounds(KMaxTInt),
sl@0
   740
			iCharJustNum(0),
sl@0
   741
			iCharJustExcess(0),
sl@0
   742
			iWordJustNum(0),
sl@0
   743
			iWordJustExcess(0)
sl@0
   744
			{
sl@0
   745
			}
sl@0
   746
sl@0
   747
		/**Flags for TMeasureTextInput::iFlags. */
sl@0
   748
		enum TFlags
sl@0
   749
			{
sl@0
   750
 			/** Input text is visually ordered left-to-right. */
sl@0
   751
 			EFVisualOrder = 1,
sl@0
   752
 			/** Input text is visually ordered right-to-left.
sl@0
   753
 			Overrides EFVisualOrder. */
sl@0
   754
 			EFVisualOrderRightToLeft = 2,
sl@0
   755
 			/** Flag to consider side bearings when checking bounds for line-break */
sl@0
   756
 			EFIncludePenPositionInBoundsCheck = 4
sl@0
   757
			};
sl@0
   758
sl@0
   759
		/** Starting index specifying first input character in iText.
sl@0
   760
	
sl@0
   761
		Together with iEndInputChar, this allows some context before and 
sl@0
   762
		after the measured text to be supplied so that shaping can work 
sl@0
   763
		properly. */
sl@0
   764
		TInt iStartInputChar;	
sl@0
   765
	
sl@0
   766
		/** Index specifying the final input character.
sl@0
   767
	
sl@0
   768
		Together with iStartInputChar, this allows some context before and 
sl@0
   769
		after the measured text to be supplied so that shaping can work 
sl@0
   770
		properly. */
sl@0
   771
		TInt iEndInputChar;		
sl@0
   772
	
sl@0
   773
		/** The direction in which to draw the text. */
sl@0
   774
		TUint16 iDirection;
sl@0
   775
	
sl@0
   776
		/** Flags from TFlags. */
sl@0
   777
		TUint16 iFlags;
sl@0
   778
	
sl@0
   779
		/** The maximum advance. */
sl@0
   780
		TInt iMaxAdvance;		
sl@0
   781
		
sl@0
   782
		/** The maximum width (or height if drawing vertically) of bounds. */
sl@0
   783
		TInt iMaxBounds;		
sl@0
   784
	
sl@0
   785
		/** The number of glyph groups to be letter-spaced. */
sl@0
   786
		TInt iCharJustNum;		
sl@0
   787
	
sl@0
   788
		/** The amount of space to be used for letter spacing. */
sl@0
   789
		TInt iCharJustExcess;	
sl@0
   790
		
sl@0
   791
		/** The number of spaces to be used for word spacing. */
sl@0
   792
		TInt iWordJustNum;		
sl@0
   793
	
sl@0
   794
		/** The amount of space to be used for word spacing. */
sl@0
   795
		TInt iWordJustExcess;	
sl@0
   796
		};
sl@0
   797
sl@0
   798
	/** Output parameter block.
sl@0
   799
sl@0
   800
	This is optionally used by CFont::MeasureText(), which is the powerful text 
sl@0
   801
	measurement function underlying all the other text measurement functions.
sl@0
   802
sl@0
   803
	@see CFont::MeasureText() 
sl@0
   804
	@publishedAll
sl@0
   805
	@released
sl@0
   806
	*/
sl@0
   807
	class TMeasureTextOutput
sl@0
   808
		{
sl@0
   809
		public:
sl@0
   810
		/** The number of input characters that would be drawn.
sl@0
   811
	
sl@0
   812
		This may be less than the length of the text if a maximum advance or bounding 
sl@0
   813
		box size is specified. */
sl@0
   814
		TInt iChars;			
sl@0
   815
		/** The number of glyphs that would be drawn. */
sl@0
   816
		TInt iGlyphs;			
sl@0
   817
		/** The number of groups that would be drawn.
sl@0
   818
	
sl@0
   819
		A group is a base glyph plus one or more combining characters. */
sl@0
   820
		TInt iGroups;			
sl@0
   821
		/** The number of word spaces (U+0020) that would be drawn. */
sl@0
   822
		TInt iSpaces;			
sl@0
   823
		/** The bounding box of all the glyphs that would be drawn. */
sl@0
   824
		TRect iBounds;			
sl@0
   825
		/** The maximum width and height of any glyph. */
sl@0
   826
		TSize iMaxGlyphSize;	
sl@0
   827
		};
sl@0
   828
sl@0
   829
	/**
sl@0
   830
	Data availability flags.
sl@0
   831
sl@0
   832
	Some fonts like printer fonts may only have width information and can return 
sl@0
   833
	ECharacterWidthOnly to show this: the text drawing routines in CFont synthesize 
sl@0
   834
	the rest of the data if necessary.
sl@0
   835
sl@0
   836
	@see GetCharacterData() 
sl@0
   837
	@publishedAll	
sl@0
   838
	@released
sl@0
   839
	*/
sl@0
   840
	enum TCharacterDataAvailability
sl@0
   841
		{
sl@0
   842
		/** No font information available. */
sl@0
   843
		ENoCharacterData,
sl@0
   844
		/** Width information only is available. */
sl@0
   845
		ECharacterWidthOnly,
sl@0
   846
		/** All character data is available. */
sl@0
   847
		EAllCharacterData
sl@0
   848
		};
sl@0
   849
sl@0
   850
private:
sl@0
   851
	// virtual functions have been made protected and public non-virtual ones
sl@0
   852
	// added to convert CFont to a handle-body pattern. SC is kept throught the
sl@0
   853
	// new functions and BC is kept by keeping the protected functions in the
sl@0
   854
	// same place in the class, and therefore in the same place in the vtable
sl@0
   855
	/**
sl@0
   856
	@publishedAll
sl@0
   857
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   858
	*/
sl@0
   859
	virtual TUid DoTypeUid() const=0;
sl@0
   860
	/**
sl@0
   861
	@publishedAll
sl@0
   862
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   863
	*/
sl@0
   864
	virtual TInt DoHeightInPixels() const=0;
sl@0
   865
	/**
sl@0
   866
	@publishedAll
sl@0
   867
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   868
	*/
sl@0
   869
	virtual TInt DoAscentInPixels() const=0;
sl@0
   870
	IMPORT_C virtual TInt DoDescentInPixels() const;
sl@0
   871
	/**
sl@0
   872
	@publishedAll
sl@0
   873
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   874
	*/
sl@0
   875
	virtual TInt DoCharWidthInPixels(TChar aChar) const=0;
sl@0
   876
	/**
sl@0
   877
	@publishedAll
sl@0
   878
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   879
	*/
sl@0
   880
	virtual TInt DoTextWidthInPixels(const TDesC& aText) const=0;
sl@0
   881
	/**
sl@0
   882
	@publishedAll
sl@0
   883
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   884
	*/
sl@0
   885
	virtual TInt DoBaselineOffsetInPixels() const=0;
sl@0
   886
	/**
sl@0
   887
	@publishedAll
sl@0
   888
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   889
	*/
sl@0
   890
	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels) const=0;
sl@0
   891
	/**
sl@0
   892
	@publishedAll
sl@0
   893
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   894
	*/
sl@0
   895
	virtual TInt DoTextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const=0;
sl@0
   896
	/**
sl@0
   897
	@publishedAll
sl@0
   898
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   899
	*/
sl@0
   900
	virtual TInt DoMaxCharWidthInPixels() const=0;
sl@0
   901
	/**
sl@0
   902
	@publishedAll
sl@0
   903
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   904
	*/
sl@0
   905
	virtual TInt DoMaxNormalCharWidthInPixels() const=0;
sl@0
   906
	/**
sl@0
   907
	@publishedAll
sl@0
   908
	WARNING: Function for internal use ONLY.  Compatibility is not guaranteed in future releases. Please see derived class for implementation.
sl@0
   909
	*/
sl@0
   910
	virtual TFontSpec DoFontSpecInTwips() const=0;
sl@0
   911
sl@0
   912
protected:	
sl@0
   913
	IMPORT_C virtual TCharacterDataAvailability DoGetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
sl@0
   914
	IMPORT_C virtual TBool DoGetCharacterPosition(TPositionParam& aParam) const;
sl@0
   915
	IMPORT_C virtual TInt DoExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
sl@0
   916
sl@0
   917
protected:
sl@0
   918
	IMPORT_C virtual ~CFont();
sl@0
   919
sl@0
   920
public:
sl@0
   921
	inline TInt FontCapitalAscent() const;
sl@0
   922
	inline TInt FontMaxAscent() const;
sl@0
   923
	inline TInt FontStandardDescent() const;
sl@0
   924
	inline TInt FontMaxDescent() const;
sl@0
   925
	inline TInt FontLineGap() const;
sl@0
   926
	inline TInt FontMaxHeight() const;
sl@0
   927
sl@0
   928
public:
sl@0
   929
	/** Gets run-time identity of the actual font type. This enables safe casting to 
sl@0
   930
	a derived type.
sl@0
   931
	
sl@0
   932
	For example, if the derived type is a CFbsFont, the return value is KCFbsFontUid. 
sl@0
   933
	You would need to cast to a CFbsFont to get a character bounding box. Similarly, 
sl@0
   934
	a CBitmapFont returns KCBitmapFontUidVal.
sl@0
   935
	
sl@0
   936
	@return The font-type identifier. */
sl@0
   937
	IMPORT_C TUid TypeUid() const;
sl@0
   938
sl@0
   939
	/** Gets the font height in pixels.
sl@0
   940
	Note that this deprecated function is replaced by the new @c FontMaxHeight().
sl@0
   941
sl@0
   942
	@return The font height in pixels.
sl@0
   943
	@see FontMaxHeight()
sl@0
   944
	@deprecated */
sl@0
   945
	IMPORT_C TInt HeightInPixels() const;
sl@0
   946
sl@0
   947
	/** Gets the font ascent in pixels.
sl@0
   948
	Note that this deprecated function is replaced by the new @c FontMaxAscent()
sl@0
   949
	or in some cases @c FontCapitalAscent().	
sl@0
   950
	
sl@0
   951
	@return The font ascent in pixels.
sl@0
   952
	@see FontCapitalAscent()
sl@0
   953
	@see FontMaxAscent()
sl@0
   954
	@deprecated */
sl@0
   955
	IMPORT_C TInt AscentInPixels() const;
sl@0
   956
	
sl@0
   957
	/** Gets the font descent in pixels.
sl@0
   958
	Note that this deprecated function is replaced by the new @c FontMaxDescent()
sl@0
   959
	or in some cases @c FontStandardDescent().	
sl@0
   960
	
sl@0
   961
	@return The font descent in pixels.
sl@0
   962
	@see FontStandardDescent() 
sl@0
   963
	@see FontMaxDescent()
sl@0
   964
	@deprecated */
sl@0
   965
	IMPORT_C TInt DescentInPixels() const;
sl@0
   966
sl@0
   967
	/** Gets the width in pixels in this font of the specified character.
sl@0
   968
	
sl@0
   969
	Note: For OpenType fonts this function returns the horizontal advance of
sl@0
   970
	the character, which may be different from the actual width.
sl@0
   971
	
sl@0
   972
	@param aChar The character whose width should be determined. 
sl@0
   973
	@return The width in pixels of the specified character in this font. */
sl@0
   974
	IMPORT_C TInt CharWidthInPixels(TChar aChar) const;
sl@0
   975
sl@0
   976
	/** Gets the width in pixels of the specified descriptor when displayed in this 
sl@0
   977
	font.
sl@0
   978
	
sl@0
   979
	@param aText The descriptor whose width should be determined. 
sl@0
   980
	@return The width of the specified descriptor when displayed in this font, 
sl@0
   981
	in pixels. */
sl@0
   982
	IMPORT_C TInt TextWidthInPixels(const TDesC& aText) const;
sl@0
   983
sl@0
   984
	/** Gets the baseline offset in pixels. 
sl@0
   985
	
sl@0
   986
	The baseline offset is how far a font is raised or lowered from its normal 
sl@0
   987
	baseline.
sl@0
   988
	
sl@0
   989
	@return Offset from normal baseline, in pixels. */
sl@0
   990
	IMPORT_C TInt BaselineOffsetInPixels() const;
sl@0
   991
sl@0
   992
	/** Gets how much of the specified descriptor can be displayed in this font without 
sl@0
   993
	exceeding the specified width.
sl@0
   994
	
sl@0
   995
	Note:
sl@0
   996
	
sl@0
   997
	This function does not display any of the descriptor itself - it is used 
sl@0
   998
	before display, to test whether the whole descriptor can be displayed.
sl@0
   999
	
sl@0
  1000
	@param aText The descriptor. 
sl@0
  1001
	@param aWidthInPixels The available width for character display. 
sl@0
  1002
	@return The number of characters which will be able to be displayed without 
sl@0
  1003
	exceeding the specified width. The count starts from the beginning of the 
sl@0
  1004
	descriptor. */
sl@0
  1005
	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels) const;
sl@0
  1006
sl@0
  1007
	/** Gets how much of the specified descriptor can be displayed in this font without 
sl@0
  1008
	exceeding the specified width. 
sl@0
  1009
	
sl@0
  1010
	It also returns the excess width - defined as the specified available width 
sl@0
  1011
	minus the width of the portion of the descriptor which can be displayed without 
sl@0
  1012
	exceeding the available width.
sl@0
  1013
	
sl@0
  1014
	@param aText The descriptor. 
sl@0
  1015
	@param aWidthInPixels The available width for character display. 
sl@0
  1016
	@param aExcessWidthInPixels The excess width after displaying the portion of 
sl@0
  1017
	the descriptor, in pixels. 
sl@0
  1018
	@return The number of characters which will be able to be displayed without 
sl@0
  1019
	exceeding the specified width. The count starts from the beginning of the 
sl@0
  1020
	descriptor. */
sl@0
  1021
	IMPORT_C TInt TextCount(const TDesC& aText,TInt aWidthInPixels,TInt& aExcessWidthInPixels) const;
sl@0
  1022
sl@0
  1023
	/** Gets the width in pixels of the widest character in this font.
sl@0
  1024
	
sl@0
  1025
	@return The width of the maximum width character, in pixels. */
sl@0
  1026
	IMPORT_C TInt MaxCharWidthInPixels() const;
sl@0
  1027
sl@0
  1028
	/** Gets the width in pixels of the widest normal character in this font.
sl@0
  1029
	
sl@0
  1030
	Normal characters include all character in a character set except non-alphabetic 
sl@0
  1031
	characters (e.g. the copyright symbol, or a block graphics symbol, for example).
sl@0
  1032
	
sl@0
  1033
	@return The width of the maximum width normal character, in pixels. */
sl@0
  1034
	IMPORT_C TInt MaxNormalCharWidthInPixels() const;
sl@0
  1035
sl@0
  1036
	/** Gets the font specification of this font in twips.
sl@0
  1037
	
sl@0
  1038
	@return The font specification of this font (in twips). */
sl@0
  1039
	IMPORT_C TFontSpec FontSpecInTwips() const;
sl@0
  1040
	IMPORT_C TCharacterDataAvailability GetCharacterData(TUint aCode, TOpenFontCharMetrics& aMetrics,const TUint8*& aBitmap,TSize& aBitmapSize) const;
sl@0
  1041
	IMPORT_C TBool GetCharacterPosition(TPositionParam& aParam) const;
sl@0
  1042
	IMPORT_C TInt WidthZeroInPixels() const;
sl@0
  1043
	IMPORT_C TInt MeasureText(const TDesC& aText, const TMeasureTextInput* aInput = NULL, TMeasureTextOutput* aOutput = NULL) const;
sl@0
  1044
	IMPORT_C static TBool CharactersJoin(TInt aLeftCharacter, TInt aRightCharacter);
sl@0
  1045
	IMPORT_C TInt ExtendedFunction(TUid aFunctionId, TAny* aParam = NULL) const;
sl@0
  1046
	IMPORT_C TBool GetCharacterPosition2(TPositionParam& aParam, RShapeInfo& aShapeInfo) const;
sl@0
  1047
sl@0
  1048
	/** Gets the width in pixels of the specified descriptor when displayed in this 
sl@0
  1049
	font.
sl@0
  1050
	
sl@0
  1051
	@param aText The descriptor whose width should be determined.
sl@0
  1052
	@param aParam Parameter block that controls how much of aText is measured
sl@0
  1053
	@return The width of the specified descriptor when displayed in this font, 
sl@0
  1054
	in pixels. */
sl@0
  1055
	IMPORT_C TInt TextWidthInPixels(const TDesC& aText,const TMeasureTextInput* aParam) const;
sl@0
  1056
	};
sl@0
  1057
sl@0
  1058
sl@0
  1059
// inline functions from original gdi.inl
sl@0
  1060
/** Gets the ascent of an ANSI capital letter in the font whether or not
sl@0
  1061
there are any ANSI capitals in the font.
sl@0
  1062
@return The positive distance from the font baseline to the top of a
sl@0
  1063
standard ANSI capital letter
sl@0
  1064
@publishedAll
sl@0
  1065
@released
sl@0
  1066
*/
sl@0
  1067
inline TInt CFont::FontCapitalAscent() const
sl@0
  1068
    {
sl@0
  1069
    return ExtendedFunction(KFontCapitalAscent);
sl@0
  1070
    }
sl@0
  1071
sl@0
  1072
/** Gets the max ascent of any pre-composed glyph in the font. This will
sl@0
  1073
include accents or diacritics that form part of pre-composed glyphs. It is
sl@0
  1074
not guaranteed to cover the max ascent of composite glyphs that have to be
sl@0
  1075
created by a layout engine. This is also the recommended distance between
sl@0
  1076
the top of a text box and the baseline of the first line of text. 
sl@0
  1077
@return The positive distance from the font baseline to the top of the
sl@0
  1078
highest pre-composed glyph (including accents) above the baseline
sl@0
  1079
@publishedAll
sl@0
  1080
@released
sl@0
  1081
*/
sl@0
  1082
inline TInt CFont::FontMaxAscent() const
sl@0
  1083
    {
sl@0
  1084
    return ExtendedFunction(KFontMaxAscent);
sl@0
  1085
    }
sl@0
  1086
sl@0
  1087
/** Gets the descent of an ANSI descending character in the font.
sl@0
  1088
Whether or not there are any ANSI descenders in the font.
sl@0
  1089
@return The positive distance from the font baseline to the bottom of the
sl@0
  1090
lowest ANSI descender
sl@0
  1091
@publishedAll
sl@0
  1092
@released
sl@0
  1093
*/
sl@0
  1094
inline TInt CFont::FontStandardDescent() const
sl@0
  1095
    {
sl@0
  1096
    return ExtendedFunction(KFontStandardDescent);
sl@0
  1097
    }
sl@0
  1098
sl@0
  1099
/** Gets the max descent of any pre-composed glyph in the font. This will
sl@0
  1100
include accents or diacritics that form part of pre-composed glyphs. It is
sl@0
  1101
not guaranteed to cover the max descent of composite glyphs that have to be
sl@0
  1102
created by a layout engine.
sl@0
  1103
@return The positive distance from the font baseline to the bottom of the
sl@0
  1104
lowest pre-composed glyph (including accents) below the baseline
sl@0
  1105
@publishedAll
sl@0
  1106
@released
sl@0
  1107
*/
sl@0
  1108
inline TInt CFont::FontMaxDescent() const
sl@0
  1109
    {
sl@0
  1110
    return ExtendedFunction(KFontMaxDescent);
sl@0
  1111
    }
sl@0
  1112
sl@0
  1113
/** Gets the suggested line gap for the font. This is the recommended
sl@0
  1114
baseline to baseline distance between successive lines of text in the font.
sl@0
  1115
@return The positive recommended gap between successive lines
sl@0
  1116
@publishedAll
sl@0
  1117
@released
sl@0
  1118
*/
sl@0
  1119
inline TInt CFont::FontLineGap() const
sl@0
  1120
    {
sl@0
  1121
    return ExtendedFunction(KFontLineGap);
sl@0
  1122
    }
sl@0
  1123
sl@0
  1124
/**
sl@0
  1125
Gets the (positive) maximum height in pixels of the font.
sl@0
  1126
This may differ from the design height.
sl@0
  1127
sl@0
  1128
@return The maximum height of the font.
sl@0
  1129
@publishedAll
sl@0
  1130
@released
sl@0
  1131
*/
sl@0
  1132
inline TInt CFont::FontMaxHeight() const
sl@0
  1133
    {
sl@0
  1134
    return FontMaxAscent() + FontMaxDescent();
sl@0
  1135
    }
sl@0
  1136
sl@0
  1137
sl@0
  1138
// from original gdistruct.h
sl@0
  1139
/*
sl@0
  1140
Structure used to pass input/output parameters between RFontTable and CFbsFont.
sl@0
  1141
@internalTechnology
sl@0
  1142
*/
sl@0
  1143
class TGetFontTableParam 
sl@0
  1144
    {
sl@0
  1145
public:
sl@0
  1146
    TUint32 iTag;
sl@0
  1147
    TAny *iContent;
sl@0
  1148
    TInt iLength;
sl@0
  1149
    };
sl@0
  1150
sl@0
  1151
/*
sl@0
  1152
Structure used to pass input/output parameters between RGlyphOutlineIterator and CFbsFont.
sl@0
  1153
Used when opening an outline iterator.
sl@0
  1154
@internalTechnology
sl@0
  1155
*/
sl@0
  1156
class TGetGlyphOutlineParam 
sl@0
  1157
    {
sl@0
  1158
public:
sl@0
  1159
    TInt iCount;
sl@0
  1160
    const TUint *iCodes; 
sl@0
  1161
    TBool iHinted;
sl@0
  1162
    TAny **iOutlines;
sl@0
  1163
    TInt *iLengths; 
sl@0
  1164
    };
sl@0
  1165
sl@0
  1166
/*
sl@0
  1167
Structure used to pass input/output parameters between RGlyphOutlineIterator and CFbsFont.
sl@0
  1168
Used when closing an outline iterator.
sl@0
  1169
@internalTechnology
sl@0
  1170
*/
sl@0
  1171
class TReleaseGlyphOutlineParam 
sl@0
  1172
    {
sl@0
  1173
public:
sl@0
  1174
    TInt iCount;
sl@0
  1175
    const TUint *iCodes;
sl@0
  1176
    TBool iHinted;
sl@0
  1177
    };
sl@0
  1178
sl@0
  1179
sl@0
  1180
#endif // __TEXTBASE_H__