diff -r 4816d766a08a -r f345bda72bc4 Symbian3/PDK/Source/GUID-F477E82D-2929-5C69-BF6D-A69A61AC9EA5.dita --- a/Symbian3/PDK/Source/GUID-F477E82D-2929-5C69-BF6D-A69A61AC9EA5.dita Tue Mar 30 11:42:04 2010 +0100 +++ b/Symbian3/PDK/Source/GUID-F477E82D-2929-5C69-BF6D-A69A61AC9EA5.dita Tue Mar 30 11:56:28 2010 +0100 @@ -1,106 +1,106 @@ - - - - - -Creating -a Font Rasterizer Plug-in -
Overview

The steps required to write a font rasterizer -DLL are:

    -
  • Implement an exported NewL() factory -function to create rasterizer objects (which you derive from COpenFontRasterizer). -You may choose to implement this as part of your rasterizer object.

  • -
  • Write a class derived -from COpenFontRasterizer. This will need to store any context -associated with the rasterization process rather than with individual typefaces. -It also implements a function to create your COpenFontFile derived -objects.

  • -
  • Write a class derived -from COpenFontFile. This class manages a single file representing -a typeface.

  • -
  • Write a class derived -from COpenFont.

  • -
  • Place all the code into -a DLL of the right type and provide an exported function to create the rasterizer -object.

  • -

Deriving from COpenFontRasterizer, COpenFontFile and COpenFont are -discussed in the "See also" topics below. This section describes the operations -required to package the code as a polymorphic DLL.

For more information, -see:

    -
  • Deriving -from COpenFontRasterizer

  • -
  • Deriving -from COpenFontFile

  • -
  • Deriving -from COpenFont

  • -
  • Deriving -from COpenFontRasterizerContext

  • -
-
The DLL

A font rasterizer DLL is an ordinary Symbian -polymorphic DLL. It exports just one function and has no unusual behavior.

In -particular, it must have no writable static data. This is an important constraint -on the use of code from outside sources. See Static -Data for more information.

-
The exported -function

The exported function is a factory function that creates -objects of a class derived from COpenFontRasterizer. It will -be called just once — when the Font and Bitmap Server loads the DLL.

Although -the name of the function does not matter because it is loaded by ordinal, -implementers should follow the practice of making it a static member of the -rasterizer class, called NewL(). Therefore, if the rasterizer -class is CExampleRasterizer (derived from COpenFontRasterizer), -the exported function is:

static COpenFontRasterizer* CExampleRasterizer::NewL()

The function must take no arguments. It must create a COpenFontRasterizer derived -object on the heap, returning it to the caller. The caller is responsible -for deleting the object. As the name of the example function suggests, it -is allowed to leave.

Example

The exported function -used in the FreeType rasterizer is given below:

EXPORT_C COpenFontRasterizer* CFreeTypeRasterizer::NewL() - { - CFreeTypeRasterizer* r = new(ELeave) CFreeTypeRasterizer; - CleanupStack::PushL( r ); - r->iContext = CFreeTypeContext::NewL(); - CleanupStack::Pop(); - return r; - } -
-
Project file

The name of the rasterizer DLL, its -type, and its UIDs are all specified in the MMP file. Note that:

    -
  • All capabilities except -TCB (Trusted Computing Base) are required.

  • -
  • The targettype must -be PLUGIN .

  • -
  • The UID line -identifies the project's UID2 and UID3 values. UID2 must be 0x10009D8D, -which identifies the DLL as an ECOM plug-in. UID3 must be 0x100012A7, -which identifies the ECOM plug-in as a font rasterizer.

  • -

Example

A fragment of the project file for the freetype -DLL is given below.

target freetype.dll -CAPABILITY All -Tcb -targettype PLUGIN -UID 0x10003B1F 0x100012A7
-
Header files

Font rasterizer DLLs must #include the -following header files, which are located in the standard include directory \epoc32\include\:

    -
  • openfont.h for -the Font Store classes

  • -
  • e32uid.h for -the UID value for a dynamic library

  • -
  • f32file.h for -the file handling classes

  • -
