os/textandloc/fontservices/fontstore/inc/openfontrasterizer.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/textandloc/fontservices/fontstore/inc/openfontrasterizer.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,127 @@
     1.4 +/*
     1.5 +* Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.6 +* All rights reserved.
     1.7 +* This component and the accompanying materials are made available
     1.8 +* under the terms of "Eclipse Public License v1.0"
     1.9 +* which accompanies this distribution, and is available
    1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.11 +*
    1.12 +* Initial Contributors:
    1.13 +* Nokia Corporation - initial contribution.
    1.14 +*
    1.15 +* Contributors:
    1.16 +*
    1.17 +* Description: 
    1.18 +* The Open Font rasterizer plug-in Interface Definition class.
    1.19 +*
    1.20 +*/
    1.21 +
    1.22 +
    1.23 +#ifndef OPENFONTRASTERIZER_H
    1.24 +#define OPENFONTRASTERIZER_H
    1.25 +
    1.26 +#include <ecom/ecom.h>
    1.27 +
    1.28 +class COpenFontFile;
    1.29 +
    1.30 +/**
    1.31 +Supplied to COpenFontRasterizer::ExtendedInterface() to access the extended
    1.32 +API interface MOpenFontLinkedTypefaceExtension.
    1.33 +
    1.34 +@see	COpenFontRasterizer::ExtendedInterface()
    1.35 +@see	MOpenFontLinkedTypefaceExtension
    1.36 +@publishedPartner
    1.37 +@prototype
    1.38 +*/
    1.39 +const TUid KUidLinkedTypefaceRasterizerExtension = {0x10285EAA};
    1.40 +
    1.41 +/**
    1.42 +The Open Font rasterizer plug-in Interface Definition class. 
    1.43 +
    1.44 +This interface allows the implementation of an Open Font rasterizer plug-in,
    1.45 +which can then be dynamically loaded at run time by the ECOM plug-in framework. 
    1.46 +The plug-in implementation is instantiated by calling NewL(), passing the implementation 
    1.47 +UID so that ECOM can instantiate the correct implementation. 
    1.48 +
    1.49 +The rasterizer interface declares a single pure virtual functions, which the 
    1.50 +plug-in derived from this interface must implement. The function reads font files, and creates 
    1.51 +a COpenFontFile object if the font file is of the right type.
    1.52 +
    1.53 +Writing derived classes:
    1.54 +
    1.55 +Open font rasterizers should derive from this class and implement the 
    1.56 +NewFontFileL() function.
    1.57 +
    1.58 +Derived classes should also define the factory function. It is a static function 
    1.59 +which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it 
    1.60 +to the caller. This factory function, together with the implementation UID will form 
    1.61 +the TImplementationProxy used by the ECOM framework to instatiate the plug-in. 
    1.62 +
    1.63 +The rasterizer class may also need to store an 'engine context'. This is an 
    1.64 +object derived from COpenFontRasterizerContext, which provides functions that 
    1.65 +make it easier to write the glyph bitmap during rasterization.
    1.66 +
    1.67 +
    1.68 +@publishedPartner
    1.69 +@released
    1.70 +*/
    1.71 +class COpenFontRasterizer: public CBase
    1.72 +	{
    1.73 +public:
    1.74 +	/** Creates a COpenFontFile derived object for loading font files in the 
    1.75 +	new format. 
    1.76 +
    1.77 +	This function is called by the framework during font and bitmap server 
    1.78 +	startup. It creates a font file object for font files in the \\resource\\fonts 
    1.79 +	directory on all drives, using the default search path. The first font of 
    1.80 +	a given name overrides subsequent ones. The directory search path is soft 
    1.81 +	to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added 
    1.82 +	dynamically after startup using CWsScreenDevice::AddFile(), which 
    1.83 +	indirectly calls this function.
    1.84 +
    1.85 +	Implementations of this function should examine the file aFileName, and if 
    1.86 +	it is of the correct type attempt to create a COpenFontFile derived object 
    1.87 +	to load it. The caller is responsible for deleting the object. The function 
    1.88 +	must return NULL if it cannot recognise the file, and it may also leave if 
    1.89 +	there is an error. 
    1.90 +
    1.91 +	@param aUid An ID to be used for the file. UIDs are required by the font 
    1.92 +	framework, so the font store allocates them for non Symbian OS-native font 
    1.93 +	files. This ID persists until the font is unloaded, e.g. if the device is 
    1.94 +	rebooted.
    1.95 +	@param	aFileName		The full path and filename of the file from which the COpenFontFile
    1.96 +							object is created, if the file is the correct type.
    1.97 +	@param	aFileSession	The file session owned by the Font and Bitmap server. This file session 
    1.98 +							should be used for any file access. If COpenFontFile objects need to keep 
    1.99 +							files open, aFileSession should be stored in a place that is accessible to them. 
   1.100 +	@return	A pointer to a new COpenFontFile derived object, or NULL if the file type is not recognised.
   1.101 +	@see	CWsScreenDevice::AddFile() */
   1.102 +	virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0;
   1.103 +	inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid);
   1.104 +	inline virtual ~COpenFontRasterizer();
   1.105 +	IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam);
   1.106 +private:
   1.107 +	TUid iDtor_ID_Key;//ECOM identifier used during destruction
   1.108 +	};
   1.109 +
   1.110 +/** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface 
   1.111 +implementation given its implementation UID. 
   1.112 +
   1.113 +@param	aInterfaceImplUid	The UID of the interface implementation required
   1.114 +
   1.115 +@return	COpenFontRasterizer*	A pointer to a COpenFontRasterizer object. */
   1.116 +inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid)
   1.117 +{
   1.118 +	return reinterpret_cast <COpenFontRasterizer*> (
   1.119 +		REComSession::CreateImplementationL(
   1.120 +			aInterfaceImplUid,
   1.121 +			_FOFF(COpenFontRasterizer, iDtor_ID_Key))); 
   1.122 +}
   1.123 +
   1.124 +/** Default destructor */
   1.125 +inline COpenFontRasterizer::~COpenFontRasterizer()
   1.126 +{
   1.127 +	REComSession::DestroyedImplementation(iDtor_ID_Key);
   1.128 +}
   1.129 +
   1.130 +#endif /*OPENFONTRASTERIZER_H*/