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