sl@0: /* sl@0: * Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * The Open Font rasterizer plug-in Interface Definition class. sl@0: * sl@0: */ sl@0: sl@0: sl@0: #ifndef OPENFONTRASTERIZER_H sl@0: #define OPENFONTRASTERIZER_H sl@0: sl@0: #include sl@0: sl@0: class COpenFontFile; sl@0: sl@0: /** sl@0: Supplied to COpenFontRasterizer::ExtendedInterface() to access the extended sl@0: API interface MOpenFontLinkedTypefaceExtension. sl@0: sl@0: @see COpenFontRasterizer::ExtendedInterface() sl@0: @see MOpenFontLinkedTypefaceExtension sl@0: @publishedPartner sl@0: @prototype sl@0: */ sl@0: const TUid KUidLinkedTypefaceRasterizerExtension = {0x10285EAA}; sl@0: sl@0: /** sl@0: The Open Font rasterizer plug-in Interface Definition class. sl@0: sl@0: This interface allows the implementation of an Open Font rasterizer plug-in, sl@0: which can then be dynamically loaded at run time by the ECOM plug-in framework. sl@0: The plug-in implementation is instantiated by calling NewL(), passing the implementation sl@0: UID so that ECOM can instantiate the correct implementation. sl@0: sl@0: The rasterizer interface declares a single pure virtual functions, which the sl@0: plug-in derived from this interface must implement. The function reads font files, and creates sl@0: a COpenFontFile object if the font file is of the right type. sl@0: sl@0: Writing derived classes: sl@0: sl@0: Open font rasterizers should derive from this class and implement the sl@0: NewFontFileL() function. sl@0: sl@0: Derived classes should also define the factory function. It is a static function sl@0: which takes no arguments. It creates a COpenFontRasterizer derived object on the heap, and returns it sl@0: to the caller. This factory function, together with the implementation UID will form sl@0: the TImplementationProxy used by the ECOM framework to instatiate the plug-in. sl@0: sl@0: The rasterizer class may also need to store an 'engine context'. This is an sl@0: object derived from COpenFontRasterizerContext, which provides functions that sl@0: make it easier to write the glyph bitmap during rasterization. sl@0: sl@0: sl@0: @publishedPartner sl@0: @released sl@0: */ sl@0: class COpenFontRasterizer: public CBase sl@0: { sl@0: public: sl@0: /** Creates a COpenFontFile derived object for loading font files in the sl@0: new format. sl@0: sl@0: This function is called by the framework during font and bitmap server sl@0: startup. It creates a font file object for font files in the \\resource\\fonts sl@0: directory on all drives, using the default search path. The first font of sl@0: a given name overrides subsequent ones. The directory search path is soft sl@0: to hard: Y:, X:, W:, ..., C:, B:, A:, Z:. Files may also be added sl@0: dynamically after startup using CWsScreenDevice::AddFile(), which sl@0: indirectly calls this function. sl@0: sl@0: Implementations of this function should examine the file aFileName, and if sl@0: it is of the correct type attempt to create a COpenFontFile derived object sl@0: to load it. The caller is responsible for deleting the object. The function sl@0: must return NULL if it cannot recognise the file, and it may also leave if sl@0: there is an error. sl@0: sl@0: @param aUid An ID to be used for the file. UIDs are required by the font sl@0: framework, so the font store allocates them for non Symbian OS-native font sl@0: files. This ID persists until the font is unloaded, e.g. if the device is sl@0: rebooted. sl@0: @param aFileName The full path and filename of the file from which the COpenFontFile sl@0: object is created, if the file is the correct type. sl@0: @param aFileSession The file session owned by the Font and Bitmap server. This file session sl@0: should be used for any file access. If COpenFontFile objects need to keep sl@0: files open, aFileSession should be stored in a place that is accessible to them. sl@0: @return A pointer to a new COpenFontFile derived object, or NULL if the file type is not recognised. sl@0: @see CWsScreenDevice::AddFile() */ sl@0: virtual COpenFontFile* NewFontFileL(TInt aUid,const TDesC& aFileName,RFs& aFileSession) = 0; sl@0: inline static COpenFontRasterizer* NewL(TUid aInterfaceImplUid); sl@0: inline virtual ~COpenFontRasterizer(); sl@0: IMPORT_C virtual void ExtendedInterface(TUid aUid, TAny*& aParam); sl@0: private: sl@0: TUid iDtor_ID_Key;//ECOM identifier used during destruction sl@0: }; sl@0: sl@0: /** Uses ECOM plug-in framework to instantiate the Open Font rasterizer interface sl@0: implementation given its implementation UID. sl@0: sl@0: @param aInterfaceImplUid The UID of the interface implementation required sl@0: sl@0: @return COpenFontRasterizer* A pointer to a COpenFontRasterizer object. */ sl@0: inline COpenFontRasterizer* COpenFontRasterizer::NewL(TUid aInterfaceImplUid) sl@0: { sl@0: return reinterpret_cast ( sl@0: REComSession::CreateImplementationL( sl@0: aInterfaceImplUid, sl@0: _FOFF(COpenFontRasterizer, iDtor_ID_Key))); sl@0: } sl@0: sl@0: /** Default destructor */ sl@0: inline COpenFontRasterizer::~COpenFontRasterizer() sl@0: { sl@0: REComSession::DestroyedImplementation(iDtor_ID_Key); sl@0: } sl@0: sl@0: #endif /*OPENFONTRASTERIZER_H*/