os/textandloc/fontservices/fontstore/src/FNTSTD.H
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2 * Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     8 *
     9 * Initial Contributors:
    10 * Nokia Corporation - initial contribution.
    11 *
    12 * Contributors:
    13 *
    14 * Description: 
    15 *
    16 */
    17 
    18 
    19 #ifndef __FNTSTD_H__
    20 #define __FNTSTD_H__
    21 
    22 #include <e32std.h>
    23 #include <graphics/shapeimpl.h>
    24 
    25 /**
    26 @internalComponent
    27 */
    28 enum TFntStorePanic
    29 	{
    30 	EFntTypefaceIndexOutOfRange,
    31 	EFntHeightIndexOutOfRange,
    32 	EFntNoTypefaces,
    33 	EFntNoTypefaceFontBitmaps,
    34 	EFntTypefaceHasNoFontBitmaps,
    35 	EFntFontBitmapNotLoaded,
    36 	EFntFontAccessCountNonZero,
    37 	EFntFontStoreFileInUse,
    38 	EFntKPixelHeightInTwipsZero,
    39 	EFntSessionCacheIndexOutOfRange,
    40 	EFntMetricsIndexOutOfBounds,
    41 	EFntNoFontFound,
    42 	EFntRemovingAlreadyDeletedLinkedFont,
    43 	EFntOverFlow,
    44 	EFntMetricsNotOnHeap,
    45 	EFntPointerNotByteAligned,
    46 	};
    47 
    48 /**
    49 @internalComponent
    50 */
    51 GLREF_C void Panic(TFntStorePanic aPanic);
    52 
    53 // COpenFontSessionCacheList is placed here rather than openfont.cpp because it is used in fntstore.cpp as well.
    54 
    55 class COpenFontSessionCache;
    56 class COpenFont;
    57 
    58 class COpenFontSessionCacheList
    59 /**
    60 @internalComponent
    61 */
    62 	{
    63 public:
    64 	inline COpenFontSessionCacheList();
    65 	TInt AddCache(COpenFontSessionCache* aCache);
    66 	COpenFontSessionCache* FindCache(TInt aSessionHandle) const;
    67 	void Delete(RHeap* aHeap);
    68 	void DeleteCache(RHeap* aHeap,TInt aSessionHandle);
    69 	void DeleteFontGlyphs(RHeap* aHeap,const COpenFont* aFont);
    70 private:
    71 	enum { EMaxNumCaches = 256 };
    72 private:
    73 	TInt iSessionHandleArray[EMaxNumCaches];
    74 	TInt iCacheOffsetArray[EMaxNumCaches];
    75 	};
    76 
    77 inline COpenFontSessionCacheList::COpenFontSessionCacheList()
    78 	{
    79 	Mem::FillZ(this, sizeof(COpenFontSessionCacheList));
    80 	}
    81 
    82 /**
    83 @internalComponent
    84 */
    85 #ifdef __GCC32__
    86 #define PACKED_STRUCTURE_PREFIX
    87 #define PACKED_STRUCTURE_SUFFIX __attribute__(( __packed__))
    88 #elif defined(__ARMCC__)
    89 #define PACKED_STRUCTURE_PREFIX __packed
    90 #define PACKED_STRUCTURE_SUFFIX
    91 #else
    92 #define PACKED_STRUCTURE_PREFIX
    93 #define PACKED_STRUCTURE_SUFFIX
    94 #endif
    95 
    96 PACKED_STRUCTURE_PREFIX class TBitmapFontCharacterOffset
    97 /**
    98 Class to store an offset to the given position of a characters binary data in the 
    99 bitmap section of the font file.
   100 @internalComponent
   101 */
   102 
   103 	{
   104 public:
   105 	TBitmapFontCharacterOffset();
   106 	void InternalizeL(RReadStream& aStream);
   107 public:
   108 	TUint16 iBitmapOffset;  // restricts bitmap to 64k
   109 	} PACKED_STRUCTURE_SUFFIX;
   110 
   111 PACKED_STRUCTURE_PREFIX class TBitmapFontCharacterMetrics
   112 /**
   113 Character metrics stored in .GDR files.
   114 
   115 This structure cannot be changed without changing the format of bitmap font
   116 files (.GDR files). This is because a pointer to TBitmapFontCharacterMetrics is made to point
   117 to part of the .GDR file in ROM.
   118 @internalComponent
   119 */
   120 
   121 	{
   122 	public:
   123 	TBitmapFontCharacterMetrics();
   124 	void InternalizeL(RReadStream& aStream);
   125 
   126 	TInt8 iAscentInPixels;
   127 	TInt8 iHeightInPixels;
   128 	TInt8 iLeftAdjustInPixels;
   129 	TInt8 iMoveInPixels;
   130 	TInt8 iRightAdjustInPixels;
   131 	} PACKED_STRUCTURE_SUFFIX;
   132 
   133 #endif