2000-08-17 09:18:04 +02:00
|
|
|
/***************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* psobjs.c */
|
|
|
|
/* */
|
|
|
|
/* Auxiliary functions for PostScript fonts (body). */
|
|
|
|
/* */
|
2017-01-04 20:16:34 +01:00
|
|
|
/* Copyright 1996-2017 by */
|
2000-08-17 09:18:04 +02:00
|
|
|
/* 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-12-08 17:17:16 +01:00
|
|
|
|
|
|
|
#include <ft2build.h>
|
|
|
|
#include FT_INTERNAL_POSTSCRIPT_AUX_H
|
|
|
|
#include FT_INTERNAL_DEBUG_H
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
#include FT_INTERNAL_CALC_H
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
|
2001-03-20 12:14:24 +01:00
|
|
|
#include "psobjs.h"
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
#include "psconv.h"
|
2000-08-17 09:18:04 +02:00
|
|
|
|
Complete redesign of error codes. Please check ftmoderr.h for more
details.
* include/freetype/internal/cfferrs.h,
include/freetype/internal/tterrors.h,
include/freetype/internal/t1errors.h: Removed. Replaced with files
local to the module. All extra error codes have been moved to
`fterrors.h'.
* src/sfnt/ttpost.h: Move error codes to `fterrors.h'.
* src/autohint/aherrors.h, src/cache/ftcerror.h, src/cff/cfferrs.h,
src/cid/ciderrs.h, src/pcf/pcferror.h, src/psaux/psauxerr.h,
src/psnames/psnamerr.h, src/raster/rasterrs.h, src/sfnt/sferrors.h,
src/smooth/ftsmerrs.h, src/truetype/tterrors.h,
src/type1/t1errors.h, src/winfonts/fnterrs.h: New files defining the
error names for the module it belongs to.
* include/freetype/ftmoderr.h: New file, defining the module error
offsets. Its structure is similar to `fterrors.h'.
* include/freetype/fterrors.h (FT_NOERRORDEF): New macro.
(FT_ERRORDEF): Redefined to use module error offsets.
All internal error codes are now public; unused error codes have
been removed, some are new.
* include/freetype/config/ftheader.h (FT_MODULE_ERRORS_H): New
macro.
* include/freetype/config/ftoption.h
(FT_CONFIG_OPTION_USE_MODULE_ERRORS): New macro.
All other source files have been updated to use the new error codes;
some already existing (internal) error codes local to a module have
been renamed to give them the same name as in the base module.
All make files have been updated to include the local error files.
* src/cid/cidtokens.h: Replaced with...
* src/cid/cidtoken.h: This file for 8+3 consistency.
* src/raster/ftraster.c: Use macros for header file names.
2001-06-06 19:30:41 +02:00
|
|
|
#include "psauxerr.h"
|
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
|
2006-08-13 14:14:36 +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. */
|
|
|
|
/* */
|
|
|
|
#undef FT_COMPONENT
|
|
|
|
#define FT_COMPONENT trace_psobjs
|
|
|
|
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
2000-08-21 06:58:49 +02:00
|
|
|
/***** PS_TABLE *****/
|
2000-08-17 03:09:06 +02:00
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
/* ps_table_new */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2000-08-23 19:32:42 +02:00
|
|
|
/* Initializes a PS_Table. */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* table :: The address of the target table. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
|
|
|
/* count :: The table size = the maximum number of elements. */
|
|
|
|
/* */
|
|
|
|
/* memory :: The memory object to use for all subsequent */
|
|
|
|
/* reallocations. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_table_new( PS_Table table,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Int count,
|
|
|
|
FT_Memory memory )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
table->memory = memory;
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_NEW_ARRAY( table->elements, count ) ||
|
|
|
|
FT_NEW_ARRAY( table->lengths, count ) )
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
table->max_elems = count;
|
2000-11-06 00:41:08 +01:00
|
|
|
table->init = 0xDEADBEEFUL;
|
2000-08-17 03:09:06 +02:00
|
|
|
table->num_elems = 0;
|
2015-04-13 05:16:48 +02:00
|
|
|
table->block = NULL;
|
2000-08-17 03:09:06 +02:00
|
|
|
table->capacity = 0;
|
|
|
|
table->cursor = 0;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
*(PS_Table_FuncsRec*)&table->funcs = ps_table_funcs;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
if ( error )
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( table->elements );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static void
|
2002-02-28 17:10:29 +01:00
|
|
|
shift_elements( PS_Table table,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* old_base )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2006-04-26 17:02:52 +02:00
|
|
|
FT_PtrDist delta = table->block - old_base;
|
|
|
|
FT_Byte** offset = table->elements;
|
|
|
|
FT_Byte** limit = offset + table->max_elems;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2001-02-03 05:34:53 +01:00
|
|
|
for ( ; offset < limit; offset++ )
|
|
|
|
{
|
|
|
|
if ( offset[0] )
|
|
|
|
offset[0] += delta;
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Error
|
2013-06-06 09:16:38 +02:00
|
|
|
reallocate_t1_table( PS_Table table,
|
|
|
|
FT_Offset new_size )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory = table->memory;
|
|
|
|
FT_Byte* old_base = table->block;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
2001-02-03 05:34:53 +01:00
|
|
|
/* allocate new base block */
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_ALLOC( table->block, new_size ) )
|
2003-03-13 22:07:51 +01:00
|
|
|
{
|
|
|
|
table->block = old_base;
|
2000-08-17 03:09:06 +02:00
|
|
|
return error;
|
2003-03-13 22:07:51 +01:00
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2001-02-03 05:34:53 +01:00
|
|
|
/* copy elements and shift offsets */
|
2006-08-13 14:14:36 +02:00
|
|
|
if ( old_base )
|
2001-02-03 05:34:53 +01:00
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( table->block, old_base, table->capacity );
|
2000-08-17 03:09:06 +02:00
|
|
|
shift_elements( table, old_base );
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( old_base );
|
2001-02-03 05:34:53 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
table->capacity = new_size;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
/* ps_table_add */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2002-03-14 11:09:35 +01:00
|
|
|
/* Adds an object to a PS_Table, possibly growing its memory block. */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* table :: The target table. */
|
|
|
|
/* */
|
|
|
|
/* <Input> */
|
2003-12-09 03:12:14 +01:00
|
|
|
/* idx :: The index of the object in the table. */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* object :: The address of the object to copy in memory. */
|
|
|
|
/* */
|
|
|
|
/* length :: The length in bytes of the source object. */
|
|
|
|
/* */
|
|
|
|
/* <Return> */
|
|
|
|
/* FreeType error code. 0 means success. An error is returned if a */
|
|
|
|
/* reallocation fails. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2015-02-18 09:22:06 +01:00
|
|
|
ps_table_add( PS_Table table,
|
|
|
|
FT_Int idx,
|
|
|
|
void* object,
|
|
|
|
FT_UInt length )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2008-06-09 22:49:29 +02:00
|
|
|
if ( idx < 0 || idx >= table->max_elems )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
FT_ERROR(( "ps_table_add: invalid index\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_Argument );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* grow the base block if needed */
|
|
|
|
if ( table->cursor + length > table->capacity )
|
|
|
|
{
|
2011-04-13 13:37:37 +02:00
|
|
|
FT_Error error;
|
|
|
|
FT_Offset new_size = table->capacity;
|
|
|
|
FT_PtrDist in_offset;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-09-10 08:55:43 +02:00
|
|
|
|
2011-04-13 13:37:37 +02:00
|
|
|
in_offset = (FT_Byte*)object - table->block;
|
|
|
|
if ( in_offset < 0 || (FT_Offset)in_offset >= table->capacity )
|
2001-08-30 09:59:28 +02:00
|
|
|
in_offset = -1;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
while ( new_size < table->cursor + length )
|
2002-11-06 23:32:54 +01:00
|
|
|
{
|
2003-04-23 17:17:43 +02:00
|
|
|
/* increase size by 25% and round up to the nearest multiple
|
|
|
|
of 1024 */
|
|
|
|
new_size += ( new_size >> 2 ) + 1;
|
2003-12-24 02:10:46 +01:00
|
|
|
new_size = FT_PAD_CEIL( new_size, 1024 );
|
2002-11-06 23:32:54 +01:00
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
error = reallocate_t1_table( table, new_size );
|
|
|
|
if ( error )
|
|
|
|
return error;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-08-30 09:59:28 +02:00
|
|
|
if ( in_offset >= 0 )
|
|
|
|
object = table->block + in_offset;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* add the object to the base block and adjust offset */
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
table->elements[idx] = table->block + table->cursor;
|
|
|
|
table->lengths [idx] = length;
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( table->block + table->cursor, object, length );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
table->cursor += length;
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
/* ps_table_done */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <Description> */
|
2002-03-31 13:18:15 +02:00
|
|
|
/* Finalizes a PS_TableRec (i.e., reallocate it to its current */
|
|
|
|
/* cursor). */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <InOut> */
|
|
|
|
/* table :: The target table. */
|
|
|
|
/* */
|
|
|
|
/* <Note> */
|
|
|
|
/* This function does NOT release the heap's memory block. It is up */
|
|
|
|
/* to the caller to clean it, or reference it in its own structures. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_table_done( PS_Table table )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory = table->memory;
|
|
|
|
FT_Error error;
|
2001-02-03 05:34:53 +01:00
|
|
|
FT_Byte* old_base = table->block;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
/* should never fail, because rec.cursor <= rec.size */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !old_base )
|
|
|
|
return;
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_ALLOC( table->block, table->cursor ) )
|
2000-08-29 18:50:01 +02:00
|
|
|
return;
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( table->block, old_base, table->cursor );
|
2001-02-03 05:34:53 +01:00
|
|
|
shift_elements( table, old_base );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2001-02-03 05:34:53 +01:00
|
|
|
table->capacity = table->cursor;
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( old_base );
|
2002-02-19 17:30:15 +01:00
|
|
|
|
|
|
|
FT_UNUSED( error );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_table_release( PS_Table table )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory = table->memory;
|
|
|
|
|
|
|
|
|
2000-08-23 00:36:33 +02:00
|
|
|
if ( (FT_ULong)table->init == 0xDEADBEEFUL )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_FREE( table->block );
|
|
|
|
FT_FREE( table->elements );
|
|
|
|
FT_FREE( table->lengths );
|
2000-08-17 03:09:06 +02:00
|
|
|
table->init = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** T1 PARSER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
/* first character must be already part of the comment */
|
|
|
|
|
2003-07-24 08:16:21 +02:00
|
|
|
static void
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_comment( FT_Byte* *acur,
|
|
|
|
FT_Byte* limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
while ( cur < limit )
|
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( IS_PS_NEWLINE( *cur ) )
|
2000-08-17 03:09:06 +02:00
|
|
|
break;
|
|
|
|
cur++;
|
|
|
|
}
|
2003-07-24 08:16:21 +02:00
|
|
|
|
|
|
|
*acur = cur;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-07-24 08:16:21 +02:00
|
|
|
static void
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_spaces( FT_Byte* *acur,
|
|
|
|
FT_Byte* limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-07-24 08:16:21 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
while ( cur < limit )
|
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( !IS_PS_SPACE( *cur ) )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
if ( *cur == '%' )
|
|
|
|
/* According to the PLRM, a comment is equal to a space. */
|
|
|
|
skip_comment( &cur, limit );
|
|
|
|
else
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
cur++;
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
*acur = cur;
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
#define IS_OCTAL_DIGIT( c ) ( '0' <= (c) && (c) <= '7' )
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
|
|
|
|
/* first character must be `('; */
|
|
|
|
/* *acur is positioned at the character after the closing `)' */
|
|
|
|
|
|
|
|
static FT_Error
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_literal_string( FT_Byte* *acur,
|
|
|
|
FT_Byte* limit )
|
|
|
|
{
|
2006-06-26 11:40:00 +02:00
|
|
|
FT_Byte* cur = *acur;
|
|
|
|
FT_Int embed = 0;
|
2013-03-14 17:50:49 +01:00
|
|
|
FT_Error error = FT_ERR( Invalid_File_Format );
|
2006-06-26 11:40:00 +02:00
|
|
|
unsigned int i;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
while ( cur < limit )
|
|
|
|
{
|
2006-06-26 11:40:00 +02:00
|
|
|
FT_Byte c = *cur;
|
|
|
|
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
cur++;
|
2006-06-26 11:40:00 +02:00
|
|
|
|
|
|
|
if ( c == '\\' )
|
|
|
|
{
|
|
|
|
/* Red Book 3rd ed., section `Literal Text Strings', p. 29: */
|
|
|
|
/* A backslash can introduce three different types */
|
|
|
|
/* of escape sequences: */
|
|
|
|
/* - a special escaped char like \r, \n, etc. */
|
|
|
|
/* - a one-, two-, or three-digit octal number */
|
|
|
|
/* - none of the above in which case the backslash is ignored */
|
|
|
|
|
|
|
|
if ( cur == limit )
|
|
|
|
/* error (or to be ignored?) */
|
|
|
|
break;
|
|
|
|
|
|
|
|
switch ( *cur )
|
|
|
|
{
|
|
|
|
/* skip `special' escape */
|
|
|
|
case 'n':
|
|
|
|
case 'r':
|
|
|
|
case 't':
|
|
|
|
case 'b':
|
|
|
|
case 'f':
|
|
|
|
case '\\':
|
|
|
|
case '(':
|
|
|
|
case ')':
|
2016-12-26 23:57:45 +01:00
|
|
|
cur++;
|
2006-06-26 11:40:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
/* skip octal escape or ignore backslash */
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( i = 0; i < 3 && cur < limit; i++ )
|
2006-06-26 11:40:00 +02:00
|
|
|
{
|
2008-11-04 11:37:30 +01:00
|
|
|
if ( !IS_OCTAL_DIGIT( *cur ) )
|
2006-06-26 11:40:00 +02:00
|
|
|
break;
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
cur++;
|
2006-06-26 11:40:00 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( c == '(' )
|
2003-10-07 07:49:41 +02:00
|
|
|
embed++;
|
2006-06-26 11:40:00 +02:00
|
|
|
else if ( c == ')' )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
embed--;
|
|
|
|
if ( embed == 0 )
|
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2003-10-07 07:49:41 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
2003-07-24 08:16:21 +02:00
|
|
|
|
|
|
|
*acur = cur;
|
2006-06-26 11:40:00 +02:00
|
|
|
|
|
|
|
return error;
|
2003-07-24 08:16:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* first character must be `<' */
|
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
static FT_Error
|
|
|
|
skip_string( FT_Byte* *acur,
|
|
|
|
FT_Byte* limit )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
2006-06-26 11:40:00 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error err = FT_Err_Ok;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
|
2003-10-16 17:48:39 +02:00
|
|
|
while ( ++cur < limit )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
/* All whitespace characters are ignored. */
|
|
|
|
skip_spaces( &cur, limit );
|
|
|
|
if ( cur >= limit )
|
|
|
|
break;
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
if ( !IS_PS_XDIGIT( *cur ) )
|
2003-10-07 07:49:41 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( cur < limit && *cur != '>' )
|
2005-02-13 22:42:42 +01:00
|
|
|
{
|
|
|
|
FT_ERROR(( "skip_string: missing closing delimiter `>'\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
err = FT_THROW( Invalid_File_Format );
|
2005-02-13 22:42:42 +01:00
|
|
|
}
|
2003-10-07 07:49:41 +02:00
|
|
|
else
|
|
|
|
cur++;
|
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
*acur = cur;
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* first character must be the opening brace that */
|
|
|
|
/* starts the procedure */
|
|
|
|
|
|
|
|
/* NB: [ and ] need not match: */
|
|
|
|
/* `/foo {[} def' is a valid PostScript fragment, */
|
|
|
|
/* even within a Type1 font */
|
|
|
|
|
|
|
|
static FT_Error
|
|
|
|
skip_procedure( FT_Byte* *acur,
|
|
|
|
FT_Byte* limit )
|
|
|
|
{
|
|
|
|
FT_Byte* cur;
|
|
|
|
FT_Int embed = 0;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2006-06-26 11:40:00 +02:00
|
|
|
|
|
|
|
|
|
|
|
FT_ASSERT( **acur == '{' );
|
|
|
|
|
2016-12-26 23:57:45 +01:00
|
|
|
for ( cur = *acur; cur < limit && error == FT_Err_Ok; cur++ )
|
2006-06-26 11:40:00 +02:00
|
|
|
{
|
|
|
|
switch ( *cur )
|
|
|
|
{
|
|
|
|
case '{':
|
2016-12-26 23:57:45 +01:00
|
|
|
embed++;
|
2006-06-26 11:40:00 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
case '}':
|
2016-12-26 23:57:45 +01:00
|
|
|
embed--;
|
2006-06-26 11:40:00 +02:00
|
|
|
if ( embed == 0 )
|
|
|
|
{
|
2016-12-26 23:57:45 +01:00
|
|
|
cur++;
|
2006-06-26 11:40:00 +02:00
|
|
|
goto end;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '(':
|
|
|
|
error = skip_literal_string( &cur, limit );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '<':
|
|
|
|
error = skip_string( &cur, limit );
|
|
|
|
break;
|
|
|
|
|
|
|
|
case '%':
|
|
|
|
skip_comment( &cur, limit );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
end:
|
|
|
|
if ( embed != 0 )
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2006-06-26 11:40:00 +02:00
|
|
|
|
|
|
|
*acur = cur;
|
|
|
|
|
|
|
|
return error;
|
2003-10-07 07:49:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***********************************************************************/
|
|
|
|
/* */
|
|
|
|
/* All exported parsing routines handle leading whitespace and stop at */
|
|
|
|
/* the first character which isn't part of the just handled token. */
|
|
|
|
/* */
|
|
|
|
/***********************************************************************/
|
|
|
|
|
|
|
|
|
2003-07-24 08:16:21 +02:00
|
|
|
FT_LOCAL_DEF( void )
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_PS_token( PS_Parser parser )
|
2003-07-24 08:16:21 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
/* Note: PostScript allows any non-delimiting, non-whitespace */
|
|
|
|
/* character in a name (PS Ref Manual, 3rd ed, p31). */
|
|
|
|
/* PostScript delimiters are (, ), <, >, [, ], {, }, /, and %. */
|
|
|
|
|
|
|
|
FT_Byte* cur = parser->cursor;
|
|
|
|
FT_Byte* limit = parser->limit;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
|
|
|
|
skip_spaces( &cur, limit ); /* this also skips comments */
|
|
|
|
if ( cur >= limit )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
/* self-delimiting, single-character tokens */
|
2006-06-26 11:40:00 +02:00
|
|
|
if ( *cur == '[' || *cur == ']' )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
cur++;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
/* skip balanced expressions (procedures and strings) */
|
|
|
|
|
|
|
|
if ( *cur == '{' ) /* {...} */
|
|
|
|
{
|
|
|
|
error = skip_procedure( &cur, limit );
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
if ( *cur == '(' ) /* (...) */
|
|
|
|
{
|
2006-06-26 11:40:00 +02:00
|
|
|
error = skip_literal_string( &cur, limit );
|
2003-10-07 07:49:41 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( *cur == '<' ) /* <...> */
|
|
|
|
{
|
|
|
|
if ( cur + 1 < limit && *(cur + 1) == '<' ) /* << */
|
|
|
|
{
|
|
|
|
cur++;
|
|
|
|
cur++;
|
|
|
|
}
|
2006-06-26 11:40:00 +02:00
|
|
|
else
|
|
|
|
error = skip_string( &cur, limit );
|
|
|
|
|
|
|
|
goto Exit;
|
2003-10-07 07:49:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( *cur == '>' )
|
|
|
|
{
|
|
|
|
cur++;
|
|
|
|
if ( cur >= limit || *cur != '>' ) /* >> */
|
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "ps_parser_skip_PS_token:"
|
|
|
|
" unexpected closing delimiter `>'\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2003-10-07 07:49:41 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
cur++;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( *cur == '/' )
|
|
|
|
cur++;
|
|
|
|
|
|
|
|
/* anything else */
|
|
|
|
while ( cur < limit )
|
|
|
|
{
|
2006-06-26 19:37:44 +02:00
|
|
|
/* *cur might be invalid (e.g., ')' or '}'), but this */
|
|
|
|
/* is handled by the test `cur == parser->cursor' below */
|
2006-06-26 11:40:00 +02:00
|
|
|
if ( IS_PS_DELIM( *cur ) )
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
break;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
cur++;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2012-02-26 05:26:56 +01:00
|
|
|
if ( cur < limit && cur == parser->cursor )
|
2006-06-26 19:37:44 +02:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "ps_parser_skip_PS_token:"
|
|
|
|
" current token is `%c' which is self-delimiting\n"
|
|
|
|
" "
|
|
|
|
" but invalid at this point\n",
|
2006-06-26 19:37:44 +02:00
|
|
|
*cur ));
|
2007-01-16 07:11:27 +01:00
|
|
|
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2006-06-26 19:37:44 +02:00
|
|
|
}
|
|
|
|
|
2015-09-12 08:32:55 +02:00
|
|
|
if ( cur > limit )
|
|
|
|
cur = limit;
|
|
|
|
|
2006-06-26 11:40:00 +02:00
|
|
|
parser->error = error;
|
2003-10-07 07:49:41 +02:00
|
|
|
parser->cursor = cur;
|
2003-07-24 08:16:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
FT_LOCAL_DEF( void )
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( PS_Parser parser )
|
2003-07-24 08:16:21 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_spaces( &parser->cursor, parser->limit );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* `token' here means either something between balanced delimiters */
|
|
|
|
/* or the next token; the delimiters are not removed. */
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_token( PS_Parser parser,
|
|
|
|
T1_Token token )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Byte* cur;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_Int embed;
|
|
|
|
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
token->type = T1_TOKEN_TYPE_NONE;
|
2015-04-13 05:16:48 +02:00
|
|
|
token->start = NULL;
|
|
|
|
token->limit = NULL;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* first of all, skip leading whitespace */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
cur = parser->cursor;
|
|
|
|
limit = parser->limit;
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
if ( cur >= limit )
|
|
|
|
return;
|
|
|
|
|
|
|
|
switch ( *cur )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
/************* check for literal string *****************/
|
|
|
|
case '(':
|
|
|
|
token->type = T1_TOKEN_TYPE_STRING;
|
|
|
|
token->start = cur;
|
2006-06-26 11:40:00 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
if ( skip_literal_string( &cur, limit ) == FT_Err_Ok )
|
2003-10-07 07:49:41 +02:00
|
|
|
token->limit = cur;
|
|
|
|
break;
|
|
|
|
|
|
|
|
/************* check for programs/array *****************/
|
|
|
|
case '{':
|
2006-06-26 11:40:00 +02:00
|
|
|
token->type = T1_TOKEN_TYPE_ARRAY;
|
|
|
|
token->start = cur;
|
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
if ( skip_procedure( &cur, limit ) == FT_Err_Ok )
|
2006-06-26 11:40:00 +02:00
|
|
|
token->limit = cur;
|
|
|
|
break;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
/************* check for table/array ********************/
|
2006-06-26 11:40:00 +02:00
|
|
|
/* XXX: in theory we should also look for "<<" */
|
|
|
|
/* since this is semantically equivalent to "["; */
|
|
|
|
/* in practice it doesn't matter (?) */
|
2003-10-07 07:49:41 +02:00
|
|
|
case '[':
|
2006-06-26 11:40:00 +02:00
|
|
|
token->type = T1_TOKEN_TYPE_ARRAY;
|
2003-10-07 07:49:41 +02:00
|
|
|
embed = 1;
|
|
|
|
token->start = cur++;
|
|
|
|
|
|
|
|
/* we need this to catch `[ ]' */
|
|
|
|
parser->cursor = cur;
|
|
|
|
ps_parser_skip_spaces( parser );
|
|
|
|
cur = parser->cursor;
|
|
|
|
|
|
|
|
while ( cur < limit && !parser->error )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2006-06-26 11:40:00 +02:00
|
|
|
/* XXX: this is wrong because it does not */
|
|
|
|
/* skip comments, procedures, and strings */
|
|
|
|
if ( *cur == '[' )
|
2003-10-07 07:49:41 +02:00
|
|
|
embed++;
|
2006-06-26 11:40:00 +02:00
|
|
|
else if ( *cur == ']' )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
embed--;
|
|
|
|
if ( embed <= 0 )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
token->limit = ++cur;
|
|
|
|
break;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
parser->cursor = cur;
|
|
|
|
ps_parser_skip_PS_token( parser );
|
|
|
|
/* we need this to catch `[XXX ]' */
|
|
|
|
ps_parser_skip_spaces ( parser );
|
|
|
|
cur = parser->cursor;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
2003-10-07 07:49:41 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
/* ************ otherwise, it is any token **************/
|
|
|
|
default:
|
|
|
|
token->start = cur;
|
2016-12-25 22:55:25 +01:00
|
|
|
token->type = ( *cur == '/' ) ? T1_TOKEN_TYPE_KEY : T1_TOKEN_TYPE_ANY;
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_PS_token( parser );
|
|
|
|
cur = parser->cursor;
|
|
|
|
if ( !parser->error )
|
|
|
|
token->limit = cur;
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
if ( !token->limit )
|
|
|
|
{
|
2015-04-13 05:16:48 +02:00
|
|
|
token->start = NULL;
|
2003-10-07 07:49:41 +02:00
|
|
|
token->type = T1_TOKEN_TYPE_NONE;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
parser->cursor = cur;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* NB: `tokens' can be NULL if we only want to count */
|
|
|
|
/* the number of array elements */
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_token_array( PS_Parser parser,
|
|
|
|
T1_Token tokens,
|
|
|
|
FT_UInt max_tokens,
|
|
|
|
FT_Int* pnum_tokens )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_TokenRec master;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
*pnum_tokens = -1;
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* this also handles leading whitespace */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_token( parser, &master );
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
if ( master.type == T1_TOKEN_TYPE_ARRAY )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* old_cursor = parser->cursor;
|
|
|
|
FT_Byte* old_limit = parser->limit;
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_Token cur = tokens;
|
|
|
|
T1_Token limit = cur + max_tokens;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* don't include outermost delimiters */
|
|
|
|
parser->cursor = master.start + 1;
|
|
|
|
parser->limit = master.limit - 1;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
while ( parser->cursor < parser->limit )
|
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_TokenRec token;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_token( parser, &token );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !token.type )
|
|
|
|
break;
|
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( tokens && cur < limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
*cur = token;
|
|
|
|
|
|
|
|
cur++;
|
|
|
|
}
|
|
|
|
|
2001-03-10 18:07:42 +01:00
|
|
|
*pnum_tokens = (FT_Int)( cur - tokens );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
parser->cursor = old_cursor;
|
|
|
|
parser->limit = old_limit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* first character must be a delimiter or a part of a number */
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* NB: `coords' can be NULL if we just want to skip the */
|
|
|
|
/* array; in this case we ignore `max_coords' */
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Int
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_tocoordarray( FT_Byte* *acur,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Int max_coords,
|
|
|
|
FT_Short* coords )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_Int count = 0;
|
|
|
|
FT_Byte c, ender;
|
|
|
|
|
|
|
|
|
|
|
|
if ( cur >= limit )
|
|
|
|
goto Exit;
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* check for the beginning of an array; otherwise, only one number */
|
|
|
|
/* will be read */
|
2000-08-17 03:09:06 +02:00
|
|
|
c = *cur;
|
|
|
|
ender = 0;
|
|
|
|
|
|
|
|
if ( c == '[' )
|
|
|
|
ender = ']';
|
2007-06-05 22:50:37 +02:00
|
|
|
else if ( c == '{' )
|
2000-08-17 03:09:06 +02:00
|
|
|
ender = '}';
|
|
|
|
|
|
|
|
if ( ender )
|
|
|
|
cur++;
|
|
|
|
|
|
|
|
/* now, read the coordinates */
|
2003-10-07 07:49:41 +02:00
|
|
|
while ( cur < limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2007-06-05 22:50:37 +02:00
|
|
|
FT_Short dummy;
|
|
|
|
FT_Byte* old_cur;
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
/* skip whitespace in front of data */
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_spaces( &cur, limit );
|
|
|
|
if ( cur >= limit )
|
|
|
|
goto Exit;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
if ( *cur == ender )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
cur++;
|
2000-08-17 03:09:06 +02:00
|
|
|
break;
|
2003-10-07 07:49:41 +02:00
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2007-06-05 22:50:37 +02:00
|
|
|
old_cur = cur;
|
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( coords && count >= max_coords )
|
2007-06-18 09:07:55 +02:00
|
|
|
break;
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* call PS_Conv_ToFixed() even if coords == NULL */
|
|
|
|
/* to properly parse number at `cur' */
|
2016-12-26 17:08:17 +01:00
|
|
|
*( coords ? &coords[count] : &dummy ) =
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
(FT_Short)( PS_Conv_ToFixed( &cur, limit, 0 ) >> 16 );
|
2007-06-05 22:50:37 +02:00
|
|
|
|
|
|
|
if ( old_cur == cur )
|
|
|
|
{
|
|
|
|
count = -1;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
count++;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
if ( !ender )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2003-10-07 07:49:41 +02:00
|
|
|
*acur = cur;
|
2000-08-17 03:09:06 +02:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* first character must be a delimiter or a part of a number */
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* NB: `values' can be NULL if we just want to skip the */
|
2007-06-05 22:50:37 +02:00
|
|
|
/* array; in this case we ignore `max_values' */
|
2014-01-23 08:14:53 +01:00
|
|
|
/* */
|
|
|
|
/* return number of successfully parsed values */
|
2003-10-07 07:49:41 +02:00
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_Int
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_tofixedarray( FT_Byte* *acur,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Int max_values,
|
|
|
|
FT_Fixed* values,
|
|
|
|
FT_Int power_ten )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_Int count = 0;
|
|
|
|
FT_Byte c, ender;
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
if ( cur >= limit )
|
|
|
|
goto Exit;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* Check for the beginning of an array. Otherwise, only one number */
|
|
|
|
/* will be read. */
|
2000-08-17 03:09:06 +02:00
|
|
|
c = *cur;
|
|
|
|
ender = 0;
|
|
|
|
|
|
|
|
if ( c == '[' )
|
|
|
|
ender = ']';
|
2007-06-05 22:50:37 +02:00
|
|
|
else if ( c == '{' )
|
2000-08-17 03:09:06 +02:00
|
|
|
ender = '}';
|
|
|
|
|
|
|
|
if ( ender )
|
|
|
|
cur++;
|
|
|
|
|
|
|
|
/* now, read the values */
|
2003-10-07 07:49:41 +02:00
|
|
|
while ( cur < limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2007-06-05 22:50:37 +02:00
|
|
|
FT_Fixed dummy;
|
|
|
|
FT_Byte* old_cur;
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
/* skip whitespace in front of data */
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_spaces( &cur, limit );
|
|
|
|
if ( cur >= limit )
|
|
|
|
goto Exit;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
if ( *cur == ender )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
|
|
|
cur++;
|
2000-08-17 03:09:06 +02:00
|
|
|
break;
|
2003-10-07 07:49:41 +02:00
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2007-06-05 22:50:37 +02:00
|
|
|
old_cur = cur;
|
|
|
|
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( values && count >= max_values )
|
2007-06-18 09:07:55 +02:00
|
|
|
break;
|
|
|
|
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
/* call PS_Conv_ToFixed() even if coords == NULL */
|
|
|
|
/* to properly parse number at `cur' */
|
2016-12-26 17:08:17 +01:00
|
|
|
*( values ? &values[count] : &dummy ) =
|
* freetype2/include/freetype/internal/psaux.h: New macros
IS_PS_NEWLINE, IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT,
IS_PS_XDIGIT, and IS_PS_BASE85 (from freetype2/src/psaux/psconv.h).
(T1_FieldLocation): Add T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE, and T1_FIELD_LOCATION_BLEND.
(T1_DecoderRec): New fields `buildchar' and `face'.
(IS_PS_TOKEN): New macro.
* freetype2/include/freetype/internal/t1types.h (T1_FaceRec): New
fields `ndv_idx', `cdv_idx', and `len_buildchar'.
* freetype2/include/freetype/t1tables.h (PS_BlendRec): New fields
`default_design_vector' and `num_default_design_vector'.
* freetype2/src/psaux/psconv.h: Move macros IS_PS_NEWLINE,
IS_PS_SPACE, IS_PS_SPECIAL, IS_PS_DELIM, IS_PS_DIGIT, IS_PS_XDIGIT,
and IS_PS_BASE85 to freetype2/include/freetype/internal/psaux.h.
* freetype2/src/psaux/psobjs.c (ps_parser_to_token_array): Allow
`token' argument to be NULL if we want only to count the number of
tokens.
(ps_tocoordarray): Allow `coords' argument to be NULL if we just
want to skip the array.
(ps_tofixedarray): Allow `values' argument to be NULL if we just
want to skip the array.
* freetype2/src/psaux/t1decode.c (t1_decoder_parse_charstrings): Add
support for (partially commented out) othersubrs 19-25, 27, and 28.
(t1_decoder_init): Initialize new fields `face' and `buildchar'.
(t1_decoder_done): Release new field `buildchar'.
* freetype2/src/type1/t1load.c (parse_buildchar, parse_private): New
functions.
(t1_keywords): Register them.
(t1_allocate_blend): Updated.
(t1_load_keyword): Handle field types T1_FIELD_LOCATION_LOADER,
T1_FIELD_LOCATION_FACE and T1_FIELD_LOCATION_BLEND.
(parse_dict): Remove `keyword_flags' argument.
Use new macro IS_PS_TOKEN.
Changed function so that later PostScript definitions override
earlier ones.
(t1_init_loader): Initialize new field `keywords_encountered'.
(T1_Open_Face): Initialize new fields `ndv_idx', `cdv_idx', and
`len_buildchar'.
Remove `keywords_flags'.
* freetype2/src/type1/t1load.h (T1_LoaderRect): New field
`keywords_encountered'.
(T1_PRIVATE, T1_FONTDIR_AFTER_PRIVATE): New macros.
* freetype2/src/type1/t1tokens.h [!T1_CONFIG_OPTION_NO_MM_SUPPORT]:
New entries for parsing /NDV, /CDV, and /DesignVector.
2006-07-14 20:28:08 +02:00
|
|
|
PS_Conv_ToFixed( &cur, limit, power_ten );
|
2007-06-05 22:50:37 +02:00
|
|
|
|
|
|
|
if ( old_cur == cur )
|
|
|
|
{
|
|
|
|
count = -1;
|
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
count++;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
if ( !ender )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
Exit:
|
2003-10-07 07:49:41 +02:00
|
|
|
*acur = cur;
|
2000-08-17 03:09:06 +02:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static FT_String*
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_tostring( FT_Byte** cursor,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Memory memory )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Byte* cur = *cursor;
|
2015-02-18 09:22:06 +01:00
|
|
|
FT_UInt len = 0;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_Int count;
|
|
|
|
FT_String* result;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
/* XXX: some stupid fonts have a `Notice' or `Copyright' string */
|
|
|
|
/* that simply doesn't begin with an opening parenthesis, even */
|
|
|
|
/* though they have a closing one! E.g. "amuncial.pfb" */
|
|
|
|
/* */
|
|
|
|
/* We must deal with these ill-fated cases there. Note that */
|
|
|
|
/* these fonts didn't work with the old Type 1 driver as the */
|
|
|
|
/* notice/copyright was not recognized as a valid string token */
|
|
|
|
/* and made the old token parser commit errors. */
|
|
|
|
|
|
|
|
while ( cur < limit && ( *cur == ' ' || *cur == '\t' ) )
|
|
|
|
cur++;
|
|
|
|
if ( cur + 1 >= limit )
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if ( *cur == '(' )
|
|
|
|
cur++; /* skip the opening parenthesis, if there is one */
|
|
|
|
|
|
|
|
*cursor = cur;
|
|
|
|
count = 0;
|
|
|
|
|
|
|
|
/* then, count its length */
|
|
|
|
for ( ; cur < limit; cur++ )
|
|
|
|
{
|
|
|
|
if ( *cur == '(' )
|
|
|
|
count++;
|
|
|
|
|
|
|
|
else if ( *cur == ')' )
|
|
|
|
{
|
|
|
|
count--;
|
|
|
|
if ( count < 0 )
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-02-18 09:22:06 +01:00
|
|
|
len = (FT_UInt)( cur - *cursor );
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( cur >= limit || FT_ALLOC( result, len + 1 ) )
|
2000-08-17 03:09:06 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
/* now copy the string */
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( result, *cursor, len );
|
2000-08-17 03:09:06 +02:00
|
|
|
result[len] = '\0';
|
|
|
|
*cursor = cur;
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
2001-06-27 21:46:12 +02:00
|
|
|
static int
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_tobool( FT_Byte* *acur,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Byte* limit )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
FT_Byte* cur = *acur;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_Bool result = 0;
|
|
|
|
|
|
|
|
|
|
|
|
/* return 1 if we find `true', 0 otherwise */
|
|
|
|
if ( cur + 3 < limit &&
|
2003-10-07 07:49:41 +02:00
|
|
|
cur[0] == 't' &&
|
|
|
|
cur[1] == 'r' &&
|
|
|
|
cur[2] == 'u' &&
|
|
|
|
cur[3] == 'e' )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
result = 1;
|
|
|
|
cur += 5;
|
|
|
|
}
|
|
|
|
else if ( cur + 4 < limit &&
|
2003-10-07 07:49:41 +02:00
|
|
|
cur[0] == 'f' &&
|
|
|
|
cur[1] == 'a' &&
|
|
|
|
cur[2] == 'l' &&
|
|
|
|
cur[3] == 's' &&
|
|
|
|
cur[4] == 'e' )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
result = 0;
|
|
|
|
cur += 6;
|
|
|
|
}
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
*acur = cur;
|
2000-08-17 03:09:06 +02:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* load a simple field (i.e. non-table) into the current list of objects */
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_load_field( PS_Parser parser,
|
|
|
|
const T1_Field field,
|
|
|
|
void** objects,
|
|
|
|
FT_UInt max_objects,
|
|
|
|
FT_ULong* pflags )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2012-12-23 21:14:37 +01:00
|
|
|
T1_TokenRec token;
|
|
|
|
FT_Byte* cur;
|
|
|
|
FT_Byte* limit;
|
|
|
|
FT_UInt count;
|
|
|
|
FT_UInt idx;
|
|
|
|
FT_Error error;
|
|
|
|
T1_FieldType type;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* this also skips leading whitespace */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_token( parser, &token );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !token.type )
|
|
|
|
goto Fail;
|
|
|
|
|
|
|
|
count = 1;
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
idx = 0;
|
2000-08-17 03:09:06 +02:00
|
|
|
cur = token.start;
|
|
|
|
limit = token.limit;
|
|
|
|
|
2012-12-23 21:14:37 +01:00
|
|
|
type = field->type;
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* we must detect arrays in /FontBBox */
|
2012-12-23 21:14:37 +01:00
|
|
|
if ( type == T1_FIELD_TYPE_BBOX )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-07-11 13:26:21 +02:00
|
|
|
T1_TokenRec token2;
|
|
|
|
FT_Byte* old_cur = parser->cursor;
|
|
|
|
FT_Byte* old_limit = parser->limit;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
/* don't include delimiters */
|
|
|
|
parser->cursor = token.start + 1;
|
|
|
|
parser->limit = token.limit - 1;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
|
|
|
|
ps_parser_to_token( parser, &token2 );
|
2002-07-11 13:26:21 +02:00
|
|
|
parser->cursor = old_cur;
|
|
|
|
parser->limit = old_limit;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
|
2002-07-11 13:26:21 +02:00
|
|
|
if ( token2.type == T1_TOKEN_TYPE_ARRAY )
|
2012-12-23 21:14:37 +01:00
|
|
|
{
|
|
|
|
type = T1_FIELD_TYPE_MM_BBOX;
|
2002-07-11 13:26:21 +02:00
|
|
|
goto FieldArray;
|
2012-12-23 21:14:37 +01:00
|
|
|
}
|
2002-07-11 13:26:21 +02:00
|
|
|
}
|
|
|
|
else if ( token.type == T1_TOKEN_TYPE_ARRAY )
|
|
|
|
{
|
2012-12-23 21:14:37 +01:00
|
|
|
count = max_objects;
|
|
|
|
|
2002-07-11 13:26:21 +02:00
|
|
|
FieldArray:
|
2003-10-07 07:49:41 +02:00
|
|
|
/* if this is an array and we have no blend, an error occurs */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( max_objects == 0 )
|
|
|
|
goto Fail;
|
|
|
|
|
2012-12-23 21:14:37 +01:00
|
|
|
idx = 1;
|
2003-10-07 07:49:41 +02:00
|
|
|
|
|
|
|
/* don't include delimiters */
|
|
|
|
cur++;
|
|
|
|
limit--;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
* src/base/ftdbgmem.c (ft_mem_table_resize, ft_mem_table_new,
ft_mem_table_set, ft_mem_debug_alloc, ft_mem_debug_free,
ft_mem_debug_realloc, ft_mem_debug_done, FT_Alloc_Debug,
FT_Realloc_Debug, FT_Free_Debug): Fix compiler warnings.
* src/base/ftcalc.c (FT_MulFix): Ditto.
* src/cff/cffdrivr.c (cff_get_name_index): Ditto.
* src/cff/cffobjs.c (CFF_Size_Get_Global_Funcs, CFF_Size_Init,
CFF_GlyphSlot_Init): Ditto.
* src/cid/cidobjs.c (CID_GlyphSlot_Init,
CID_Size_Get_Globals_Funcs): Ditto.
* src/type1/t1objs.c (T1_Size_Get_Globals_Funcs, T1_GlyphSlot_Init):
Ditto.
* src/pshinter/pshmod.c (pshinter_interface): Use `static const'.
* src/winfonts/winfnt.c (FNT_Get_Next_Char): Remove unused
variables.
* include/freetype/internal/psaux.h (T1_Builder_Funcs): Renamed
to...
(T1_Builder_FuncsRec): This.
(T1_Builder_Funcs): New typedef.
(PSAux_Interface): Remove compiler warnings.
* src/psaux/psauxmod.c (t1_builder_funcs), src/psaux/psobjs.h
(t1_builder_funcs): Updated.
* src/pshinter/pshglob.h (PSH_Blue_Align): Replaced with ...
(PSH_BLUE_ALIGN_{NONE,TOP,BOT}): New defines.
(PSH_AlignmentRec): Updated.
* include/freetype/internal/ftstream.h (GET_Char, GET_Byte): Fix
typo.
* include/freetype/internal/ftgloadr.h (FT_SubGlyph): Ditto.
* src/base/ftstream (FT_Get_Char): Rename to...
(FT_Stream_Get_Char): This.
* src/base/ftnames.c (FT_Get_Sfnt_Name): s/index/idx/ -- `index' is
a built-in function in gcc, causing warning messages with gcc 3.0.
* src/autohint/ahglyph.c (ah_outline_load): Ditto.
* src/autohint/ahglobal.c (ah_hinter_compute_blues): Ditto.
* src/cache/ftcmanag.c (ftc_family_table_alloc,
ftc_family_table_free, FTC_Manager_Done, FTC_Manager_Register_Cache):
Ditto.
* src/cff/cffload.c (cff_new_index, cff_done_index,
cff_explicit_index, CFF_Access_Element, CFF_Forget_Element,
CFF_Get_Name, CFF_Get_String, CFF_Load_SubFont, CFF_Load_Font,
CFF_Done_Font): Ditto.
* src/psaux/psobjs.c (PS_Table_Add, PS_Parser_LoadField): Ditto.
* src/psaux/t1decode.c (T1_Decoder_Parse_Charstrings): Ditto.
* src/pshinter/pshrec.c (ps_mask_test_bit, ps_mask_clear_bit,
ps_mask_set_bit, ps_dimension_add_t1stem, ps_hints_t1stem3,
* src/pshinter/pshalgo1.c (psh1_hint_table_record,
psh1_hint_table_record_mask, psh1_hint_table_activate_mask): Ditto.
* src/pshinter/pshalgo2.c (psh2_hint_table_record,
psh2_hint_table_record_mask, psh2_hint_table_activate_mask): Ditto.
* src/sfnt/ttpost.c (Load_Format_20, Load_Format_25,
TT_Get_PS_Name): Ditto.
* src/truetype/ttgload.c (TT_Get_Metrics, Get_HMetrics,
load_truetype_glyph): Ditto.
* src/type1/t1load.c (parse_subrs, T1_Open_Face): Ditto.
* src/type1/t1afm.c (T1_Get_Kerning): Ditto.
* include/freetype/cache/ftcmanag.h (ftc_family_table_free): Ditto.
2002-03-07 22:59:59 +01:00
|
|
|
for ( ; count > 0; count--, idx++ )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2016-05-21 11:20:42 +02:00
|
|
|
FT_Byte* q = (FT_Byte*)objects[idx] + field->offset;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_Long val;
|
2016-05-21 11:20:42 +02:00
|
|
|
FT_String* string = NULL;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
skip_spaces( &cur, limit );
|
|
|
|
|
2012-12-23 21:14:37 +01:00
|
|
|
switch ( type )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-02-28 17:10:29 +01:00
|
|
|
case T1_FIELD_TYPE_BOOL:
|
2003-10-07 07:49:41 +02:00
|
|
|
val = ps_tobool( &cur, limit );
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Store_Integer;
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
case T1_FIELD_TYPE_FIXED:
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
val = PS_Conv_ToFixed( &cur, limit, 0 );
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Store_Integer;
|
|
|
|
|
2003-06-06 07:07:53 +02:00
|
|
|
case T1_FIELD_TYPE_FIXED_1000:
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
val = PS_Conv_ToFixed( &cur, limit, 3 );
|
2003-06-06 07:07:53 +02:00
|
|
|
goto Store_Integer;
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
case T1_FIELD_TYPE_INTEGER:
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
val = PS_Conv_ToInt( &cur, limit );
|
2003-10-07 07:49:41 +02:00
|
|
|
/* fall through */
|
Avoid overwriting of numeric font dictionary entries for synthetic
fonts. Additionally, some entries were handled as `integer' instead
of `number'.
* include/freetype/internal/psaux.h (T1_FieldType): Add
T1_FIELD_TYPE_BOOL_P, T1_FIELD_TYPE_INTEGER_P, and
T1_FIELD_TYPE_FIXED_P.
(T1_FIELD_BOOL_P, T1_FIELD_NUM_P, T1_FIELD_FIXED_P): New macros.
* src/psaux/psobjs.c (ps_parser_load_field): Handle new field types.
* include/freetype/internal/cfftypes.h (CFF_FontRecDict),
src/cff/cfftoken.h: Change type of underline_position and
underline_thickness to FT_Fixed.
* src/cff/cffload.c (cff_subfont_load): Fix default values of
underline_position and underline_thickness.
* src/cff/cffobjs.c (cff_face_init): Set underline_position
and underline_thickness in `root'.
* include/freetype/internal/t1types.h (T1_Font): Change point_type
and stroke_width to pointers.
* include/freetype/t1tables.h (PS_FontInfo): Change italic_angle,
is_fixed_pitch, underline_position, and underline_thickness to
pointers.
* src/type1/t1tokens.h: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers. Change
the type of the latter two to `fixed'.
Change type of stroke_width to `fixed' and make it a pointer.
Change paint_type to pointer.
* src/type1/t1objs.c (T1_Face_Done): Updated.
(T1_Face_Init): Updated.
Fix assignment of underline_position and underline_thickness.
* src/cid/cidtoken.h: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers. Change
the type of the latter two to `fixed'.
Change type of stroke_width to `fixed'.
* src/cid/cidobjs.c (cid_face_done): Updated.
(cid_face_init): Updated.
Fix assignment of underline_position and underline_thickness.
* src/type42/t42parse.c: Change italic_angle, is_fixed_pitch,
underline_position, and underline_thickness to pointers. Change the
type of the latter two to `fixed'.
Change type of stroke_width to `fixed' and make it a pointer.
Change paint_type to pointer.
* src/type42/t42objs.c (T42_Face_Init): Updated.
Fix assignment of underline_position and underline_thickness.
(T42_Face_Done): Updated.
* src/base/ftobjs.c (open_face_from_buffer): Fix compiler warning.
* src/pshinter/pshglob.c, src/pshinter/pshglob.h
(psh_globals_set_scale): Make it a local function.
* test/gview.c: Fix remaming ps3->ps typo.
Formatting.
2003-05-30 11:12:50 +02:00
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
Store_Integer:
|
|
|
|
switch ( field->size )
|
|
|
|
{
|
2004-04-24 08:06:39 +02:00
|
|
|
case (8 / FT_CHAR_BIT):
|
2000-08-17 03:09:06 +02:00
|
|
|
*(FT_Byte*)q = (FT_Byte)val;
|
|
|
|
break;
|
|
|
|
|
2004-04-24 08:06:39 +02:00
|
|
|
case (16 / FT_CHAR_BIT):
|
2000-08-17 03:09:06 +02:00
|
|
|
*(FT_UShort*)q = (FT_UShort)val;
|
|
|
|
break;
|
|
|
|
|
2004-04-24 08:06:39 +02:00
|
|
|
case (32 / FT_CHAR_BIT):
|
2000-08-17 03:09:06 +02:00
|
|
|
*(FT_UInt32*)q = (FT_UInt32)val;
|
|
|
|
break;
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
default: /* for 64-bit systems */
|
2000-08-17 03:09:06 +02:00
|
|
|
*(FT_Long*)q = val;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
case T1_FIELD_TYPE_STRING:
|
2003-06-12 15:14:15 +02:00
|
|
|
case T1_FIELD_TYPE_KEY:
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Memory memory = parser->memory;
|
2001-03-10 18:07:42 +01:00
|
|
|
FT_UInt len = (FT_UInt)( limit - cur );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
if ( cur >= limit )
|
|
|
|
break;
|
|
|
|
|
2006-08-13 14:14:36 +02:00
|
|
|
/* we allow both a string or a name */
|
|
|
|
/* for cases like /FontName (foo) def */
|
|
|
|
if ( token.type == T1_TOKEN_TYPE_KEY )
|
2003-06-12 15:14:15 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
/* don't include leading `/' */
|
2003-06-12 15:14:15 +02:00
|
|
|
len--;
|
|
|
|
cur++;
|
|
|
|
}
|
2006-08-13 14:14:36 +02:00
|
|
|
else if ( token.type == T1_TOKEN_TYPE_STRING )
|
2003-10-07 07:49:41 +02:00
|
|
|
{
|
2006-08-13 14:14:36 +02:00
|
|
|
/* don't include delimiting parentheses */
|
|
|
|
/* XXX we don't handle <<...>> here */
|
|
|
|
/* XXX should we convert octal escapes? */
|
|
|
|
/* if so, what encoding should we use? */
|
2003-10-07 07:49:41 +02:00
|
|
|
cur++;
|
|
|
|
len -= 2;
|
|
|
|
}
|
2006-08-13 14:14:36 +02:00
|
|
|
else
|
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "ps_parser_load_field:"
|
|
|
|
" expected a name or string\n"
|
|
|
|
" "
|
|
|
|
" but found token of type %d instead\n",
|
2006-08-13 14:14:36 +02:00
|
|
|
token.type ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2006-08-13 14:14:36 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* for this to work (FT_String**)q must have been */
|
|
|
|
/* initialized to NULL */
|
2016-12-26 17:08:17 +01:00
|
|
|
if ( *(FT_String**)q )
|
2006-08-13 14:14:36 +02:00
|
|
|
{
|
|
|
|
FT_TRACE0(( "ps_parser_load_field: overwriting field %s\n",
|
|
|
|
field->ident ));
|
|
|
|
FT_FREE( *(FT_String**)q );
|
|
|
|
*(FT_String**)q = NULL;
|
|
|
|
}
|
2003-06-12 15:14:15 +02:00
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
if ( FT_ALLOC( string, len + 1 ) )
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Exit;
|
|
|
|
|
2002-03-22 14:52:37 +01:00
|
|
|
FT_MEM_COPY( string, cur, len );
|
2000-08-17 03:09:06 +02:00
|
|
|
string[len] = 0;
|
|
|
|
|
|
|
|
*(FT_String**)q = string;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2002-07-11 13:26:21 +02:00
|
|
|
case T1_FIELD_TYPE_BBOX:
|
|
|
|
{
|
|
|
|
FT_Fixed temp[4];
|
|
|
|
FT_BBox* bbox = (FT_BBox*)q;
|
2007-06-05 22:50:37 +02:00
|
|
|
FT_Int result;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
|
2002-07-26 11:09:10 +02:00
|
|
|
|
2007-06-18 09:07:55 +02:00
|
|
|
result = ps_tofixedarray( &cur, limit, 4, temp, 0 );
|
2007-06-05 22:50:37 +02:00
|
|
|
|
2014-01-23 08:14:53 +01:00
|
|
|
if ( result < 4 )
|
2007-06-05 22:50:37 +02:00
|
|
|
{
|
2009-06-26 06:15:41 +02:00
|
|
|
FT_ERROR(( "ps_parser_load_field:"
|
|
|
|
" expected four integers in bounding box\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2007-06-05 22:50:37 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
2002-07-11 13:26:21 +02:00
|
|
|
|
|
|
|
bbox->xMin = FT_RoundFix( temp[0] );
|
|
|
|
bbox->yMin = FT_RoundFix( temp[1] );
|
|
|
|
bbox->xMax = FT_RoundFix( temp[2] );
|
|
|
|
bbox->yMax = FT_RoundFix( temp[3] );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2012-12-23 21:14:37 +01:00
|
|
|
case T1_FIELD_TYPE_MM_BBOX:
|
|
|
|
{
|
|
|
|
FT_Memory memory = parser->memory;
|
2016-05-21 11:20:42 +02:00
|
|
|
FT_Fixed* temp = NULL;
|
2012-12-23 21:14:37 +01:00
|
|
|
FT_Int result;
|
|
|
|
FT_UInt i;
|
|
|
|
|
|
|
|
|
|
|
|
if ( FT_NEW_ARRAY( temp, max_objects * 4 ) )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
for ( i = 0; i < 4; i++ )
|
|
|
|
{
|
2015-02-25 11:20:20 +01:00
|
|
|
result = ps_tofixedarray( &cur, limit, (FT_Int)max_objects,
|
2012-12-23 21:14:37 +01:00
|
|
|
temp + i * max_objects, 0 );
|
2014-01-23 08:14:53 +01:00
|
|
|
if ( result < 0 || (FT_UInt)result < max_objects )
|
2012-12-23 21:14:37 +01:00
|
|
|
{
|
|
|
|
FT_ERROR(( "ps_parser_load_field:"
|
2015-09-17 16:31:58 +02:00
|
|
|
" expected %d integer%s in the %s subarray\n"
|
2012-12-23 21:14:37 +01:00
|
|
|
" "
|
|
|
|
" of /FontBBox in the /Blend dictionary\n",
|
2015-09-17 16:31:58 +02:00
|
|
|
max_objects, max_objects > 1 ? "s" : "",
|
2012-12-23 21:14:37 +01:00
|
|
|
i == 0 ? "first"
|
|
|
|
: ( i == 1 ? "second"
|
|
|
|
: ( i == 2 ? "third"
|
|
|
|
: "fourth" ) ) ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2015-09-17 17:56:53 +02:00
|
|
|
|
|
|
|
FT_FREE( temp );
|
2012-12-23 21:14:37 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
skip_spaces( &cur, limit );
|
|
|
|
}
|
|
|
|
|
|
|
|
for ( i = 0; i < max_objects; i++ )
|
|
|
|
{
|
|
|
|
FT_BBox* bbox = (FT_BBox*)objects[i];
|
|
|
|
|
|
|
|
|
|
|
|
bbox->xMin = FT_RoundFix( temp[i ] );
|
|
|
|
bbox->yMin = FT_RoundFix( temp[i + max_objects] );
|
|
|
|
bbox->xMax = FT_RoundFix( temp[i + 2 * max_objects] );
|
|
|
|
bbox->yMax = FT_RoundFix( temp[i + 3 * max_objects] );
|
|
|
|
}
|
|
|
|
|
|
|
|
FT_FREE( temp );
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
default:
|
2007-01-26 23:18:56 +01:00
|
|
|
/* an error occurred */
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Fail;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
#if 0 /* obsolete -- keep for reference */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( pflags )
|
|
|
|
*pflags |= 1L << field->flag_bit;
|
2000-08-24 00:47:44 +02:00
|
|
|
#else
|
2000-10-31 21:42:18 +01:00
|
|
|
FT_UNUSED( pflags );
|
2000-08-24 00:47:44 +02:00
|
|
|
#endif
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
|
|
|
|
Fail:
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
2000-08-17 03:09:06 +02:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#define T1_MAX_TABLE_ELEMENTS 32
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_load_field_table( PS_Parser parser,
|
|
|
|
const T1_Field field,
|
|
|
|
void** objects,
|
|
|
|
FT_UInt max_objects,
|
|
|
|
FT_ULong* pflags )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2002-03-31 13:18:15 +02:00
|
|
|
T1_TokenRec elements[T1_MAX_TABLE_ELEMENTS];
|
|
|
|
T1_Token token;
|
|
|
|
FT_Int num_elements;
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* old_cursor;
|
|
|
|
FT_Byte* old_limit;
|
|
|
|
T1_FieldRec fieldrec = *(T1_Field)field;
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2002-02-28 17:10:29 +01:00
|
|
|
fieldrec.type = T1_FIELD_TYPE_INTEGER;
|
2006-06-26 11:40:00 +02:00
|
|
|
if ( field->type == T1_FIELD_TYPE_FIXED_ARRAY ||
|
|
|
|
field->type == T1_FIELD_TYPE_BBOX )
|
2002-02-28 17:10:29 +01:00
|
|
|
fieldrec.type = T1_FIELD_TYPE_FIXED;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_to_token_array( parser, elements,
|
|
|
|
T1_MAX_TABLE_ELEMENTS, &num_elements );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( num_elements < 0 )
|
2004-02-12 09:33:20 +01:00
|
|
|
{
|
2013-03-14 17:50:49 +01:00
|
|
|
error = FT_ERR( Ignore );
|
2004-02-12 09:33:20 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
2007-06-18 09:07:55 +02:00
|
|
|
if ( (FT_UInt)num_elements > field->array_max )
|
2015-02-25 11:20:20 +01:00
|
|
|
num_elements = (FT_Int)field->array_max;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
old_cursor = parser->cursor;
|
|
|
|
old_limit = parser->limit;
|
|
|
|
|
2009-01-09 08:58:08 +01:00
|
|
|
/* we store the elements count if necessary; */
|
|
|
|
/* we further assume that `count_offset' can't be zero */
|
|
|
|
if ( field->type != T1_FIELD_TYPE_BBOX && field->count_offset != 0 )
|
2006-06-26 11:40:00 +02:00
|
|
|
*(FT_Byte*)( (FT_Byte*)objects[0] + field->count_offset ) =
|
|
|
|
(FT_Byte)num_elements;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
/* we now load each element, adjusting the field.offset on each one */
|
|
|
|
token = elements;
|
|
|
|
for ( ; num_elements > 0; num_elements--, token++ )
|
|
|
|
{
|
|
|
|
parser->cursor = token->start;
|
|
|
|
parser->limit = token->limit;
|
[Savannah bug #43682] Properly handle missing return errors.
The functions in this patch *do* return non-trivial errors that must
be taken care of.
* src/autofit/afloader.c (af_loader_load_g), src/base/ftobjs.c
(FT_Render_Glyph_Internal), src/base/ftoutln.c (FT_Outline_Render),
src/cff/cffgload.c (cff_decoder_parse_charstrings) <cff_op_endchar>,
src/psaux/psobjs.c (ps_parser_load_field_table), src/psaux/t1decode
(t1_decoder_parse_charstrings) <op_endchar>, src/truetype/ttgload.c
(load_truetype_glyph <subglyph loop>, tt_loader_init,
TT_Load_Glyph), src/truetype/ttgxvar.c (TT_Set_MM_Blend),
src/truetype/ttobjs.c (tt_size_run_fpgm, tt_size_run_prep): Do it.
2014-11-25 08:53:09 +01:00
|
|
|
|
|
|
|
error = ps_parser_load_field( parser,
|
|
|
|
&fieldrec,
|
|
|
|
objects,
|
|
|
|
max_objects,
|
|
|
|
0 );
|
|
|
|
if ( error )
|
|
|
|
break;
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
fieldrec.offset += fieldrec.size;
|
|
|
|
}
|
|
|
|
|
2000-08-24 00:47:44 +02:00
|
|
|
#if 0 /* obsolete -- keep for reference */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( pflags )
|
|
|
|
*pflags |= 1L << field->flag_bit;
|
2000-08-24 00:47:44 +02:00
|
|
|
#else
|
2000-10-31 21:42:18 +01:00
|
|
|
FT_UNUSED( pflags );
|
2000-08-24 00:47:44 +02:00
|
|
|
#endif
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
parser->cursor = old_cursor;
|
|
|
|
parser->limit = old_limit;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Long )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_int( PS_Parser parser )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
return PS_Conv_ToInt( &parser->cursor, parser->limit );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
/* first character must be `<' if `delimiters' is non-zero */
|
|
|
|
|
2003-07-24 08:16:21 +02:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ps_parser_to_bytes( PS_Parser parser,
|
|
|
|
FT_Byte* bytes,
|
2009-07-31 17:30:17 +02:00
|
|
|
FT_Offset max_bytes,
|
2015-02-18 11:45:22 +01:00
|
|
|
FT_ULong* pnum_bytes,
|
2003-10-07 07:49:41 +02:00
|
|
|
FT_Bool delimiters )
|
2003-07-24 08:16:21 +02:00
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
FT_Error error = FT_Err_Ok;
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
FT_Byte* cur;
|
2007-01-16 07:11:27 +01:00
|
|
|
|
|
|
|
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
cur = parser->cursor;
|
|
|
|
|
|
|
|
if ( cur >= parser->limit )
|
|
|
|
goto Exit;
|
|
|
|
|
|
|
|
if ( delimiters )
|
|
|
|
{
|
|
|
|
if ( *cur != '<' )
|
|
|
|
{
|
2006-01-16 23:35:33 +01:00
|
|
|
FT_ERROR(( "ps_parser_to_bytes: Missing starting delimiter `<'\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur++;
|
|
|
|
}
|
|
|
|
|
|
|
|
*pnum_bytes = PS_Conv_ASCIIHexDecode( &cur,
|
|
|
|
parser->limit,
|
|
|
|
bytes,
|
|
|
|
max_bytes );
|
|
|
|
|
|
|
|
if ( delimiters )
|
|
|
|
{
|
|
|
|
if ( cur < parser->limit && *cur != '>' )
|
|
|
|
{
|
2007-06-18 19:00:05 +02:00
|
|
|
FT_ERROR(( "ps_parser_to_bytes: Missing closing delimiter `>'\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
error = FT_THROW( Invalid_File_Format );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
goto Exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
cur++;
|
|
|
|
}
|
|
|
|
|
|
|
|
parser->cursor = cur;
|
|
|
|
|
|
|
|
Exit:
|
|
|
|
return error;
|
2003-07-24 08:16:21 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Fixed )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_fixed( PS_Parser parser,
|
|
|
|
FT_Int power_ten )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
return PS_Conv_ToFixed( &parser->cursor, parser->limit, power_ten );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Int )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_coord_array( PS_Parser parser,
|
|
|
|
FT_Int max_coords,
|
|
|
|
FT_Short* coords )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
|
|
|
return ps_tocoordarray( &parser->cursor, parser->limit,
|
2000-08-17 03:09:06 +02:00
|
|
|
max_coords, coords );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Int )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_to_fixed_array( PS_Parser parser,
|
|
|
|
FT_Int max_values,
|
|
|
|
FT_Fixed* values,
|
|
|
|
FT_Int power_ten )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
ps_parser_skip_spaces( parser );
|
|
|
|
return ps_tofixedarray( &parser->cursor, parser->limit,
|
2000-08-17 03:09:06 +02:00
|
|
|
max_values, values, power_ten );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_String* )
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_ToString( PS_Parser parser )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
return ps_tostring( &parser->cursor, parser->limit, parser->memory );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Bool )
|
2002-02-28 17:10:29 +01:00
|
|
|
T1_ToBool( PS_Parser parser )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2003-10-07 07:49:41 +02:00
|
|
|
return ps_tobool( &parser->cursor, parser->limit );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* 0 */
|
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_init( PS_Parser parser,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Byte* base,
|
|
|
|
FT_Byte* limit,
|
|
|
|
FT_Memory memory )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2013-03-14 11:21:17 +01:00
|
|
|
parser->error = FT_Err_Ok;
|
2000-08-17 03:09:06 +02:00
|
|
|
parser->base = base;
|
2000-08-21 06:58:49 +02:00
|
|
|
parser->limit = limit;
|
2000-08-17 03:09:06 +02:00
|
|
|
parser->cursor = base;
|
|
|
|
parser->memory = memory;
|
2002-02-28 17:10:29 +01:00
|
|
|
parser->funcs = ps_parser_funcs;
|
2000-10-31 21:42:18 +01:00
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
ps_parser_done( PS_Parser parser )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2000-08-17 09:18:04 +02:00
|
|
|
FT_UNUSED( parser );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** T1 BUILDER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
/* t1_builder_init */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
2002-03-31 13:18:15 +02:00
|
|
|
/* hinting :: Whether hinting should be applied. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_init( T1_Builder builder,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Face face,
|
|
|
|
FT_Size size,
|
2001-10-18 13:49:26 +02:00
|
|
|
FT_GlyphSlot glyph,
|
|
|
|
FT_Bool hinting )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Start;
|
2000-08-17 03:09:06 +02:00
|
|
|
builder->load_points = 1;
|
|
|
|
|
|
|
|
builder->face = face;
|
|
|
|
builder->glyph = glyph;
|
2000-08-21 06:58:49 +02:00
|
|
|
builder->memory = face->memory;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
if ( glyph )
|
|
|
|
{
|
2002-02-24 03:59:24 +01:00
|
|
|
FT_GlyphLoader loader = glyph->internal->loader;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
builder->loader = loader;
|
|
|
|
builder->base = &loader->base.outline;
|
|
|
|
builder->current = &loader->current.outline;
|
2000-08-17 03:09:06 +02:00
|
|
|
FT_GlyphLoader_Rewind( loader );
|
2001-10-18 13:49:26 +02:00
|
|
|
|
2017-04-22 12:48:50 +02:00
|
|
|
builder->hints_globals = size->internal->module_data;
|
2015-04-13 05:16:48 +02:00
|
|
|
builder->hints_funcs = NULL;
|
2002-02-24 03:59:24 +01:00
|
|
|
|
2001-12-05 02:22:05 +01:00
|
|
|
if ( hinting )
|
2001-10-18 13:49:26 +02:00
|
|
|
builder->hints_funcs = glyph->internal->glyph_hints;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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-10-31 21:42:18 +01:00
|
|
|
|
2000-08-23 04:47:57 +02:00
|
|
|
builder->funcs = t1_builder_funcs;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
/* t1_builder_done */
|
2000-08-17 03:09:06 +02:00
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_done( T1_Builder builder )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2000-08-21 06:58:49 +02:00
|
|
|
FT_GlyphSlot glyph = builder->glyph;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
if ( glyph )
|
2000-08-21 06:58:49 +02:00
|
|
|
glyph->outline = *builder->base;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-03-31 13:18:15 +02:00
|
|
|
/* check that there is enough space for `count' more points */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_check_points( T1_Builder builder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Int count )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2005-10-28 18:14:14 +02:00
|
|
|
return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* add a new point, do not check space */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_add_point( T1_Builder builder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y,
|
|
|
|
FT_Byte flag )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
|
|
|
|
|
|
|
|
if ( builder->load_points )
|
|
|
|
{
|
|
|
|
FT_Vector* point = outline->points + outline->n_points;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
|
|
|
|
2000-08-23 19:32:42 +02:00
|
|
|
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
point->x = FIXED_TO_INT( x );
|
|
|
|
point->y = FIXED_TO_INT( y );
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
outline->n_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check space for a new on-curve point, then add it */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
2002-09-05 17:10:54 +02:00
|
|
|
t1_builder_add_point1( T1_Builder builder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
error = t1_builder_check_points( builder, 1 );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_add_point( builder, x, y, 1 );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2003-12-12 16:38:39 +01:00
|
|
|
/* check space for a new contour, then add it */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_add_contour( T1_Builder builder )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
2010-06-20 16:27:36 +02:00
|
|
|
/* this might happen in invalid fonts */
|
|
|
|
if ( !outline )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
|
2013-03-14 10:27:35 +01:00
|
|
|
return FT_THROW( Invalid_File_Format );
|
2010-06-20 16:27:36 +02:00
|
|
|
}
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !builder->load_points )
|
|
|
|
{
|
|
|
|
outline->n_contours++;
|
2013-03-14 11:21:17 +01:00
|
|
|
return FT_Err_Ok;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
2005-10-28 18:14:14 +02:00
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
if ( outline->n_contours > 0 )
|
2001-06-20 01:03:41 +02:00
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
outline->n_contours++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if a path was begun, add its first on-curve point */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( FT_Error )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_start_point( T1_Builder builder,
|
2002-03-31 13:18:15 +02:00
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
2013-03-14 17:50:49 +01:00
|
|
|
FT_Error error = FT_ERR( Invalid_File_Format );
|
2000-08-17 03:09:06 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* test whether we are building a new contour */
|
2004-05-13 14:59:59 +02:00
|
|
|
|
|
|
|
if ( builder->parse_state == T1_Parse_Have_Path )
|
2013-03-14 11:21:17 +01:00
|
|
|
error = FT_Err_Ok;
|
2010-06-08 08:37:11 +02:00
|
|
|
else
|
|
|
|
{
|
2004-05-13 14:59:59 +02:00
|
|
|
builder->parse_state = T1_Parse_Have_Path;
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
error = t1_builder_add_contour( builder );
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( !error )
|
2002-09-05 17:10:54 +02:00
|
|
|
error = t1_builder_add_point1( builder, x, y );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
2004-05-13 14:59:59 +02:00
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* close the current contour */
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_builder_close_contour( T1_Builder builder )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
2008-06-24 07:44:28 +02:00
|
|
|
FT_Int first;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2000-10-11 07:52:42 +02:00
|
|
|
|
2005-08-18 09:40:32 +02:00
|
|
|
if ( !outline )
|
|
|
|
return;
|
|
|
|
|
2008-06-24 07:44:28 +02:00
|
|
|
first = outline->n_contours <= 1
|
|
|
|
? 0 : outline->contours[outline->n_contours - 2] + 1;
|
|
|
|
|
2017-03-26 08:32:09 +02:00
|
|
|
/* in malformed fonts it can happen that a contour was started */
|
|
|
|
/* but no points were added */
|
|
|
|
if ( outline->n_contours && first == outline->n_points )
|
|
|
|
{
|
|
|
|
outline->n_contours--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2008-06-24 07:44:28 +02:00
|
|
|
/* We must not include the last point in the path if it */
|
|
|
|
/* is located on the first point. */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( outline->n_points > 1 )
|
|
|
|
{
|
2000-10-11 07:52:42 +02:00
|
|
|
FT_Vector* p1 = outline->points + first;
|
|
|
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
|
2000-08-17 03:09:06 +02:00
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
|
2000-10-11 07:52:42 +02:00
|
|
|
/* `delete' last point only if it coincides with the first */
|
|
|
|
/* point and it is not a control point (which can happen). */
|
2000-08-17 03:09:06 +02:00
|
|
|
if ( p1->x == p2->x && p1->y == p2->y )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
if ( *control == FT_CURVE_TAG_ON )
|
2000-10-11 07:52:42 +02:00
|
|
|
outline->n_points--;
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( outline->n_contours > 0 )
|
2008-06-24 07:44:28 +02:00
|
|
|
{
|
Use 16.16 format while parsing Type 1 charstrings.
This fixes Savannah bug #26867.
Previously, only integers have been used which can lead to serious
rounding errors.
However, fractional values are only used internally; after the
charstrings (of either Type 1 or 2) have been processed, the
resulting coordinates get rounded to integers currently -- before
applying scaling. This should be fixed; at the same time a new load
flag should be introduced, to be used in combination with
FT_LOAD_NO_SCALE, which indicates that font units are returned in
16.16 format. Similarly, the incremental interface should be
extended to allow fractional values for metrics.
* include/freetype/internal/psaux.h (T1_BuilderRec): Remove `shift'
field.
* include/freetype/internal/pshints.h (T1_Hints_SetStemFunc,
T1_Hints_SetStem3Func): Use FT_Fixed for coordinates.
* src/psaux/psobjs.c: Include FT_INTERNAL_CALC_H.
(t1_build_add_point): Always convert fixed to integer.
* src/psaux/t1decode.c (t1_decoder_parse_charstrings):
Use 16.16 format everywhere (except for large integers followed by a
`div').
[CAN_HANDLE_NON_INTEGRAL_T1_OPERANDS]: Remove #ifdef and activate
code uncoditionally.
Add support for random numbers and update remaining code
accordingly; this should work now.
(t1_operator_seac): Updated.
* src/psaux/pshrec.c: Include FT_INTERNAL_CALC_H.
(ps_hints_t1stem3, t1_hints_stem): Updated.
* src/cid/cidgload.c: Include FT_INTERNAL_CALC_H.
(cid_load_glyph) [FT_CONFIG_OPTION_INCREMENTAL],
(cid_face_compute_max_advance, cid_slot_load_glyph): Updated.
* src/type1/t1gload.c (T1_Parse_Glyph_And_Get_Char_String)
[FT_CONFIG_OPTION_INCREMENTAL], (T1_Get_Advances, T1_Load_Glyph):
Updated.
* src/type1/t1load.c: Include FT_INTERNAL_CALC_H.
* src/type1/t1objs.c (T1_Face_Init): Updated.
2009-06-22 16:56:47 +02:00
|
|
|
/* Don't add contours only consisting of one point, i.e., */
|
|
|
|
/* check whether the first and the last point is the same. */
|
2008-06-24 07:44:28 +02:00
|
|
|
if ( first == outline->n_points - 1 )
|
|
|
|
{
|
|
|
|
outline->n_contours--;
|
2017-09-24 21:43:05 +02:00
|
|
|
outline->n_points--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** CFF BUILDER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* cff_builder_init */
|
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
|
|
|
/* hinting :: Whether hinting is active. */
|
|
|
|
/* */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
cff_builder_init( CFF_Builder* builder,
|
|
|
|
TT_Face face,
|
|
|
|
CFF_Size size,
|
|
|
|
CFF_GlyphSlot glyph,
|
|
|
|
FT_Bool hinting )
|
|
|
|
{
|
|
|
|
builder->path_begun = 0;
|
|
|
|
builder->load_points = 1;
|
|
|
|
|
|
|
|
builder->face = face;
|
|
|
|
builder->glyph = glyph;
|
|
|
|
builder->memory = face->root.memory;
|
|
|
|
|
|
|
|
if ( glyph )
|
|
|
|
{
|
|
|
|
FT_GlyphLoader loader = glyph->root.internal->loader;
|
|
|
|
|
|
|
|
|
|
|
|
builder->loader = loader;
|
|
|
|
builder->base = &loader->base.outline;
|
|
|
|
builder->current = &loader->current.outline;
|
|
|
|
FT_GlyphLoader_Rewind( loader );
|
|
|
|
|
|
|
|
builder->hints_globals = NULL;
|
|
|
|
builder->hints_funcs = NULL;
|
|
|
|
|
|
|
|
if ( hinting && size )
|
|
|
|
{
|
|
|
|
FT_Size ftsize = FT_SIZE( size );
|
|
|
|
CFF_Internal internal = (CFF_Internal)ftsize->internal->module_data;
|
|
|
|
|
|
|
|
if ( internal )
|
|
|
|
{
|
|
|
|
builder->hints_globals = (void *)internal->topfont;
|
|
|
|
builder->hints_funcs = glyph->root.internal->glyph_hints;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
builder->funcs = cff_builder_funcs;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* cff_builder_done */
|
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
cff_builder_done( CFF_Builder* builder )
|
|
|
|
{
|
|
|
|
CFF_GlyphSlot glyph = builder->glyph;
|
|
|
|
|
|
|
|
|
|
|
|
if ( glyph )
|
|
|
|
glyph->root.outline = *builder->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check that there is enough space for `count' more points */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
cff_check_points( CFF_Builder* builder,
|
|
|
|
FT_Int count )
|
|
|
|
{
|
|
|
|
return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* add a new point, do not check space */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
cff_builder_add_point( CFF_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y,
|
|
|
|
FT_Byte flag )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
|
|
|
|
|
|
|
|
if ( builder->load_points )
|
|
|
|
{
|
|
|
|
FT_Vector* point = outline->points + outline->n_points;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
|
|
|
|
|
|
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
|
|
|
CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
|
|
|
|
|
|
|
|
|
|
|
|
if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
|
|
|
|
{
|
|
|
|
point->x = x >> 16;
|
|
|
|
point->y = y >> 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
|
|
|
|
point->x = x >> 10;
|
|
|
|
point->y = y >> 10;
|
|
|
|
}
|
|
|
|
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
|
|
|
|
}
|
|
|
|
|
|
|
|
outline->n_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check space for a new on-curve point, then add it */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
cff_builder_add_point1( CFF_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
error = cff_check_points( builder, 1 );
|
|
|
|
if ( !error )
|
|
|
|
cff_builder_add_point( builder, x, y, 1 );
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check space for a new contour, then add it */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
cff_builder_add_contour( CFF_Builder* builder )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !builder->load_points )
|
|
|
|
{
|
|
|
|
outline->n_contours++;
|
|
|
|
return FT_Err_Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
if ( outline->n_contours > 0 )
|
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
|
|
|
|
|
|
|
outline->n_contours++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if a path was begun, add its first on-curve point */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
cff_builder_start_point( CFF_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
|
|
|
{
|
|
|
|
FT_Error error = FT_Err_Ok;
|
|
|
|
|
|
|
|
|
|
|
|
/* test whether we are building a new contour */
|
|
|
|
if ( !builder->path_begun )
|
|
|
|
{
|
|
|
|
builder->path_begun = 1;
|
|
|
|
error = cff_builder_add_contour( builder );
|
|
|
|
if ( !error )
|
|
|
|
error = cff_builder_add_point1( builder, x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* close the current contour */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
cff_builder_close_contour( CFF_Builder* builder )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Int first;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !outline )
|
|
|
|
return;
|
|
|
|
|
|
|
|
first = outline->n_contours <= 1
|
|
|
|
? 0 : outline->contours[outline->n_contours - 2] + 1;
|
|
|
|
|
|
|
|
/* We must not include the last point in the path if it */
|
|
|
|
/* is located on the first point. */
|
|
|
|
if ( outline->n_points > 1 )
|
|
|
|
{
|
|
|
|
FT_Vector* p1 = outline->points + first;
|
|
|
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
|
|
|
|
|
|
|
|
|
|
|
|
/* `delete' last point only if it coincides with the first */
|
|
|
|
/* point and if it is not a control point (which can happen). */
|
|
|
|
if ( p1->x == p2->x && p1->y == p2->y )
|
|
|
|
if ( *control == FT_CURVE_TAG_ON )
|
|
|
|
outline->n_points--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( outline->n_contours > 0 )
|
|
|
|
{
|
|
|
|
/* Don't add contours only consisting of one point, i.e., */
|
|
|
|
/* check whether begin point and last point are the same. */
|
|
|
|
if ( first == outline->n_points - 1 )
|
|
|
|
{
|
|
|
|
outline->n_contours--;
|
2008-06-24 07:44:28 +02:00
|
|
|
outline->n_points--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
|
|
|
}
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-24 22:49:56 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** PS BUILDER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ps_builder_init */
|
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
|
|
|
/* hinting :: Whether hinting should be applied. */
|
|
|
|
/* */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
ps_builder_init( PS_Builder* builder,
|
|
|
|
TT_Face face,
|
|
|
|
FT_Size size,
|
|
|
|
CFF_GlyphSlot glyph,
|
|
|
|
FT_Bool hinting )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
/* */
|
|
|
|
/* <Function> */
|
|
|
|
/* ps_builder_done */
|
|
|
|
/* */
|
|
|
|
/* <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. */
|
|
|
|
/* */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
ps_builder_done( PS_Builder* builder )
|
|
|
|
{
|
|
|
|
CFF_GlyphSlot glyph = builder->glyph;
|
|
|
|
|
|
|
|
|
|
|
|
if ( glyph )
|
|
|
|
glyph->root.outline = *builder->base;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check that there is enough space for `count' more points */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ps_builder_check_points( PS_Builder* builder,
|
|
|
|
FT_Int count )
|
|
|
|
{
|
|
|
|
return FT_GLYPHLOADER_CHECK_POINTS( builder->loader, count, 0 );
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* add a new point, do not check space */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
ps_builder_add_point( PS_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y,
|
|
|
|
FT_Byte flag )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
|
|
|
|
|
|
|
|
if ( builder->load_points )
|
|
|
|
{
|
|
|
|
FT_Vector* point = outline->points + outline->n_points;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points;
|
|
|
|
|
|
|
|
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
|
|
|
|
CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
|
|
|
|
|
|
|
|
|
|
|
|
if ( driver->hinting_engine == FT_CFF_HINTING_FREETYPE )
|
|
|
|
{
|
|
|
|
point->x = x >> 16;
|
|
|
|
point->y = y >> 16;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
#ifdef T1_CONFIG_OPTION_OLD_ENGINE
|
|
|
|
if ( builder->face->is_t1 )
|
|
|
|
{
|
|
|
|
point->x = FIXED_TO_INT( x );
|
|
|
|
point->y = FIXED_TO_INT( y );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
#endif
|
|
|
|
{
|
|
|
|
/* cf2_decoder_parse_charstrings uses 16.16 coordinates */
|
|
|
|
point->x = x >> 10;
|
|
|
|
point->y = y >> 10;
|
|
|
|
}
|
|
|
|
*control = (FT_Byte)( flag ? FT_CURVE_TAG_ON : FT_CURVE_TAG_CUBIC );
|
|
|
|
}
|
|
|
|
outline->n_points++;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check space for a new on-curve point, then add it */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ps_builder_add_point1( PS_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
|
|
|
{
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
error = ps_builder_check_points( builder, 1 );
|
|
|
|
if ( !error )
|
|
|
|
ps_builder_add_point( builder, x, y, 1 );
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* check space for a new contour, then add it */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ps_builder_add_contour( PS_Builder* builder )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Error error;
|
|
|
|
|
|
|
|
|
|
|
|
/* this might happen in invalid fonts */
|
|
|
|
if ( !outline )
|
|
|
|
{
|
|
|
|
FT_ERROR(( "t1_builder_add_contour: no outline to add points to\n" ));
|
|
|
|
return FT_THROW( Invalid_File_Format );
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !builder->load_points )
|
|
|
|
{
|
|
|
|
outline->n_contours++;
|
|
|
|
return FT_Err_Ok;
|
|
|
|
}
|
|
|
|
|
|
|
|
error = FT_GLYPHLOADER_CHECK_POINTS( builder->loader, 0, 1 );
|
|
|
|
if ( !error )
|
|
|
|
{
|
|
|
|
if ( outline->n_contours > 0 )
|
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
|
|
|
|
|
|
|
outline->n_contours++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* if a path was begun, add its first on-curve point */
|
|
|
|
FT_LOCAL_DEF( FT_Error )
|
|
|
|
ps_builder_start_point( PS_Builder* builder,
|
|
|
|
FT_Pos x,
|
|
|
|
FT_Pos y )
|
|
|
|
{
|
|
|
|
FT_Error error = FT_Err_Ok;
|
|
|
|
|
|
|
|
|
|
|
|
/* test whether we are building a new contour */
|
|
|
|
if ( !builder->path_begun )
|
|
|
|
{
|
|
|
|
builder->path_begun = 1;
|
|
|
|
error = ps_builder_add_contour( builder );
|
|
|
|
if ( !error )
|
|
|
|
error = ps_builder_add_point1( builder, x, y );
|
|
|
|
}
|
|
|
|
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* close the current contour */
|
|
|
|
FT_LOCAL_DEF( void )
|
|
|
|
ps_builder_close_contour( PS_Builder* builder )
|
|
|
|
{
|
|
|
|
FT_Outline* outline = builder->current;
|
|
|
|
FT_Int first;
|
|
|
|
|
|
|
|
|
|
|
|
if ( !outline )
|
|
|
|
return;
|
|
|
|
|
|
|
|
first = outline->n_contours <= 1
|
|
|
|
? 0 : outline->contours[outline->n_contours - 2] + 1;
|
|
|
|
|
|
|
|
/* in malformed fonts it can happen that a contour was started */
|
|
|
|
/* but no points were added */
|
|
|
|
if ( outline->n_contours && first == outline->n_points )
|
|
|
|
{
|
|
|
|
outline->n_contours--;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* We must not include the last point in the path if it */
|
|
|
|
/* is located on the first point. */
|
|
|
|
if ( outline->n_points > 1 )
|
|
|
|
{
|
|
|
|
FT_Vector* p1 = outline->points + first;
|
|
|
|
FT_Vector* p2 = outline->points + outline->n_points - 1;
|
|
|
|
FT_Byte* control = (FT_Byte*)outline->tags + outline->n_points - 1;
|
|
|
|
|
|
|
|
|
|
|
|
/* `delete' last point only if it coincides with the first */
|
|
|
|
/* point and it is not a control point (which can happen). */
|
|
|
|
if ( p1->x == p2->x && p1->y == p2->y )
|
|
|
|
if ( *control == FT_CURVE_TAG_ON )
|
|
|
|
outline->n_points--;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( outline->n_contours > 0 )
|
|
|
|
{
|
|
|
|
/* Don't add contours only consisting of one point, i.e., */
|
|
|
|
/* check whether the first and the last point is the same. */
|
|
|
|
if ( first == outline->n_points - 1 )
|
|
|
|
{
|
|
|
|
outline->n_contours--;
|
|
|
|
outline->n_points--;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
outline->contours[outline->n_contours - 1] =
|
|
|
|
(short)( outline->n_points - 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-17 03:09:06 +02:00
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
/***** *****/
|
|
|
|
/***** OTHER *****/
|
|
|
|
/***** *****/
|
|
|
|
/*************************************************************************/
|
|
|
|
/*************************************************************************/
|
|
|
|
|
2002-03-01 03:26:22 +01:00
|
|
|
FT_LOCAL_DEF( void )
|
* massive re-formatting changes to many, many source files. I don't
want to list them all here. The operations performed were all logical
transformations of the sources:
- trying to convert all enums and constants to CAPITALIZED_STYLE, with
#define definitions like
#define my_old_constants MY_NEW_CONSTANT
- big, big update of the documentation comments
* include/freetype/freetype.h, src/base/ftobjs.c, src/smooth/ftsmooth.c,
include/freetype/ftimage.h: adding support for LCD-optimized rendering
though the new constants/enums:
FT_RENDER_MODE_LCD, FT_RENDER_MODE_LCD_V
FT_PIXEL_MODE_LCD, FT_PIXEL_MODE_LCD_V
this is still work in progress, don't expect everything to work correctly
though most of the features have been implemented.
* adding new FT_LOAD_XXX flags, used to specify both hinting and rendering
targets:
FT_LOAD_TARGET_NORMAL :: anti-aliased hinting & rendering
FT_LOAD_TARGET_MONO :: monochrome bitmaps
FT_LOAD_TARGET_LCD :: horizontal RGB/BGR decimated hinting & rendering
FT_LOAD_TARGET_LCD_V :: vertical RGB/BGR decimated hinting & rendering
note that FT_LOAD_TARGET_NORMAL is 0, which means that the default
behaviour of the font engine is _unchanged_.
2002-08-27 22:20:29 +02:00
|
|
|
t1_decrypt( FT_Byte* buffer,
|
2001-06-27 21:46:12 +02:00
|
|
|
FT_Offset length,
|
|
|
|
FT_UShort seed )
|
2000-08-17 03:09:06 +02:00
|
|
|
{
|
* src/psaux/afmparse.c, src/psaux/afmparse.h: New files which
implement an AFM parser. It is used to parse an AFM file.
* src/psaux/psconv.c, src/psaux/psconv.h: New files to provide
conversion functions (e.g, PS real number => FT_Fixed) for the
PS_Parser and AFM_Parser. Some of the functions are taken, with some
modifications, from the psobjs.c
* src/psaux/psobjs.c: Use functions from psconv.c.
* include/freetype/internal/psaux.h, src/psaux/psauxmod.c:: Add
`AFM_Parser' to the `psaux' service.
* src/psaux/psaux.c, src/psaux/rules.mk: Include those new files.
* src/tools/test_afm.c: A test program for AFM parser.
* include/freetype/internal/services/svkern.h,
include/freetype/internal/ftserv.h: New service `Kerning'. It is
currently only used to get the track kerning information.
* src/type1/t1driver.c, src/type1/t1objs.c, src/type1/t1afm.c,
src/type1/t1afm.h: Update to use the AFM parser.
Provide the `Kerning' service.
* include/freetype/freetype.h, src/base/ftobjs.c: New API
`FT_Get_Track_Kerning'.
2006-01-16 16:35:56 +01:00
|
|
|
PS_Conv_EexecDecode( &buffer,
|
|
|
|
buffer + length,
|
|
|
|
buffer,
|
|
|
|
length,
|
|
|
|
&seed );
|
2000-08-17 03:09:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2017-09-24 22:32:40 +02:00
|
|
|
FT_LOCAL_DEF( FT_UInt32 )
|
|
|
|
cff_random( FT_UInt32 r )
|
|
|
|
{
|
|
|
|
/* a 32bit version of the `xorshift' algorithm */
|
|
|
|
r ^= r << 13;
|
|
|
|
r ^= r >> 17;
|
|
|
|
r ^= r << 5;
|
|
|
|
|
|
|
|
return r;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-08-17 09:18:04 +02:00
|
|
|
/* END */
|