os/textandloc/fontservices/fontstore/inc/openfontrasterizer.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) 1998-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
* The Open Font rasterizer plug-in Interface Definition class.
sl@0
    16
*
sl@0
    17
*/
sl@0
    18
sl@0
    19
sl@0
    20
#ifndef OPENFONTRASTERIZER_H
sl@0
    21
#define OPENFONTRASTERIZER_H
sl@0
    22
sl@0
    23
#include <ecom/ecom.h>
sl@0
    24
sl@0
    25
class COpenFontFile;
sl@0
    26
sl@0
    27
/**
sl@0
    28
Supplied to COpenFontRasterizer::ExtendedInterface() to access the extended
sl@0
    29
API interface MOpenFontLinkedTypefaceExtension.
sl@0
    30
sl@0
    31
@see	COpenFontRasterizer::ExtendedInterface()
sl@0
    32
@see	MOpenFontLinkedTypefaceExtension
sl@0
    33
@publishedPartner
sl@0
    34
@prototype
sl@0
    35
*/
sl@0
    36
const TUid KUidLinkedTypefaceRasterizerExtension = {0x10285EAA};
sl@0
    37
sl@0
    38
/**
sl@0
    39
The Open Font rasterizer plug-in Interface Definition class. 
sl@0
    40
sl@0
    41
This interface allows the implementation of an Open Font rasterizer plug-in,
sl@0
    42
which can then be dynamically loaded at run time by the ECOM plug-in framework. 
sl@0
    43
The plug-in implementation is instantiated by calling NewL(), passing the implementation 
sl@0
    44
UID so that ECOM can instantiate the correct implementation. 
sl@0
    45
sl@0
    46
The rasterizer interface declares a single pure virtual functions, which the 
sl@0
    47
plug-in derived from this interface must implement. The function reads font files, and creates 
sl@0
    48
a COpenFontFile object if the font file is of the right type.
sl@0
    49
sl@0
    50
Writing derived classes:
sl@0
    51
sl@0
    52
Open font rasterizers should derive from this class and implement the 
sl@0
    53
NewFontFileL() function.
sl@0
    54
sl@0
    55
Derived classes should also define the factory function. It is a static function 
sl@0
    56
which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it 
sl@0
    57
to the caller. This factory function, together with the implementation UID will form 
sl@0
    58
the TImplementationProxy used by the ECOM framework to instatiate the plug-in. 
sl@0
    59
sl@0
    60
The rasterizer class may also need to store an 'engine context'. This is an 
sl@0
    61
object derived from COpenFontRasterizerContext, which provides functions that 
sl@0
    62
make it easier to write the glyph bitmap during rasterization.
sl@0
    63
sl@0
    64
sl@0
    65
@publishedPartner
sl@0
    66
@released
sl@0
    67
*/
sl@0
    68
class COpenFontRasterizer: public CBase
sl@0
    69
	{
sl@0
    70
public:
sl@0
    71
	/** Creates a COpenFontFile derived object for loading font files in the 
sl@0
    72
	new format. 
sl@0
    73
sl@0
    74
	This function is called by the framework during font and bitmap server 
sl@0
    75
	startup. It creates a font file object for font files in the \\resource\\fonts 
sl@0
    76
	directory on all drives, using the default search path. The first font of 
sl@0
    77
	a given name overrides subsequent ones. The directory search path is soft 
sl@0
    78
	to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added 
sl@0
    79
	dynamically after startup using CWsScreenDevice::AddFile(), which 
sl@0
    80
	indirectly calls this function.
sl@0
    81
sl@0
    82
	Implementations of this function should examine the file aFileName, and if 
sl@0
    83
	it is of the correct type attempt to create a COpenFontFile derived object 
sl@0
    84
	to load it. The caller is responsible for deleting the object. The function 
sl@0
    85
	must return NULL if it cannot recognise the file, and it may also leave if 
sl@0
    86
	there is an error. 
sl@0
    87
sl@0
    88
	@param aUid An ID to be used for the file. UIDs are required by the font 
sl@0
    89
	framework, so the font store allocates them for non Symbian OS-native font 
sl@0
    90
	files. This ID persists until the font is unloaded, e.g. if the device is 
sl@0
    91
	rebooted.
sl@0
    92
	@param	aFileName		The full path and filename of the file from which the COpenFontFile
sl@0
    93
							object is created, if the file is the correct type.
sl@0
    94
	@param	aFileSession	The file session owned by the Font and Bitmap server. This file session 
sl@0
    95
							should be used for any file access. If COpenFontFile objects need to keep 
sl@0
    96
							files open, aFileSession should be stored in a place that is accessible to them. 
sl@0
    97
	@return	A pointer to a new COpenFontFile derived object, or NULL if the file type is not recognised.
sl@0
    98
	@see	CWsScreenDevice::AddFile() */
sl@0
    99
	virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0;
sl@0
   100
	inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid);
sl@0
   101
	inline virtual ~COpenFontRasterizer();
sl@0
   102
	IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam);
sl@0
   103
private:
sl@0
   104
	TUid iDtor_ID_Key;//ECOM identifier used during destruction
sl@0
   105
	};
sl@0
   106
sl@0
   107
/** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface 
sl@0
   108
implementation given its implementation UID. 
sl@0
   109
sl@0
   110
@param	aInterfaceImplUid	The UID of the interface implementation required
sl@0
   111
sl@0
   112
@return	COpenFontRasterizer*	A pointer to a COpenFontRasterizer object. */
sl@0
   113
inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid)
sl@0
   114
{
sl@0
   115
	return reinterpret_cast <COpenFontRasterizer*> (
sl@0
   116
		REComSession::CreateImplementationL(
sl@0
   117
			aInterfaceImplUid,
sl@0
   118
			_FOFF(COpenFontRasterizer, iDtor_ID_Key))); 
sl@0
   119
}
sl@0
   120
sl@0
   121
/** Default destructor */
sl@0
   122
inline COpenFontRasterizer::~COpenFontRasterizer()
sl@0
   123
{
sl@0
   124
	REComSession::DestroyedImplementation(iDtor_ID_Key);
sl@0
   125
}
sl@0
   126
sl@0
   127
#endif /*OPENFONTRASTERIZER_H*/