2000-06-16 08:49:56 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* cidgload.c */
|
|
|
|
/* */
|
|
|
|
/* CID-keyed Type1 Glyph Loader (body). */
|
|
|
|
/* */
|
|
|
|
/* Copyright 1996-2000 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. */
|
|
|
|
/* */
|
|
|
|
/***************************************************************************/
|
2000-06-01 05:27:48 +02:00
|
|
|
|
A complete revision of FreeType 2's GNU makefiles (of the library):
Tons of unnecessary stuff have been removed; only the essential rules
have been retained.
The source files now depend on all header files in include/freetype,
include/freetype/config, and include/freetype/internal. This is not
optimal, I know, and I'll try to improve this, but it is better than
before (namely no dependencies on `internal').
FTDEBUG_SRC has been added (similar to FTSYS_SRC) -- I don't know
exactly whether this is really useful, but it doesn't harm.
There is now more documentation in the makefiles itself.
io-frames.html: Use of <th>, <code>, and <var> for better tagging.
Reactivating of FT_DEBUG_LEVEL_xxx macros.
Added a lot of #include directives to make `multi' builds possible -- note
that currently the modules cid, t1, and t1z have clashing structures and
functions which means that you can only use one of these three modules for a
multi build.
Added some missing function declarations to (local) header files.
Renamed some T1_Open_Face() to CID_Open_Face() in the cid module -- a lot
of other functions should be renamed also...
Replaced many FT_xxx stuff with T1_xxx in t1z driver -- this isn't finished
yet...
Fixed FT_Free() to allow a NULL pointer without an assertion (this has
always been a valid assumption in FreeType, at least in FT 1.x).
A lot of other, minor fixes (mostly documentation).
2000-06-11 05:46:57 +02:00
|
|
|
|
|
|
|
#include <cidload.h>
|
2000-06-01 05:27:48 +02:00
|
|
|
#include <cidgload.h>
|
|
|
|
#include <freetype/internal/ftdebug.h>
|
|
|
|
#include <freetype/internal/ftstream.h>
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* The macro FT_COMPONENT is used in trace mode. It is an implicit */
|
|
|
|
/* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log */
|
|
|
|
/* messages during execution. */
|
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
#undef FT_COMPONENT
|
2000-06-16 08:49:56 +02:00
|
|
|
#define FT_COMPONENT trace_cidgload
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* forward */
|
2000-06-01 05:27:48 +02:00
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error cid_load_glyph( CID_Decoder* decoder,
|
|
|
|
FT_UInt glyph_index );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
typedef enum T1_Operator_
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
op_none = 0,
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
op_endchar,
|
|
|
|
op_hsbw,
|
|
|
|
op_seac,
|
|
|
|
op_sbw,
|
|
|
|
op_closepath,
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
op_hlineto,
|
|
|
|
op_hmoveto,
|
|
|
|
op_hvcurveto,
|
|
|
|
op_rlineto,
|
|
|
|
op_rmoveto,
|
|
|
|
op_rrcurveto,
|
|
|
|
op_vhcurveto,
|
|
|
|
op_vlineto,
|
|
|
|
op_vmoveto,
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
op_dotsection,
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
op_hstem,
|
|
|
|
op_hstem3,
|
|
|
|
op_vstem,
|
|
|
|
op_vstem3,
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
op_div,
|
|
|
|
op_callothersubr,
|
|
|
|
op_callsubr,
|
|
|
|
op_pop,
|
|
|
|
op_return,
|
|
|
|
op_setcurrentpoint,
|
|
|
|
|
|
|
|
op_max /* never remove this one */
|
|
|
|
|
|
|
|
} T1_Operator;
|
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
static const FT_Int t1_args_count[op_max] =
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
0, /* none */
|
|
|
|
0, /* endchar */
|
|
|
|
2, /* hsbw */
|
|
|
|
5, /* seac */
|
|
|
|
4, /* sbw */
|
|
|
|
0, /* closepath */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
1, /* hlineto */
|
|
|
|
1, /* hmoveto */
|
|
|
|
4, /* hvcurveto */
|
|
|
|
2, /* rlineto */
|
|
|
|
2, /* rmoveto */
|
|
|
|
6, /* rrcurveto */
|
|
|
|
4, /* vhcurveto */
|
|
|
|
1, /* vlineto */
|
|
|
|
1, /* vmoveto */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
0, /* dotsection */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
2, /* hstem */
|
|
|
|
6, /* hstem3 */
|
|
|
|
2, /* vstem */
|
|
|
|
6, /* vstem3 */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
2, /* div */
|
|
|
|
-1, /* callothersubr */
|
|
|
|
1, /* callsubr */
|
|
|
|
0, /* pop */
|
|
|
|
0, /* return */
|
|
|
|
2 /* setcurrentpoint */
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/********** *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** GENERIC CHARSTRING PARSING *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** *********/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* CID_Init_Builder */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Initializes a given glyph builder. */
|
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* builder :: A pointer to the glyph builder to initialize. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: The current face object. */
|
|
|
|
/* */
|
|
|
|
/* size :: The current size object. */
|
|
|
|
/* */
|
|
|
|
/* glyph :: The current glyph object. */
|
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
LOCAL_FUNC
|
2000-06-16 08:49:56 +02:00
|
|
|
void CID_Init_Builder( CID_Builder* builder,
|
|
|
|
CID_Face face,
|
|
|
|
T1_Size size,
|
|
|
|
T1_GlyphSlot glyph )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
builder->path_begun = 0;
|
|
|
|
builder->load_points = 1;
|
|
|
|
|
|
|
|
builder->face = face;
|
|
|
|
builder->glyph = glyph;
|
|
|
|
builder->memory = face->root.memory;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( glyph )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphLoader* loader = glyph->root.loader;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
builder->loader = loader;
|
|
|
|
builder->base = &loader->base.outline;
|
|
|
|
builder->current = &loader->current.outline;
|
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
FT_GlyphLoader_Rewind( loader );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( size )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
builder->scale_x = size->root.metrics.x_scale;
|
|
|
|
builder->scale_y = size->root.metrics.y_scale;
|
|
|
|
}
|
|
|
|
|
|
|
|
builder->pos_x = 0;
|
|
|
|
builder->pos_y = 0;
|
|
|
|
|
|
|
|
builder->left_bearing.x = 0;
|
|
|
|
builder->left_bearing.y = 0;
|
|
|
|
builder->advance.x = 0;
|
|
|
|
builder->advance.y = 0;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* CID_Done_Builder */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Finalizes a given glyph builder. Its contents can still be used */
|
|
|
|
/* after the call, but the function saves important information */
|
|
|
|
/* within the corresponding glyph slot. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* builder :: A pointer to the glyph builder to finalize. */
|
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
LOCAL_FUNC
|
2000-06-16 08:49:56 +02:00
|
|
|
void CID_Done_Builder( CID_Builder* builder )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
T1_GlyphSlot glyph = builder->glyph;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( glyph )
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
glyph->root.outline = *builder->base;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* CID_Init_Decoder */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Initializes a given glyph decoder. */
|
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* decoder :: A pointer to the glyph builder to initialize. */
|
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
LOCAL_FUNC
|
|
|
|
void CID_Init_Decoder( CID_Decoder* decoder )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
MEM_Set( decoder, 0, sizeof ( *decoder ) );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
decoder->font_matrix.xx = 0x10000L;
|
|
|
|
decoder->font_matrix.yy = 0x10000L;
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* check that there is enough room for `count' more points */
|
2000-06-01 05:27:48 +02:00
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error check_points( CID_Builder* builder,
|
|
|
|
FT_Int count )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
return FT_GlyphLoader_Check_Points( builder->loader, count, 0 );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* add a new point, do not check space */
|
2000-06-01 05:27:48 +02:00
|
|
|
static
|
|
|
|
void add_point( CID_Builder* builder,
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y,
|
|
|
|
FT_Byte flag )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline* outline = builder->current;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( builder->load_points )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector* point = outline->points + outline->n_points;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
point->x = x;
|
|
|
|
point->y = y;
|
2000-06-16 08:49:56 +02:00
|
|
|
*control = flag ? FT_Curve_Tag_On : FT_Curve_Tag_Cubic;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
builder->last = *point;
|
|
|
|
}
|
|
|
|
|
|
|
|
outline->n_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check room for a new on-curve point, then add it */
|
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error add_point1( CID_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
error = check_points( builder, 1 );
|
|
|
|
if ( !error )
|
2000-06-01 05:27:48 +02:00
|
|
|
add_point( builder, x, y, 1 );
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check room for a new contour, then add it */
|
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error add_contour( CID_Builder* builder )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( !builder->load_points )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
outline->n_contours++;
|
|
|
|
return T1_Err_Ok;
|
|
|
|
}
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
error = FT_GlyphLoader_Check_Points( builder->loader, 0, 1 );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( !error )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
if ( outline->n_contours > 0 )
|
|
|
|
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
|
|
|
|
|
|
|
|
outline->n_contours++;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
return error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* if a path was begun, add its first on-curve point */
|
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error start_point( CID_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
/* test whether we are building a new contour */
|
|
|
|
if ( !builder->path_begun )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
builder->path_begun = 1;
|
|
|
|
error = add_contour( builder );
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( error )
|
|
|
|
return error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
return add_point1( builder, x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* close the current contour */
|
|
|
|
static
|
|
|
|
void close_contour( CID_Builder* builder )
|
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline* outline = builder->current;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( outline->n_contours > 0 )
|
2000-06-16 08:49:56 +02:00
|
|
|
outline->contours[outline->n_contours - 1] = outline->n_points - 1;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
#if 0
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* lookup_glyph_by_stdcharcode */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Looks up a given glyph by its StandardEncoding charcode. Used */
|
|
|
|
/* to implement the SEAC Type 1 operator. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* face :: The current face object. */
|
|
|
|
/* */
|
|
|
|
/* charcode :: The character code to look for. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* A glyph index in the font face. Returns -1 if the corresponding */
|
|
|
|
/* glyph wasn't found. */
|
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int lookup_glyph_by_stdcharcode( CID_Face face,
|
|
|
|
FT_Int charcode )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int n;
|
|
|
|
const FT_String* glyph_name;
|
2000-06-01 05:27:48 +02:00
|
|
|
PSNames_Interface* psnames = (PSNames_Interface*)face->psnames;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* check range of standard char code */
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( charcode < 0 || charcode > 255 )
|
2000-06-01 05:27:48 +02:00
|
|
|
return -1;
|
|
|
|
|
|
|
|
glyph_name = psnames->adobe_std_strings(
|
2000-06-16 08:49:56 +02:00
|
|
|
psnames->adobe_std_encoding[charcode]);
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
for ( n = 0; n < face->cid.cid_count; n++ )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_String* name = (FT_String*)face->type1.glyph_names[n];
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
if ( name && strcmp( name, glyph_name ) == 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
return n;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* t1operator_seac */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Implements the `seac' Type 1 operator for a Type 1 decoder. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* decoder :: The current CID decoder. */
|
|
|
|
/* */
|
|
|
|
/* asb :: The accent's side bearing. */
|
|
|
|
/* */
|
|
|
|
/* adx :: The horizontal offset of the accent. */
|
|
|
|
/* */
|
|
|
|
/* ady :: The vertical offset of the accent. */
|
|
|
|
/* */
|
|
|
|
/* bchar :: The base character's StandardEncoding charcode. */
|
|
|
|
/* */
|
|
|
|
/* achar :: The accent character's StandardEncoding charcode. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
static
|
|
|
|
FT_Error t1operator_seac( CID_Decoder* decoder,
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Pos asb,
|
|
|
|
FT_Pos adx,
|
|
|
|
FT_Pos ady,
|
|
|
|
FT_Int bchar,
|
|
|
|
FT_Int achar )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Int bchar_index, achar_index, n_base_points;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline* cur = decoder->builder.current;
|
|
|
|
FT_Outline* base = decoder->builder.base;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector left_bearing, advance;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
bchar_index = bchar;
|
|
|
|
achar_index = achar;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( bchar_index < 0 || achar_index < 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "t1operator_seac: invalid seac character code arguments\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
return T1_Err_Syntax_Error;
|
|
|
|
}
|
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
/* if we are trying to load a composite glyph, do not load the */
|
|
|
|
/* accent character and return the array of subglyphs. */
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( decoder->builder.no_recurse )
|
|
|
|
{
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphSlot glyph = (FT_GlyphSlot)decoder->builder.glyph;
|
|
|
|
FT_GlyphLoader* loader = glyph->loader;
|
|
|
|
FT_SubGlyph* subg;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-25 08:47:11 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* reallocate subglyph array if necessary */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
error = FT_GlyphLoader_Check_Subglyphs( loader, 2 );
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
subg = loader->current.subglyphs;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* subglyph 0 = base character */
|
|
|
|
subg->index = bchar_index;
|
|
|
|
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES |
|
|
|
|
FT_SUBGLYPH_FLAG_USE_MY_METRICS;
|
|
|
|
subg->arg1 = 0;
|
|
|
|
subg->arg2 = 0;
|
|
|
|
subg++;
|
|
|
|
|
|
|
|
/* subglyph 1 = accent character */
|
|
|
|
subg->index = achar_index;
|
|
|
|
subg->flags = FT_SUBGLYPH_FLAG_ARGS_ARE_XY_VALUES;
|
|
|
|
subg->arg1 = adx - asb;
|
|
|
|
subg->arg2 = ady;
|
|
|
|
|
|
|
|
/* set up remaining glyph fields */
|
|
|
|
glyph->num_subglyphs = 2;
|
|
|
|
glyph->format = ft_glyph_format_composite;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
loader->current.num_subglyphs = 2;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
/* First load `bchar' in builder */
|
|
|
|
/* now load the unscaled outline */
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( decoder->builder.loader )
|
|
|
|
FT_GlyphLoader_Prepare( decoder->builder.loader );
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
error = cid_load_glyph( decoder, bchar_index ); /* load one glyph */
|
2000-06-25 08:47:11 +02:00
|
|
|
if ( error )
|
|
|
|
goto Exit;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
n_base_points = cur->n_points;
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
/* save the left bearing and width of the base character */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* as they will be erased by the next load. */
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
left_bearing = decoder->builder.left_bearing;
|
|
|
|
advance = decoder->builder.advance;
|
|
|
|
|
|
|
|
decoder->builder.left_bearing.x = 0;
|
|
|
|
decoder->builder.left_bearing.y = 0;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* Now load `achar' on top of */
|
2000-06-01 05:27:48 +02:00
|
|
|
/* the base outline */
|
|
|
|
error = cid_load_glyph( decoder, achar_index );
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( error )
|
|
|
|
return error;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* restore the left side bearing and */
|
|
|
|
/* advance width of the base character */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
decoder->builder.left_bearing = left_bearing;
|
|
|
|
decoder->builder.advance = advance;
|
|
|
|
|
|
|
|
/* Finally, move the accent */
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( decoder->builder.load_points )
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
{
|
|
|
|
FT_Outline dummy;
|
2000-06-25 08:47:11 +02:00
|
|
|
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
|
|
|
|
dummy.n_points = base->n_points - n_base_points;
|
|
|
|
dummy.points = base->points + n_base_points;
|
|
|
|
FT_Outline_Translate( &dummy, adx - asb, ady );
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
Exit:
|
|
|
|
return error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
#define USE_ARGS( n ) top -= n; \
|
|
|
|
if ( top < decoder->stack ) \
|
|
|
|
goto Stack_Underflow
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* CID_Parse_CharStrings */
|
|
|
|
/* */
|
|
|
|
/* <Description> */
|
|
|
|
/* Parses a given CID charstrings program. */
|
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* decoder :: The current CID decoder. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* charstring_base :: The base of the charstring stream. */
|
|
|
|
/* */
|
|
|
|
/* charstring_len :: The length in bytes of the charstring stream. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
2000-06-25 08:47:11 +02:00
|
|
|
/* FreeType error code. 0 means success. */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* */
|
2000-06-01 05:27:48 +02:00
|
|
|
LOCAL_FUNC
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error CID_Parse_CharStrings( CID_Decoder* decoder,
|
|
|
|
FT_Byte* charstring_base,
|
|
|
|
FT_Int charstring_len )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_Decoder_Zone* zone;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* ip;
|
|
|
|
FT_Byte* limit;
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_Builder* builder = &decoder->builder;
|
|
|
|
FT_Outline* outline;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Pos x, y;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* First of all, initialize the decoder */
|
2000-06-01 05:27:48 +02:00
|
|
|
decoder->top = decoder->stack;
|
|
|
|
decoder->zone = decoder->zones;
|
|
|
|
zone = decoder->zones;
|
|
|
|
|
|
|
|
builder->path_begun = 0;
|
|
|
|
|
|
|
|
zone->base = charstring_base;
|
|
|
|
limit = zone->limit = charstring_base + charstring_len;
|
|
|
|
ip = zone->cursor = zone->base;
|
|
|
|
|
|
|
|
error = T1_Err_Ok;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
outline = builder->current;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
x = builder->pos_x;
|
|
|
|
y = builder->pos_y;
|
|
|
|
|
|
|
|
/* now, execute loop */
|
|
|
|
while ( ip < limit )
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int* top = decoder->top;
|
2000-06-16 08:49:56 +02:00
|
|
|
T1_Operator op = op_none;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Long value = 0;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Decode operator or operand */
|
|
|
|
/* */
|
|
|
|
|
|
|
|
/* First of all, decompress operator or value */
|
2000-06-16 08:49:56 +02:00
|
|
|
switch ( *ip++ )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
case 1:
|
|
|
|
op = op_hstem;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
op = op_vstem;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
op = op_vmoveto;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
op = op_rlineto;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
op = op_hlineto;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
op = op_vlineto;
|
|
|
|
break;
|
|
|
|
case 8:
|
|
|
|
op = op_rrcurveto;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
op = op_closepath;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
op = op_callsubr;
|
|
|
|
break;
|
|
|
|
case 11:
|
|
|
|
op = op_return;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 13:
|
|
|
|
op = op_hsbw;
|
|
|
|
break;
|
|
|
|
case 14:
|
|
|
|
op = op_endchar;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 21:
|
|
|
|
op = op_rmoveto;
|
|
|
|
break;
|
|
|
|
case 22:
|
|
|
|
op = op_hmoveto;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 30:
|
|
|
|
op = op_vhcurveto;
|
|
|
|
break;
|
|
|
|
case 31:
|
|
|
|
op = op_hvcurveto;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
if ( ip > limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid escape (12+EOF)\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
switch ( *ip++ )
|
|
|
|
{
|
|
|
|
case 0:
|
|
|
|
op = op_dotsection;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
op = op_vstem3;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
op = op_hstem3;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
op = op_seac;
|
|
|
|
break;
|
|
|
|
case 7:
|
|
|
|
op = op_sbw;
|
|
|
|
break;
|
|
|
|
case 12:
|
|
|
|
op = op_div;
|
|
|
|
break;
|
|
|
|
case 16:
|
|
|
|
op = op_callothersubr;
|
|
|
|
break;
|
|
|
|
case 17:
|
|
|
|
op = op_pop;
|
|
|
|
break;
|
|
|
|
case 33:
|
|
|
|
op = op_setcurrentpoint;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
default:
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid escape (12+%d)\n",
|
|
|
|
ip[-1] ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case 255: /* four bytes integer */
|
|
|
|
if ( ip + 4 > limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unexpected EOF in integer\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
value = ( (long)ip[0] << 24 ) |
|
|
|
|
( (long)ip[1] << 16 ) |
|
|
|
|
( (long)ip[2] << 8 ) |
|
|
|
|
ip[3];
|
|
|
|
ip += 4;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
default:
|
|
|
|
if ( ip[-1] >= 32 )
|
|
|
|
{
|
|
|
|
if ( ip[-1] < 247 )
|
|
|
|
value = (long)ip[-1] - 139;
|
|
|
|
else
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( ++ip > limit )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unexpected EOF in integer\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( ip[-2] < 251 )
|
|
|
|
value = ( (long)( ip[-2] - 247 ) << 8 ) + ip[-1] + 108;
|
2000-06-01 05:27:48 +02:00
|
|
|
else
|
2000-06-16 08:49:56 +02:00
|
|
|
value = -( ( ( (long)ip[-2] - 251 ) << 8 ) + ip[-1] + 108 );
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid byte (%d)\n",
|
2000-06-01 05:27:48 +02:00
|
|
|
ip[-1] ));
|
2000-06-16 08:49:56 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* Push value on stack, or process operator */
|
|
|
|
/* */
|
|
|
|
if ( op == op_none )
|
|
|
|
{
|
|
|
|
if ( top - decoder->stack >= T1_MAX_CHARSTRINGS_OPERANDS )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: Stack overflow!\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_TRACE4(( " %ld", value ));
|
|
|
|
*top++ = value;
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else if ( op == op_callothersubr ) /* callothersubr */
|
|
|
|
{
|
|
|
|
FT_TRACE4(( " callothersubr" ));
|
|
|
|
if ( top - decoder->stack < 2 )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
top -= 2;
|
|
|
|
switch ( top[1] )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
case 1: /* start flex feature ---------------------- */
|
|
|
|
if ( top[0] != 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
decoder->flex_state = 1;
|
|
|
|
decoder->num_flex_vectors = 0;
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 6 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case 2: /* add flex vectors ------------------------ */
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int index;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( top[0] != 0 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
/* note that we should not add a point for index 0. */
|
|
|
|
/* this will move our current position to the flex */
|
|
|
|
/* point without adding any point to the outline */
|
|
|
|
index = decoder->num_flex_vectors++;
|
|
|
|
if ( index > 0 && index < 7 )
|
|
|
|
add_point( builder,
|
|
|
|
x,
|
|
|
|
y,
|
2000-06-16 21:34:52 +02:00
|
|
|
(FT_Byte)( index==3 || index==6 ) );
|
2000-06-16 08:49:56 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0: /* end flex feature ------------------------- */
|
|
|
|
if ( top[0] != 3 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
if ( decoder->flex_state == 0 ||
|
|
|
|
decoder->num_flex_vectors != 7 )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID)Parse_CharStrings: unexpected flex end\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* now consume the remaining `pop pop setcurpoint' */
|
|
|
|
if ( ip + 6 > limit ||
|
|
|
|
ip[0] != 12 || ip[1] != 17 || /* pop */
|
|
|
|
ip[2] != 12 || ip[3] != 17 || /* pop */
|
|
|
|
ip[4] != 12 || ip[5] != 33 ) /* setcurpoint */
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid flex charstring\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
ip += 6;
|
|
|
|
decoder->flex_state = 0;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3: /* change hints ---------------------------- */
|
|
|
|
if ( top[0] != 1 )
|
|
|
|
goto Unexpected_OtherSubr;
|
|
|
|
|
|
|
|
/* eat the following `pop' */
|
|
|
|
if ( ip + 2 > limit )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid escape (12+%d)\n",
|
|
|
|
ip[-1] ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( ip[0] != 12 || ip[1] != 17 )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: `pop' expected, found (%d %d)\n",
|
|
|
|
ip[0], ip[1] ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
ip += 2;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 12:
|
|
|
|
case 13:
|
|
|
|
/* counter control hints, clear stack */
|
|
|
|
top = decoder->stack;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
#if 0
|
|
|
|
|
|
|
|
case 14:
|
|
|
|
case 15:
|
|
|
|
case 16:
|
|
|
|
case 17:
|
|
|
|
case 18: /* multiple masters */
|
|
|
|
{
|
|
|
|
T1_Blend* blend = decoder->blend;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_UInt num_points, nn, mm;
|
|
|
|
FT_Int* delta;
|
|
|
|
FT_Int* values;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
if ( !blend )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unexpected multiple masters operator!\n" ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
num_points = top[1] - 13 + ( top[1] == 18 );
|
|
|
|
if ( top[0] != num_points * blend->num_designs )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: incorrect number of mm arguments\n" ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
top -= blend->num_designs * num_points;
|
|
|
|
if ( top < decoder->stack )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
/* we want to compute: */
|
|
|
|
/* */
|
|
|
|
/* a0*w0 + a1*w1 + ... + ak*wk */
|
|
|
|
/* */
|
|
|
|
/* but we only have the a0, a1-a0, a2-a0, .. ak-a0 */
|
|
|
|
/* however, given that w0 + w1 + ... + wk == 1, we can */
|
|
|
|
/* rewrite it easily as: */
|
|
|
|
/* */
|
|
|
|
/* a0 + (a1-a0)*w1 + (a2-a0)*w2 + .. + (ak-a0)*wk */
|
|
|
|
/* */
|
|
|
|
/* where k == num_designs-1 */
|
|
|
|
/* */
|
|
|
|
/* I guess that's why it's written in this `compact' */
|
|
|
|
/* form... */
|
|
|
|
/* */
|
|
|
|
/* */
|
|
|
|
delta = top + num_points;
|
|
|
|
values = top;
|
|
|
|
for ( nn = 0; nn < num_points; nn++ )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int x = values[0];
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
|
|
|
for ( mm = 1; mm < blend->num_designs; mm++ )
|
|
|
|
x += FT_MulFix( *delta++, blend->weight_vector[mm] );
|
|
|
|
|
|
|
|
*values++ = x;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
/* note that `top' will be incremented later by calls to `pop' */
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
default:
|
|
|
|
Unexpected_OtherSubr:
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid othersubr [%d %d]!\n",
|
|
|
|
top[0], top[1] ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
decoder->top = top;
|
|
|
|
}
|
|
|
|
else /* general operator */
|
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int num_args = t1_args_count[op];
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
if ( top - decoder->stack < num_args )
|
|
|
|
goto Stack_Underflow;
|
|
|
|
|
|
|
|
top -= num_args;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
switch ( op )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_endchar:
|
|
|
|
FT_TRACE4(( " endchar" ));
|
|
|
|
|
|
|
|
close_contour( builder );
|
|
|
|
|
|
|
|
/* add current outline to the glyph slot */
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_GlyphLoader_Add( builder->loader );
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/* return now! */
|
|
|
|
FT_TRACE4(( "\n\n" ));
|
|
|
|
return T1_Err_Ok;
|
|
|
|
|
|
|
|
case op_hsbw:
|
|
|
|
FT_TRACE4(( " hsbw" ));
|
|
|
|
|
|
|
|
builder->left_bearing.x += top[0];
|
|
|
|
builder->advance.x = top[1];
|
|
|
|
builder->advance.y = 0;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
builder->last.x = x = top[0];
|
|
|
|
builder->last.y = y = 0;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* the `metrics_only' indicates that we only want to compute */
|
|
|
|
/* the glyph's metrics (lsb + advance width), not load the */
|
|
|
|
/* rest of it. So exit immediately. */
|
|
|
|
if ( builder->metrics_only )
|
2000-06-01 05:27:48 +02:00
|
|
|
return T1_Err_Ok;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_seac:
|
|
|
|
/* return immediately after the processing */
|
|
|
|
return t1operator_seac( decoder, top[0], top[1],
|
|
|
|
top[2], top[3], top[4] );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_sbw:
|
|
|
|
FT_TRACE4(( " sbw" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
builder->left_bearing.x += top[0];
|
|
|
|
builder->left_bearing.y += top[1];
|
|
|
|
builder->advance.x = top[2];
|
|
|
|
builder->advance.y = top[3];
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
builder->last.x = x = top[0];
|
|
|
|
builder->last.y = y = top[1];
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* the `metrics_only' indicates that we only want to compute */
|
|
|
|
/* the glyph's metrics (lsb + advance width), not load the */
|
|
|
|
/* rest of it. So exit immediately. */
|
|
|
|
if ( builder->metrics_only )
|
|
|
|
return T1_Err_Ok;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_closepath:
|
|
|
|
FT_TRACE4(( " closepath" ));
|
|
|
|
|
|
|
|
close_contour( builder );
|
|
|
|
builder->path_begun = 0;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_hlineto:
|
|
|
|
FT_TRACE4(( " hlineto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
x += top[0];
|
|
|
|
goto Add_Line;
|
|
|
|
|
|
|
|
case op_hmoveto:
|
|
|
|
FT_TRACE4(( " hmoveto" ));
|
|
|
|
|
|
|
|
x += top[0];
|
2000-06-01 05:27:48 +02:00
|
|
|
break;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_hvcurveto:
|
|
|
|
FT_TRACE4(( " hvcurveto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[0];
|
|
|
|
add_point( builder, x, y, 0 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[1];
|
|
|
|
y += top[2];
|
|
|
|
add_point( builder, x, y, 0 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
y += top[3];
|
|
|
|
add_point( builder, x, y, 1 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_rlineto:
|
|
|
|
FT_TRACE4(( " rlineto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
Add_Line:
|
|
|
|
if ( add_point1( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_rmoveto:
|
|
|
|
FT_TRACE4(( " rmoveto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_rrcurveto:
|
|
|
|
FT_TRACE4(( " rcurveto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[0];
|
|
|
|
y += top[1];
|
|
|
|
add_point( builder, x, y, 0 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[2];
|
|
|
|
y += top[3];
|
|
|
|
add_point( builder, x, y, 0 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
x += top[4];
|
|
|
|
y += top[5];
|
|
|
|
add_point( builder, x, y, 1 );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_vhcurveto:
|
|
|
|
FT_TRACE4(( " vhcurveto" ));
|
|
|
|
if ( start_point( builder, x, y ) ||
|
|
|
|
check_points( builder, 3 ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
y += top[0];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
|
|
|
|
x += top[1];
|
|
|
|
y += top[2];
|
|
|
|
add_point( builder, x, y, 0 );
|
|
|
|
|
|
|
|
x += top[3];
|
|
|
|
add_point( builder, x, y, 1 );
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vlineto:
|
|
|
|
FT_TRACE4(( " vlineto" ));
|
|
|
|
|
|
|
|
if ( start_point( builder, x, y ) )
|
|
|
|
goto Memory_Error;
|
|
|
|
|
|
|
|
y += top[0];
|
|
|
|
goto Add_Line;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_vmoveto:
|
|
|
|
FT_TRACE4(( " vmoveto" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
y += top[0];
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_div:
|
|
|
|
FT_TRACE4(( " div" ));
|
|
|
|
|
|
|
|
if ( top[1] )
|
|
|
|
*top++ = top[0] / top[1];
|
|
|
|
else
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: division by 0\n" ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_callsubr:
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int index;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
FT_TRACE4(( " callsubr" ));
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
index = top[0];
|
|
|
|
if ( index < 0 || index >= decoder->subrs->num_subrs )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invalid subrs index\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( zone - decoder->zones >= T1_MAX_SUBRS_CALLS )
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: too many nested subrs\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
zone->cursor = ip; /* save current instruction pointer */
|
|
|
|
|
|
|
|
zone++;
|
2000-06-16 08:49:56 +02:00
|
|
|
zone->base = decoder->subrs->code[index] + decoder->lenIV;
|
|
|
|
zone->limit = decoder->subrs->code[index + 1];
|
|
|
|
zone->cursor = zone->base;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( !zone->base )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: invoking empty subrs!\n" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
goto Syntax_Error;
|
|
|
|
}
|
|
|
|
|
|
|
|
decoder->zone = zone;
|
|
|
|
ip = zone->base;
|
|
|
|
limit = zone->limit;
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_pop:
|
|
|
|
FT_TRACE4(( " pop" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* theorically, the arguments are already on the stack */
|
|
|
|
top++;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_return:
|
|
|
|
FT_TRACE4(( " return" ));
|
|
|
|
|
|
|
|
if ( zone <= decoder->zones )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unexpected return\n" ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
zone--;
|
|
|
|
ip = zone->cursor;
|
|
|
|
limit = zone->limit;
|
|
|
|
decoder->zone = zone;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_dotsection:
|
|
|
|
FT_TRACE4(( " dotsection" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_hstem:
|
|
|
|
FT_TRACE4(( " hstem" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_hstem3:
|
|
|
|
FT_TRACE4(( " hstem3" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
case op_vstem:
|
|
|
|
FT_TRACE4(( " vstem" ));
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case op_vstem3:
|
|
|
|
FT_TRACE4(( " vstem3" ));
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
case op_setcurrentpoint:
|
|
|
|
FT_TRACE4(( " setcurrentpoint" ));
|
|
|
|
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unexpected `setcurrentpoint'\n" ));
|
|
|
|
goto Syntax_Error;
|
|
|
|
|
|
|
|
default:
|
|
|
|
FT_ERROR(( "CID_Parse_CharStrings: unhandled opcode %d\n", op ));
|
|
|
|
goto Syntax_Error;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
decoder->top = top;
|
|
|
|
|
|
|
|
} /* general operator processing */
|
|
|
|
|
|
|
|
} /* while ip < limit */
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
FT_TRACE4(( "..end..\n\n" ));
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
return error;
|
|
|
|
|
|
|
|
Syntax_Error:
|
|
|
|
return T1_Err_Syntax_Error;
|
|
|
|
|
|
|
|
Stack_Underflow:
|
|
|
|
return T1_Err_Stack_Underflow;
|
|
|
|
|
|
|
|
Memory_Error:
|
|
|
|
return builder->error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/********** *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** The following code is in charge of computing *********/
|
|
|
|
/********** the maximum advance width of the font. It *********/
|
|
|
|
/********** quickly processes each glyph charstring to *********/
|
|
|
|
/********** extract the value from either a `sbw' or `seac' *********/
|
|
|
|
/********** operator. *********/
|
|
|
|
/********** *********/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
LOCAL_FUNC
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error CID_Compute_Max_Advance( CID_Face face,
|
|
|
|
FT_Int* max_advance )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-01 05:27:48 +02:00
|
|
|
CID_Decoder decoder;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int glyph_index;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
*max_advance = 0;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* Initialize load decoder */
|
2000-06-01 05:27:48 +02:00
|
|
|
CID_Init_Decoder( &decoder );
|
|
|
|
CID_Init_Builder( &decoder.builder, face, 0, 0 );
|
|
|
|
|
|
|
|
decoder.builder.metrics_only = 1;
|
|
|
|
decoder.builder.load_points = 0;
|
|
|
|
|
|
|
|
/* For each glyph, parse the glyph charstring and extract */
|
2000-06-16 08:49:56 +02:00
|
|
|
/* the advance width. */
|
|
|
|
for ( glyph_index = 0; glyph_index < face->root.num_glyphs;
|
|
|
|
glyph_index++ )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
/* now get load the unscaled outline */
|
|
|
|
error = cid_load_glyph( &decoder, glyph_index );
|
|
|
|
/* ignore the error if one occured - skip to next glyph */
|
|
|
|
}
|
|
|
|
|
|
|
|
*max_advance = decoder.builder.advance.x;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
return T1_Err_Ok;
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/********** *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** UNHINTED GLYPH LOADER *********/
|
|
|
|
/********** *********/
|
|
|
|
/********** The following code is in charge of loading a *********/
|
|
|
|
/********** single outline. It completely ignores hinting *********/
|
|
|
|
/********** and is used when FT_LOAD_NO_HINTING is set. *********/
|
|
|
|
/********** *********/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
static
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error cid_load_glyph( CID_Decoder* decoder,
|
|
|
|
FT_UInt glyph_index )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_Face face = decoder->builder.face;
|
|
|
|
CID_Info* cid = &face->cid;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* p;
|
|
|
|
FT_UInt entry_len = cid->fd_bytes + cid->gd_bytes;
|
|
|
|
FT_UInt fd_select;
|
|
|
|
FT_ULong off1, glyph_len;
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_Stream stream = face->root.stream;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error = 0;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* read the CID font dict index and charstring offset from the CIDMap */
|
|
|
|
if ( FILE_Seek( cid->data_offset + cid->cidmap_offset +
|
|
|
|
glyph_index * entry_len) ||
|
2000-06-16 08:49:56 +02:00
|
|
|
ACCESS_Frame( 2 * entry_len ) )
|
|
|
|
goto Exit;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 21:34:52 +02:00
|
|
|
p = (FT_Byte*)stream->cursor;
|
|
|
|
fd_select = (FT_UInt) cid_get_offset( &p, cid->fd_bytes );
|
|
|
|
off1 = (FT_ULong)cid_get_offset( &p, cid->gd_bytes );
|
2000-06-01 05:27:48 +02:00
|
|
|
p += cid->fd_bytes;
|
|
|
|
glyph_len = cid_get_offset( &p, cid->gd_bytes ) - off1;
|
|
|
|
|
|
|
|
FORGET_Frame();
|
|
|
|
|
|
|
|
/* now, if the glyph is not empty, set up the subrs array, and parse */
|
|
|
|
/* the charstrings */
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( glyph_len > 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_FontDict* dict;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Byte* charstring;
|
|
|
|
FT_UInt lenIV;
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_Memory memory = face->root.memory;
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* setup subrs */
|
|
|
|
decoder->subrs = face->subrs + fd_select;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* setup font matrix */
|
2000-06-01 05:27:48 +02:00
|
|
|
dict = cid->font_dicts + fd_select;
|
|
|
|
decoder->font_matrix = dict->font_matrix;
|
|
|
|
lenIV = dict->private_dict.lenIV;
|
|
|
|
decoder->lenIV = lenIV;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/* the charstrings are encoded (stupid!) */
|
|
|
|
/* load the charstrings, then execute it */
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( ALLOC( charstring, glyph_len ) )
|
|
|
|
goto Exit;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
if ( !FILE_Read_At( cid->data_offset + off1, charstring, glyph_len ) )
|
|
|
|
{
|
|
|
|
cid_decrypt( charstring, glyph_len, 4330 );
|
|
|
|
error = CID_Parse_CharStrings( decoder,
|
|
|
|
charstring + lenIV,
|
|
|
|
glyph_len - lenIV );
|
|
|
|
}
|
|
|
|
|
|
|
|
FREE( charstring );
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
2000-06-16 08:49:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
LOCAL_FUNC
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error CID_Load_Glyph( T1_GlyphSlot glyph,
|
2000-06-01 05:27:48 +02:00
|
|
|
T1_Size size,
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int glyph_index,
|
|
|
|
FT_Int load_flags )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Error error;
|
2000-06-16 08:49:56 +02:00
|
|
|
CID_Decoder decoder;
|
|
|
|
CID_Face face = (CID_Face)glyph->root.face;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Bool hinting;
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( load_flags & FT_LOAD_NO_RECURSE )
|
2000-06-01 05:27:48 +02:00
|
|
|
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
|
|
|
|
|
|
|
|
glyph->x_scale = size->root.metrics.x_scale;
|
|
|
|
glyph->y_scale = size->root.metrics.y_scale;
|
|
|
|
|
|
|
|
glyph->root.outline.n_points = 0;
|
|
|
|
glyph->root.outline.n_contours = 0;
|
|
|
|
|
|
|
|
hinting = ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
|
|
|
|
( load_flags & FT_LOAD_NO_HINTING ) == 0;
|
|
|
|
|
|
|
|
glyph->root.format = ft_glyph_format_none;
|
|
|
|
|
|
|
|
{
|
|
|
|
CID_Init_Decoder( &decoder );
|
|
|
|
CID_Init_Builder( &decoder.builder, face, size, glyph );
|
|
|
|
|
|
|
|
/* set up the decoder */
|
2000-06-16 08:49:56 +02:00
|
|
|
decoder.builder.no_recurse =
|
|
|
|
(FT_Bool)( load_flags & FT_LOAD_NO_RECURSE );
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
error = cid_load_glyph( &decoder, glyph_index );
|
|
|
|
|
|
|
|
/* save new glyph tables */
|
|
|
|
CID_Done_Builder( &decoder.builder );
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
/* Now, set the metrics - this is rather simple, as */
|
|
|
|
/* the left side bearing is the xMin, and the top side */
|
|
|
|
/* bearing the yMax. */
|
|
|
|
if ( !error )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
/* for composite glyphs, return only the left side bearing and the */
|
|
|
|
/* advance width.. */
|
|
|
|
if ( load_flags & FT_LOAD_NO_RECURSE )
|
|
|
|
{
|
|
|
|
glyph->root.metrics.horiBearingX = decoder.builder.left_bearing.x;
|
|
|
|
glyph->root.metrics.horiAdvance = decoder.builder.advance.x;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2000-06-16 08:49:56 +02:00
|
|
|
FT_BBox cbox;
|
|
|
|
FT_Glyph_Metrics* metrics = &glyph->root.metrics;
|
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
|
|
|
|
/* copy the _unscaled_ advance width */
|
|
|
|
metrics->horiAdvance = decoder.builder.advance.x;
|
|
|
|
|
|
|
|
/* make up vertical metrics */
|
|
|
|
metrics->vertBearingX = 0;
|
|
|
|
metrics->vertBearingY = 0;
|
|
|
|
metrics->vertAdvance = 0;
|
|
|
|
|
|
|
|
glyph->root.format = ft_glyph_format_outline;
|
|
|
|
|
|
|
|
glyph->root.outline.flags &= ft_outline_owner;
|
|
|
|
if ( size && size->root.metrics.y_ppem < 24 )
|
|
|
|
glyph->root.outline.flags |= ft_outline_high_precision;
|
|
|
|
|
|
|
|
glyph->root.outline.flags |= ft_outline_reverse_fill;
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
#if 0
|
2000-06-01 05:27:48 +02:00
|
|
|
glyph->root.outline.second_pass = TRUE;
|
2000-06-16 08:49:56 +02:00
|
|
|
glyph->root.outline.high_precision = size->root.metrics.y_ppem < 24;
|
2000-06-01 05:27:48 +02:00
|
|
|
glyph->root.outline.dropout_mode = 2;
|
2000-06-16 08:49:56 +02:00
|
|
|
#endif
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
/* scale the outline and the metrics */
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Int n;
|
- MAJOR INTERNAL REDESIGN:
A lot of internal modifications have been performed lately on the
source in order to provide the following enhancements:
- more generic module support:
The FT_Module type is now defined to represent a handle to a given
module. The file <freetype/ftmodule.h> contains the FT_Module_Class
definition, as well as the module-loading public API
The FT_Driver type is still defined, and still represents a pointer
to a font driver. Note that FT_Add_Driver is replaced by FT_Add_Module,
FT_Get_Driver by FT_Get_Module, etc..
- support for generic glyph image types:
The FT_Renderer type is a pointer to a module used to perform various
operations on glyph image.
Each renderer is capable of handling images in a single format
(e.g. ft_glyph_format_outline). Its functions are used to:
- transform an glyph image
- render a glyph image into a bitmap
- return the control box (dimensions) of a given glyph image
The scan converters "ftraster.c" and "ftgrays.c" have been moved
to the new directory "src/renderer", and are used to provide two
default renderer modules.
One corresponds to the "standard" scan-converter, the other to the
"smooth" one.
The current renderer can be set through the new function
FT_Set_Renderer.
The old raster-related function FT_Set_Raster, FT_Get_Raster and
FT_Set_Raster_Mode have now disappeared, in favor of the new:
FT_Get_Renderer
FT_Set_Renderer
see the file <freetype/ftrender.h> for more details..
These changes were necessary to properly support different scalable
formats in the future, like bi-color glyphs, etc..
- glyph loader object:
A new internal object, called a 'glyph loader' has been introduced
in the base layer. It is used by all scalable format font drivers
to load glyphs and composites.
This object has been created to reduce the code size of each driver,
as each one of them basically re-implemented its functionality.
See <freetype/internal/ftobjs.h> and the FT_GlyphLoader type for
more information..
- FT_GlyphSlot had new fields:
In order to support extended features (see below), the FT_GlyphSlot
structure has a few new fields:
linearHoriAdvance: this field gives the linearly scaled (i.e.
scaled but unhinted) advance width for the glyph,
expressed as a 16.16 fixed pixel value. This
is useful to perform WYSIWYG text.
linearVertAdvance: this field gives the linearly scaled advance
height for the glyph (relevant in vertical glyph
layouts only). This is useful to perform
WYSIWYG text.
Note that the two above field replace the removed "metrics2" field
in the glyph slot.
advance: this field is a vector that gives the transformed
advance for the glyph. By default, it corresponds
to the advance width, unless FT_LOAD_VERTICAL_LAYOUT
was specified when calling FT_Load_Glyph or FT_Load_Char
bitmap_left: this field gives the distance in integer pixels from
the current pen position to the left-most pixel of
a glyph image WHEN IT IS A BITMAP. It is only valid
when the "format" field is set to
"ft_glyph_format_bitmap", for example, after calling
the new function FT_Render_Glyph.
bitmap_top: this field gives the distance in integer pixels from
the current pen position (located on the baseline) to
the top-most pixel of the glyph image WHEN IT IS A
BITMAP. Positive values correspond to upwards Y.
loader: this is a new private field for the glyph slot. Client
applications should not touch it..
- support for transforms and direct rendering in FT_Load_Glyph:
Most of the functionality found in <freetype/ftglyph.h> has been
moved to the core library. Hence, the following:
- a transform can be specified for a face through FT_Set_Transform.
this transform is applied by FT_Load_Glyph to scalable glyph images
(i.e. NOT TO BITMAPS) before the function returns, unless the
bit flag FT_LOAD_IGNORE_TRANSFORM was set in the load flags..
- once a glyph image has been loaded, it can be directly converted to
a bitmap by using the new FT_Render_Glyph function. Note that this
function takes the glyph image from the glyph slot, and converts
it to a bitmap whose properties are returned in "face.glyph.bitmap",
"face.glyph.bitmap_left" and "face.glyph.bitmap_top". The original
native image might be lost after the conversion.
- when using the new bit flag FT_LOAD_RENDER, the FT_Load_Glyph
and FT_Load_Char functions will call FT_Render_Glyph automatically
when needed.
2000-06-22 02:17:42 +02:00
|
|
|
FT_Outline* cur = &glyph->root.outline;
|
2000-06-16 21:34:52 +02:00
|
|
|
FT_Vector* vec = cur->points;
|
|
|
|
FT_Fixed x_scale = glyph->x_scale;
|
|
|
|
FT_Fixed y_scale = glyph->y_scale;
|
2000-06-01 05:27:48 +02:00
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
/* First of all, scale the points */
|
|
|
|
for ( n = cur->n_points; n > 0; n--, vec++ )
|
|
|
|
{
|
|
|
|
vec->x = FT_MulFix( vec->x, x_scale );
|
|
|
|
vec->y = FT_MulFix( vec->y, y_scale );
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
|
|
|
|
|
|
|
|
/* Then scale the metrics */
|
|
|
|
metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
|
|
|
|
|
|
|
|
metrics->vertBearingX = FT_MulFix( metrics->vertBearingX, x_scale );
|
|
|
|
metrics->vertBearingY = FT_MulFix( metrics->vertBearingY, y_scale );
|
|
|
|
metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, x_scale );
|
|
|
|
}
|
|
|
|
|
|
|
|
/* apply the font matrix */
|
|
|
|
FT_Outline_Transform( &glyph->root.outline, &decoder.font_matrix );
|
|
|
|
|
|
|
|
/* compute the other metrics */
|
|
|
|
FT_Outline_Get_CBox( &glyph->root.outline, &cbox );
|
|
|
|
|
|
|
|
/* grid fit the bounding box if necessary */
|
2000-06-16 08:49:56 +02:00
|
|
|
if ( hinting )
|
2000-06-01 05:27:48 +02:00
|
|
|
{
|
|
|
|
cbox.xMin &= -64;
|
|
|
|
cbox.yMin &= -64;
|
2000-06-16 08:49:56 +02:00
|
|
|
cbox.xMax = ( cbox.xMax + 63 ) & -64;
|
|
|
|
cbox.yMax = ( cbox.yMax + 63 ) & -64;
|
2000-06-01 05:27:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
metrics->width = cbox.xMax - cbox.xMin;
|
|
|
|
metrics->height = cbox.yMax - cbox.yMin;
|
|
|
|
|
|
|
|
metrics->horiBearingX = cbox.xMin;
|
|
|
|
metrics->horiBearingY = cbox.yMax;
|
|
|
|
}
|
|
|
|
}
|
2000-06-16 08:49:56 +02:00
|
|
|
|
2000-06-01 05:27:48 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
2000-06-16 08:49:56 +02:00
|
|
|
|
|
|
|
/* END */
|