-
-Deriving -from COpenFontRasterizer -Deriving -from COpenFontFile -Deriving -from COpenFont -Deriving -from COpenFontRasterizerContext -Static data - + + + + + +Creating +a Font Rasterizer Plug-in +
Overview

The steps required to write a font rasterizer +DLL are:

    +
  • Implement an exported NewL() factory +function to create rasterizer objects (which you derive from COpenFontRasterizer). +You may choose to implement this as part of your rasterizer object.

  • +
  • Write a class derived +from COpenFontRasterizer. This will need to store any context +associated with the rasterization process rather than with individual typefaces. +It also implements a function to create your COpenFontFile derived +objects.

  • +
  • Write a class derived +from COpenFontFile. This class manages a single file representing +a typeface.

  • +
  • Write a class derived +from COpenFont.

  • +
  • Place all the code into +a DLL of the right type and provide an exported function to create the rasterizer +object.

  • +

Deriving from COpenFontRasterizer, COpenFontFile and COpenFont are +discussed in the "See also" topics below. This section describes the operations +required to package the code as a polymorphic DLL.

For more information, +see:

    +
  • Deriving +from COpenFontRasterizer

  • +
  • Deriving +from COpenFontFile

  • +
  • Deriving +from COpenFont

  • +
  • Deriving +from COpenFontRasterizerContext

  • +
+
The DLL

A font rasterizer DLL is an ordinary Symbian +polymorphic DLL. It exports just one function and has no unusual behavior.

In +particular, it must have no writable static data. This is an important constraint +on the use of code from outside sources. See Static +Data for more information.

+
The exported +function

The exported function is a factory function that creates +objects of a class derived from COpenFontRasterizer. It will +be called just once — when the Font and Bitmap Server loads the DLL.

Although +the name of the function does not matter because it is loaded by ordinal, +implementers should follow the practice of making it a static member of the +rasterizer class, called NewL(). Therefore, if the rasterizer +class is CExampleRasterizer (derived from COpenFontRasterizer), +the exported function is:

static COpenFontRasterizer* CExampleRasterizer::NewL()

The function must take no arguments. It must create a COpenFontRasterizer derived +object on the heap, returning it to the caller. The caller is responsible +for deleting the object. As the name of the example function suggests, it +is allowed to leave.

Example

The exported function +used in the FreeType rasterizer is given below:

EXPORT_C COpenFontRasterizer* CFreeTypeRasterizer::NewL() + { + CFreeTypeRasterizer* r = new(ELeave) CFreeTypeRasterizer; + CleanupStack::PushL( r ); + r->iContext = CFreeTypeContext::NewL(); + CleanupStack::Pop(); + return r; + } +
+
Project file

The name of the rasterizer DLL, its +type, and its UIDs are all specified in the MMP file. Note that:

    +
  • All capabilities except +TCB (Trusted Computing Base) are required.

  • +
  • The targettype must +be PLUGIN .

  • +
  • The UID line +identifies the project's UID2 and UID3 values. UID2 must be 0x10009D8D, +which identifies the DLL as an ECOM plug-in. UID3 must be 0x100012A7, +which identifies the ECOM plug-in as a font rasterizer.

  • +

Example

A fragment of the project file for the freetype +DLL is given below.

target freetype.dll +CAPABILITY All -Tcb +targettype PLUGIN +UID 0x10003B1F 0x100012A7
+
Header files

Font rasterizer DLLs must #include the +following header files, which are located in the standard include directory \epoc32\include\:

    +
  • openfont.h for +the Font Store classes

  • +
  • e32uid.h for +the UID value for a dynamic library

  • +
  • f32file.h for +the file handling classes

  • +
+
+Deriving +from COpenFontRasterizer +Deriving +from COpenFontFile +Deriving +from COpenFont +Deriving +from COpenFontRasterizerContext +Static data +
\ No newline at end of file