2019-06-15 07:17:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
*
|
2019-08-10 11:27:59 +02:00
|
|
|
* otsvg.h
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
2019-08-10 11:27:59 +02:00
|
|
|
* Interface for OT-SVG support related things (specification).
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
|
|
|
* Copyright (C) 2004-2019 by
|
2019-07-01 21:15:50 +02:00
|
|
|
* David Turner, Robert Wilhelm, Werner Lemberg and Moazin Khatti.
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
|
|
|
* This file is part of the FreeType project, and may only be used,
|
|
|
|
* modified, and distributed under the terms of the FreeType project
|
|
|
|
* license, LICENSE.TXT. By continuing to use, modify, or distribute
|
|
|
|
* this file you indicate that you have read the license and
|
|
|
|
* understand and accept it fully.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef FTSVG_RENDERER_H_
|
|
|
|
#define FTSVG_RENDERER_H_
|
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_FREETYPE_H
|
|
|
|
|
|
|
|
#ifdef FREETYPE_H
|
|
|
|
#error "freetype.h of FreeType 1 has been loaded!"
|
|
|
|
#error "Please fix the directory search order for header files"
|
|
|
|
#error "so that freetype.h of FreeType 2 is found first."
|
|
|
|
#endif
|
|
|
|
|
|
|
|
FT_BEGIN_HEADER
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @functype:
|
2019-07-10 13:28:39 +02:00
|
|
|
* SVG_Lib_Init_Func
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A callback used to initiate the SVG Rendering port
|
|
|
|
*
|
2019-07-05 18:02:17 +02:00
|
|
|
* @input:
|
2019-07-10 10:58:59 +02:00
|
|
|
* library ::
|
2019-07-11 12:52:31 +02:00
|
|
|
* A instance of library. This is required to initialize the
|
|
|
|
* renderer's state which will be held in the library.
|
2019-07-05 18:02:17 +02:00
|
|
|
*
|
2019-06-15 07:17:47 +02:00
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0 means success.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef FT_Error
|
2019-07-10 13:28:39 +02:00
|
|
|
(*SVG_Lib_Init_Func)( FT_Library library );
|
2019-06-15 07:17:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @functype:
|
2019-07-10 13:28:39 +02:00
|
|
|
* SVG_Lib_Free_Func
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
|
|
|
* @description:
|
2019-07-11 12:52:31 +02:00
|
|
|
* A callback used to free the SVG Rendering port. Calling this callback
|
2019-06-15 07:17:47 +02:00
|
|
|
* shall do all cleanups that the SVG Rendering port wants to do.
|
|
|
|
*
|
2019-07-05 18:02:17 +02:00
|
|
|
* @input:
|
2019-07-10 10:58:59 +02:00
|
|
|
* library ::
|
2019-07-11 12:52:31 +02:00
|
|
|
* A instance of library. This is required to free the renderer's
|
|
|
|
* state which will be held in the library.
|
2019-06-15 07:17:47 +02:00
|
|
|
*/
|
|
|
|
|
2019-07-05 18:02:17 +02:00
|
|
|
typedef void
|
2019-07-10 13:28:39 +02:00
|
|
|
(*SVG_Lib_Free_Func)( FT_Library library );
|
2019-06-15 07:17:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @functype:
|
2019-07-10 13:28:39 +02:00
|
|
|
* SVG_Lib_Render_Func
|
2019-06-15 07:17:47 +02:00
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A callback used to render the glyph loaded in the slot.
|
|
|
|
*
|
|
|
|
* @input:
|
2019-07-06 12:38:37 +02:00
|
|
|
* slot ::
|
|
|
|
* The whole glyph slot object.
|
|
|
|
*
|
2019-06-15 07:17:47 +02:00
|
|
|
* @return:
|
|
|
|
* FreeType error code. 0 means success.
|
|
|
|
*/
|
|
|
|
|
|
|
|
typedef FT_Error
|
2019-08-06 20:32:41 +02:00
|
|
|
(*SVG_Lib_Render_Func)( FT_GlyphSlot slot );
|
2019-07-06 12:38:37 +02:00
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @functype:
|
2019-08-06 20:32:41 +02:00
|
|
|
* SVG_Lib_Preset_Slot_Func
|
2019-07-06 12:38:37 +02:00
|
|
|
*
|
|
|
|
* @description:
|
2019-08-06 20:32:41 +02:00
|
|
|
* A callback which is to preset the glyphslot.
|
2019-07-06 12:38:37 +02:00
|
|
|
*
|
|
|
|
* @input:
|
|
|
|
* slot ::
|
2019-08-06 20:32:41 +02:00
|
|
|
* The glyph slot which has the SVG document loaded.
|
2019-07-06 12:38:37 +02:00
|
|
|
*
|
|
|
|
* @return:
|
2019-08-06 20:32:41 +02:00
|
|
|
* FreeType error code. 0 means success.
|
2019-07-06 12:38:37 +02:00
|
|
|
*/
|
|
|
|
|
2019-08-06 20:32:41 +02:00
|
|
|
typedef FT_Error
|
|
|
|
(*SVG_Lib_Preset_Slot_Func)( FT_GlyphSlot slot, FT_Bool cache);
|
|
|
|
|
2019-06-15 07:17:47 +02:00
|
|
|
|
2019-07-17 21:05:49 +02:00
|
|
|
typedef struct SVG_RendererHooks_
|
|
|
|
{
|
|
|
|
/* Api Hooks for OT-SVG Rendering */
|
|
|
|
SVG_Lib_Init_Func init_svg;
|
|
|
|
SVG_Lib_Free_Func free_svg;
|
|
|
|
SVG_Lib_Render_Func render_svg;
|
|
|
|
|
2019-08-06 20:32:41 +02:00
|
|
|
SVG_Lib_Preset_Slot_Func preset_slot;
|
2019-07-17 21:05:49 +02:00
|
|
|
} SVG_RendererHooks;
|
|
|
|
|
2019-08-06 20:32:41 +02:00
|
|
|
|
2019-06-20 21:18:24 +02:00
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @struct:
|
|
|
|
* FT_SVG_DocumentRec_
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A structure that models one SVG document.
|
|
|
|
*
|
|
|
|
* @fields:
|
|
|
|
* svg_document ::
|
|
|
|
* A pointer to the SVG document string.
|
|
|
|
*
|
|
|
|
* svg_document_length ::
|
|
|
|
* The length of the SVG document string.
|
2019-06-23 15:02:55 +02:00
|
|
|
*
|
|
|
|
* metrics ::
|
|
|
|
* A metrics object storing the size information.
|
2019-06-23 21:33:45 +02:00
|
|
|
*
|
|
|
|
* units_per_EM ::
|
|
|
|
* The size of the EM square.
|
|
|
|
*
|
2019-06-24 16:34:37 +02:00
|
|
|
* start_glyph_id ::
|
|
|
|
* The starting glyph ID for the glyph range that this document has.
|
|
|
|
*
|
|
|
|
* end_glyph_id ::
|
|
|
|
* The ending glyph ID for the glyph range that this document has.
|
|
|
|
*
|
2019-06-23 21:33:45 +02:00
|
|
|
* @note:
|
2019-07-11 12:52:31 +02:00
|
|
|
* `metrics` and `units_per_EM` might look like repetitions since both
|
2019-08-10 13:20:59 +02:00
|
|
|
* fields are stored in face object, but they are not; When the slot is
|
|
|
|
* passed down to a renderer, the renderer can only access the `metrics`
|
|
|
|
* and `units_per_EM` by `slot->face`. However, when `FT_Glyph_To_Bitmap`
|
|
|
|
* sets up a dummy object, it has no way to set a `face` object. Thus,
|
|
|
|
* metrics information and units_per_EM (which is necessary for OT-SVG)
|
|
|
|
* has to be stored separately.
|
2019-06-20 21:18:24 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
typedef struct FT_SVG_DocumentRec_
|
|
|
|
{
|
2019-06-22 13:36:29 +02:00
|
|
|
FT_Byte* svg_document;
|
|
|
|
FT_ULong svg_document_length;
|
|
|
|
FT_Size_Metrics metrics;
|
2019-06-23 21:33:45 +02:00
|
|
|
FT_UShort units_per_EM;
|
2019-06-24 16:34:37 +02:00
|
|
|
FT_UShort start_glyph_id;
|
|
|
|
FT_UShort end_glyph_id;
|
2019-06-20 21:18:24 +02:00
|
|
|
} FT_SVG_DocumentRec;
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
*
|
|
|
|
* @type:
|
|
|
|
* FT_SVG_Document
|
|
|
|
*
|
|
|
|
* @description:
|
|
|
|
* A handle to a FT_SVG_DocumentRec object.
|
|
|
|
*/
|
|
|
|
typedef struct FT_SVG_DocumentRec_* FT_SVG_Document;
|
|
|
|
|
2019-06-15 07:17:47 +02:00
|
|
|
FT_END_HEADER
|
|
|
|
#endif
|