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