Initial revision

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2035 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2002-11-20 19:13:09 +00:00
parent af04ec0bfd
commit 68880b2171
5 changed files with 703 additions and 0 deletions
+86
View File
@@ -0,0 +1,86 @@
/***************************************************************************/
/* */
/* ftgzip.h */
/* */
/* Gzip-compressed stream support. */
/* */
/* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 __FTXF86_H__
#define __FTXF86_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* gzip */
/* */
/* <Title> */
/* GZIP Streams */
/* */
/* <Abstract> */
/* Using gzip-compressed font files */
/* */
/* <Description> */
/* This section contains the declaration of Gzip-specific functions. */
/* */
/*************************************************************************/
/************************************************************************
*
* @type: FT_Stream_OpenGzip
*
* @description:
* open a new stream to parse gzip-compressed font files. This is
* mainly used to support the compressed *.pcf.gz fonts that come
* with XFree86
*
* @input:
* stream :: target embedding stream
* source :: source stream, used to
*
* @return:
* error code. 0 means success
*
* @note:
* the source stream must be opened _before_ calling this function.
*
* calling @FT_Stream_Close on the new stream will *not* call
* @FT_Stream_Close on the source stream. None of the stream objects
* will be released to the heap.
*
* the stream implementation is very basic, and resets the decompression
* process each time seeking backwards is needed within the stream
*
* in certain builds of the library, gzip compression recognition is
* automatic when calling @FT_New_Face or @FT_Open_Face. This means that
* if no font driver is capable of handling the raw compressed file,
* the library will try to open a gzip stream from it and re-open
* the face with it.
*
* this function may return "FT_Err_Unimplemented" if your build of
* FreeType was not compiled with zlib support.
*/
FT_EXPORT( FT_Error )
FT_Stream_OpenGzip( FT_Stream stream,
FT_Stream source );
/* */
FT_END_HEADER
#endif /* __FTXF86_H__ */
+286
View File
@@ -0,0 +1,286 @@
/***************************************************************************/
/* */
/* ftincrem.h */
/* */
/* FreeType incremental loading (specification). */
/* */
/* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 __FTINCREM_H__
#define __FTINCREM_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/***************************************************************************
*
* @type:
* FT_Incremental
*
* @description:
* An opaque type describing a user-provided object used to implement
* "incremental" glyph loading within FreeType. This is used to support
* embedded fonts in certain environments (e.g. Postscript interpreters),
* where the glyph data isn't in the font file, or must be overridden by
* different values.
*
* @note:
* It is up to client applications to create and implement @FT_Incremental
* objects, as long as they provide implementations for the methods
* @FT_Incremental_GetGlyphDataFunc, @FT_Incremental_FreeGlyphDataFunc
* and @FT_Incremental_GetGlyphMetricsFunc.
*
* See the description of @FT_Incremental_InterfaceRec to understand how
* to use incremental objects with FreeType.
*/
typedef struct FT_IncrementalRec_* FT_Incremental;
/***************************************************************************
*
* @struct:
* FT_Incremental_Metrics
*
* @description:
* A small structure used to contain the basic glyph metrics returned
* by the @FT_Incremental_GetGlyphMetricsFunc method.
*
* @fields:
* bearing_x ::
* Left bearing, in font units.
*
* bearing_y ::
* Top bearing, in font units.
*
* advance ::
* Glyph advance, in font units.
*
* @note:
* These correspond to horizontal or vertical metrics depending on the
* value of the 'vertical' argument to the function
* @FT_Incremental_GetGlyphMetricsFunc.
*/
typedef struct FT_Incremental_MetricsRec_
{
FT_Long bearing_x;
FT_Long bearing_y;
FT_Long advance;
} FT_Incremental_MetricsRec, *FT_Incremental_Metrics;
/***************************************************************************
*
* @type:
* FT_Incremental_GetGlyphDataFunc
*
* @description:
* A function called by FreeType to access a given glyph's data bytes
* during @FT_Load_Glyph or @FT_Load_Char if incremental loading is
* enabled.
*
* Note that the format of the glyph's data bytes depends on the font
* file format. For TrueType, it must correspond to the raw bytes within
* the 'glyf' table. For Postscript formats, it must correspond to the
* *unencrypted* charstring bytes, without any 'lenIV' header. It is
* undefined for any other format.
*
* @input:
* incremental ::
* Handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* glyph_index ::
* Index of relevant glyph.
*
* @output:
* adata ::
* A structure describing the returned glyph data bytes (which will be
* accessed as a read-only byte block).
*
* @return:
* FreeType error code. 0 means success.
*
* @note:
* If this function returns succesfully the method
* @FT_Incremental_FreeGlyphDataFunc will be called later to release
* the data bytes.
*
* Nested calls to @FT_Incremental_GetGlyphDataFunc can happen for
* compound glyphs.
*/
typedef FT_Error
(*FT_Incremental_GetGlyphDataFunc)( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Data* adata );
/***************************************************************************
*
* @type:
* FT_Incremental_FreeGlyphDataFunc
*
* @description:
* A function used to release the glyph data bytes returned by a
* successful call to @FT_Incremental_GetGlyphDataFunc.
*
* @input:
* incremental ::
* A handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* data ::
* A structure describing the glyph data bytes (which will be accessed
* as a read-only byte block).
*/
typedef void
(*FT_Incremental_FreeGlyphDataFunc)( FT_Incremental incremental,
FT_Data* data );
/***************************************************************************
*
* @type:
* FT_Incremental_GetGlyphMetricsFunc
*
* @description:
* A function used to retrieve the basic metrics of a given glyph index
* before accessing its data. This is necessary because, in certain
* formats like TrueType, the metrics are stored in a different place from
* the glyph images proper.
*
* @input:
* incremental ::
* A handle to an opaque @FT_Incremental handle provided by the client
* application.
*
* glyph_index ::
* Index of relevant glyph.
*
* vertical ::
* If true, return vertical metrics.
*
* @output:
* ametrics ::
* The glyph metrics in font units.
*
* afound ::
* True if there are metrics at all.
*
*/
typedef FT_Error
(*FT_Incremental_GetGlyphMetricsFunc)
( FT_Incremental incremental,
FT_UInt glyph_index,
FT_Bool vertical,
FT_Incremental_MetricsRec *ametrics,
FT_Bool *afound );
/**************************************************************************
*
* @struct:
* FT_Incremental_FuncsRec
*
* @description:
* A table of functions for accessing fonts that load data
* incrementally. Used in @FT_Incremental_Interface.
*
* @fields:
* get_glyph_data ::
* The function to get glyph data. Must not be null.
*
* free_glyph_data ::
* The function to release glyph data. Must not be null.
*
* get_glyph_metrics ::
* The function to get glyph metrics. May be null if the font does
* not provide overriding glyph metrics.
*/
typedef struct FT_Incremental_FuncsRec_
{
FT_Incremental_GetGlyphDataFunc get_glyph_data;
FT_Incremental_FreeGlyphDataFunc free_glyph_data;
FT_Incremental_GetGlyphMetricsFunc get_glyph_metrics;
} FT_Incremental_FuncsRec;
/***************************************************************************
*
* @struct:
* FT_Incremental_InterfaceRec
*
* @description:
* A structure to be used with @FT_Open_Face to indicate that the user
* wants to support incremental glyph loading. You should use it with
* @FT_PARAM_TAG_INCREMENTAL as in the following example:
*
* {
* FT_Incremental_InterfaceRec inc_int;
* FT_Parameter parameter;
* FT_Open_Args open_args;
*
*
* // set up incremental descriptor
* inc_int.funcs = my_funcs;
* inc_int.object = my_object;
*
* // set up optional parameter
* parameter.tag = FT_PARAM_TAG_INCREMENTAL;
* parameter.data = &inc_int;
*
* // set up FT_Open_Args structure
* open_args.flags = (FT_Open_Flags)( FT_OPEN_PATHNAME |
* FT_OPEN_PARAMS );
* open_args.pathname = my_font_pathname;
* open_args.num_params = 1;
* open_args.params = &parameter; // we use one optional argument
*
* // open the font
* error = FT_Open_Face( library, &open_args, index, &face );
* ...
* }
*/
typedef struct FT_Incremental_InterfaceRec_
{
const FT_Incremental_FuncsRec* funcs;
FT_Incremental object;
} FT_Incremental_InterfaceRec;
/***************************************************************************
*
* @constant:
* FT_PARAM_TAG_INCREMENTAL
*
* @description:
* A constant used as the tag of @FT_Parameter structures to indicate
* an incremental loading object to be used by FreeType.
*
*/
#define FT_PARAM_TAG_INCREMENTAL FT_MAKE_TAG( 'i', 'n', 'c', 'r' )
/* */
FT_END_HEADER
#endif /* __FTINCREM_H__ */
/* END */
+156
View File
@@ -0,0 +1,156 @@
/***************************************************************************/
/* */
/* ftpfr.h */
/* */
/* FreeType API for accessing PFR-specific data */
/* */
/* Copyright 2002 by */
/* David Turner, Robert Wilhelm, and Werner Lemberg. */
/* */
/* 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 __FTPFR_H__
#define __FTPFR_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
/*************************************************************************/
/* */
/* <Section> */
/* pfr_fonts */
/* */
/* <Title> */
/* PFR Fonts */
/* */
/* <Abstract> */
/* PFR/TrueDoc specific APIs */
/* */
/* <Description> */
/* This section contains the declaration of PFR-specific functions. */
/* */
/*************************************************************************/
/**********************************************************************
*
* @function:
* FT_Get_PFR_Metrics
*
* @description:
* returns the outline and metrics resolutions of a given PFR
* face.
*
* @input:
* face :: handle to input face. It can be a non-PFR face.
*
* @output:
* aoutline_resolution ::
* outline resolution. This is equivalent to "face->units_per_EM".
* optional (parameter can be NULL)
*
* ametrics_resolution ::
* metrics_resolution. This is equivalent to "outline_resolution"
* for non-PFR fonts. can be NULL
* optional (parameter can be NULL)
*
* ametrics_x_scale ::
* a 16.16 fixed-point number used to scale distance expressed
* in metrics units to device sub-pixels. This is equivalent to
* 'face->size->x_scale', but for metrics only.
* optional (parameter can be NULL)
*
* ametrics_y_scale ::
* same as 'ametrics_x_scale', but for the vertical direction.
* optional (parameter can be NULL)
*
* @note:
* if the input face is not a PFR, this function will return an error.
* However, in all cases, it will return valid values.
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Metrics( FT_Face face,
FT_UInt *aoutline_resolution,
FT_UInt *ametrics_resolution,
FT_Fixed *ametrics_x_scale,
FT_Fixed *ametrics_y_scale );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Kerning
*
* @description:
* returns the kerning pair corresponding to two glyphs in
* a PFR face. The distance is expressed in metrics units, unlike
* the result of @FT_Get_Kerning.
*
* @input:
* face :: handle to input face.
* left :: left glyph index
* right :: right glyph index
*
* @output:
* avector :: kerning vector
*
* @note:
* this function always return distances in original PFR metrics
* units. This is unlike @FT_Get_Kerning with the @FT_KERNING_UNSCALED
* mode, which always return distances converted to outline units.
*
* you can use the value of the 'x_scale' and 'y_scale' parameters
* returned by @FT_Get_PFR_Metrics to scale these to device sub-pixels
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Kerning( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
/**********************************************************************
*
* @function:
* FT_Get_PFR_Advance
*
* @description:
* returns a given glyph advance, expressed in original metrics units,
* from a PFR font.
*
* @input:
* face :: handle to input face.
* gindex :: glyph index
*
* @output:
* aadvance :: glyph advance in metrics units
*
* @return:
* error code. 0 means success
*
* @note:
* you can use the 'x_scale' or 'y_scale' results of @FT_Get_PFR_Metrics
* to convert the advance to device sub-pixels (i.e. 1/64th of pixels)
*/
FT_EXPORT( FT_Error )
FT_Get_PFR_Advance( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
/* */
FT_END_HEADER
#endif /* __FTBDF_H__ */
/* END */
+139
View File
@@ -0,0 +1,139 @@
#ifndef __FT_STROKER_H__
#define __FT_STROKER_H__
#include <ft2build.h>
#include FT_OUTLINE_H
FT_BEGIN_HEADER
/*@*************************************************************
*
* @type: FT_Stroker
*
* @description:
* opaque handler to a path stroker object
*/
typedef struct FT_StrokerRec_* FT_Stroker;
/*@*************************************************************
*
* @enum: FT_Stroker_LineJoin
*
* @description:
* these values determine how two joining lines are rendered
* in a stroker.
*
* @values:
* FT_STROKER_LINEJOIN_ROUND ::
* used to render rounded line joins. circular arcs are used
* to join two lines smoothly
*
* FT_STROKER_LINEJOIN_BEVEL ::
* used to render beveled line joins; i.e. the two joining lines
* are extended until they intersect
*
* FT_STROKER_LINEJOIN_MITER ::
* same as beveled rendering, except that an additional line
* break is added if the angle between the two joining lines
* is too closed (this is useful to avoid unpleasant spikes
* in beveled rendering).
*/
typedef enum
{
FT_STROKER_LINEJOIN_ROUND = 0,
FT_STROKER_LINEJOIN_BEVEL,
FT_STROKER_LINEJOIN_MITER
} FT_Stroker_LineJoin;
/*@*************************************************************
*
* @enum: FT_Stroker_LineCap
*
* @description:
* these values determine how the end of opened sub-paths are
* rendered in a stroke
*
* @values:
* FT_STROKER_LINECAP_BUTT ::
* the end of lines is rendered as a full stop on the last
* point itself
*
* FT_STROKER_LINECAP_ROUND ::
* the end of lines is rendered as a half-circle around the
* last point
*
* FT_STROKER_LINECAP_SQUARE ::
* the end of lines is rendered as a square around the
* last point
*/
typedef enum
{
FT_STROKER_LINECAP_BUTT = 0,
FT_STROKER_LINECAP_ROUND,
FT_STROKER_LINECAP_SQUARE
} FT_Stroker_LineCap;
/* */
FT_EXPORT( FT_Error )
FT_Stroker_New( FT_Memory memory,
FT_Stroker *astroker );
FT_EXPORT( void )
FT_Stroker_Set( FT_Stroker stroker,
FT_Fixed radius,
FT_Stroker_LineCap line_cap,
FT_Stroker_LineJoin line_join,
FT_Fixed miter_limit );
FT_EXPORT( FT_Error )
FT_Stroker_ParseOutline( FT_Stroker stroker,
FT_Outline* outline,
FT_Bool opened );
FT_EXPORT( FT_Error )
FT_Stroker_BeginSubPath( FT_Stroker stroker,
FT_Vector* to,
FT_Bool open );
FT_EXPORT( FT_Error )
FT_Stroker_EndSubPath( FT_Stroker stroker );
FT_EXPORT( FT_Error )
FT_Stroker_LineTo( FT_Stroker stroker,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_ConicTo( FT_Stroker stroker,
FT_Vector* control,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_CubicTo( FT_Stroker stroker,
FT_Vector* control1,
FT_Vector* control2,
FT_Vector* to );
FT_EXPORT( FT_Error )
FT_Stroker_GetCounts( FT_Stroker stroker,
FT_UInt *anum_points,
FT_UInt *anum_contours );
FT_EXPORT( void )
FT_Stroker_Export( FT_Stroker stroker,
FT_Outline* outline );
FT_EXPORT( void )
FT_Stroker_Done( FT_Stroker stroker );
FT_END_HEADER
#endif /* __FT_STROKER_H__ */
@@ -0,0 +1,36 @@
#ifndef __FT_INTERNAL_PFR_H__
#define __FT_INTERNAL_PFR_H__
#include <ft2build.h>
#include FT_FREETYPE_H
FT_BEGIN_HEADER
typedef FT_Error (*FT_PFR_GetMetricsFunc)( FT_Face face,
FT_UInt *aoutline,
FT_UInt *ametrics,
FT_Fixed *ax_scale,
FT_Fixed *ay_scale );
typedef FT_Error (*FT_PFR_GetKerningFunc)( FT_Face face,
FT_UInt left,
FT_UInt right,
FT_Vector *avector );
typedef FT_Error (*FT_PFR_GetAdvanceFunc)( FT_Face face,
FT_UInt gindex,
FT_Pos *aadvance );
typedef struct FT_PFR_ServiceRec_
{
FT_PFR_GetMetricsFunc get_metrics;
FT_PFR_GetKerningFunc get_kerning;
FT_PFR_GetAdvanceFunc get_advance;
} FT_PFR_ServiceRec, *FT_PFR_Service;
#define FT_PFR_SERVICE_NAME "pfr"
FT_END_HEADER
#endif /* __FT_INTERNAL_PFR_H__ */