summaryrefslogtreecommitdiff
path: root/third_party/freetype/src/cid
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/freetype/src/cid')
-rw-r--r--third_party/freetype/src/cid/ciderrs.h41
-rw-r--r--third_party/freetype/src/cid/cidgload.c458
-rw-r--r--third_party/freetype/src/cid/cidgload.h51
-rw-r--r--third_party/freetype/src/cid/cidload.c846
-rw-r--r--third_party/freetype/src/cid/cidload.h53
-rw-r--r--third_party/freetype/src/cid/cidobjs.c492
-rw-r--r--third_party/freetype/src/cid/cidobjs.h154
-rw-r--r--third_party/freetype/src/cid/cidparse.c277
-rw-r--r--third_party/freetype/src/cid/cidparse.h123
-rw-r--r--third_party/freetype/src/cid/cidriver.c238
-rw-r--r--third_party/freetype/src/cid/cidriver.h43
-rw-r--r--third_party/freetype/src/cid/cidtoken.h112
-rw-r--r--third_party/freetype/src/cid/type1cid.c29
13 files changed, 0 insertions, 2917 deletions
diff --git a/third_party/freetype/src/cid/ciderrs.h b/third_party/freetype/src/cid/ciderrs.h
deleted file mode 100644
index 709dc8cd1e..0000000000
--- a/third_party/freetype/src/cid/ciderrs.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/***************************************************************************/
-/* */
-/* ciderrs.h */
-/* */
-/* CID error codes (specification only). */
-/* */
-/* Copyright 2001-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
- /*************************************************************************/
- /* */
- /* This file is used to define the CID error enumeration constants. */
- /* */
- /*************************************************************************/
-
-#ifndef CIDERRS_H_
-#define CIDERRS_H_
-
-#include FT_MODULE_ERRORS_H
-
-#undef FTERRORS_H_
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX CID_Err_
-#define FT_ERR_BASE FT_Mod_Err_CID
-
-#include FT_ERRORS_H
-
-#endif /* CIDERRS_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidgload.c b/third_party/freetype/src/cid/cidgload.c
deleted file mode 100644
index b96c33334d..0000000000
--- a/third_party/freetype/src/cid/cidgload.c
+++ /dev/null
@@ -1,458 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidgload.c */
-/* */
-/* CID-keyed Type1 Glyph Loader (body). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "cidload.h"
-#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_OUTLINE_H
-#include FT_INTERNAL_CALC_H
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* 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_cidgload
-
-
- FT_CALLBACK_DEF( FT_Error )
- cid_load_glyph( T1_Decoder decoder,
- FT_UInt glyph_index )
- {
- CID_Face face = (CID_Face)decoder->builder.face;
- CID_FaceInfo cid = &face->cid;
- FT_Byte* p;
- FT_ULong fd_select;
- FT_Stream stream = face->cid_stream;
- FT_Error error = FT_Err_Ok;
- FT_Byte* charstring = NULL;
- FT_Memory memory = face->root.memory;
- FT_ULong glyph_length = 0;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- FT_Incremental_InterfaceRec *inc =
- face->root.internal->incremental_interface;
-#endif
-
-
- FT_TRACE1(( "cid_load_glyph: glyph index %d\n", glyph_index ));
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* For incremental fonts get the character data using */
- /* the callback function. */
- if ( inc )
- {
- FT_Data glyph_data;
-
-
- error = inc->funcs->get_glyph_data( inc->object,
- glyph_index, &glyph_data );
- if ( error )
- goto Exit;
-
- p = (FT_Byte*)glyph_data.pointer;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
-
- if ( glyph_data.length != 0 )
- {
- glyph_length = (FT_ULong)( glyph_data.length - cid->fd_bytes );
- (void)FT_ALLOC( charstring, glyph_length );
- if ( !error )
- ft_memcpy( charstring, glyph_data.pointer + cid->fd_bytes,
- glyph_length );
- }
-
- inc->funcs->free_glyph_data( inc->object, &glyph_data );
-
- if ( error )
- goto Exit;
- }
-
- else
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- /* For ordinary fonts read the CID font dictionary index */
- /* and charstring offset from the CIDMap. */
- {
- FT_UInt entry_len = (FT_UInt)( cid->fd_bytes + cid->gd_bytes );
- FT_ULong off1, off2;
-
-
- if ( FT_STREAM_SEEK( cid->data_offset + cid->cidmap_offset +
- glyph_index * entry_len ) ||
- FT_FRAME_ENTER( 2 * entry_len ) )
- goto Exit;
-
- p = (FT_Byte*)stream->cursor;
- fd_select = cid_get_offset( &p, (FT_Byte)cid->fd_bytes );
- off1 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
- p += cid->fd_bytes;
- off2 = cid_get_offset( &p, (FT_Byte)cid->gd_bytes );
- FT_FRAME_EXIT();
-
- if ( fd_select >= (FT_ULong)cid->num_dicts ||
- off2 > stream->size ||
- off1 > off2 )
- {
- FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
- error = FT_THROW( Invalid_Offset );
- goto Exit;
- }
-
- glyph_length = off2 - off1;
- if ( glyph_length == 0 )
- goto Exit;
- if ( FT_ALLOC( charstring, glyph_length ) )
- goto Exit;
- if ( FT_STREAM_READ_AT( cid->data_offset + off1,
- charstring, glyph_length ) )
- goto Exit;
- }
-
- /* Now set up the subrs array and parse the charstrings. */
- {
- CID_FaceDict dict;
- CID_Subrs cid_subrs = face->subrs + fd_select;
- FT_UInt cs_offset;
-
-
- /* Set up subrs */
- decoder->num_subrs = cid_subrs->num_subrs;
- decoder->subrs = cid_subrs->code;
- decoder->subrs_len = 0;
- decoder->subrs_hash = NULL;
-
- /* Set up font matrix */
- dict = cid->font_dicts + fd_select;
-
- decoder->font_matrix = dict->font_matrix;
- decoder->font_offset = dict->font_offset;
- decoder->lenIV = dict->private_dict.lenIV;
-
- /* Decode the charstring. */
-
- /* Adjustment for seed bytes. */
- cs_offset = decoder->lenIV >= 0 ? (FT_UInt)decoder->lenIV : 0;
- if ( cs_offset > glyph_length )
- {
- FT_TRACE0(( "cid_load_glyph: invalid glyph stream offsets\n" ));
- error = FT_THROW( Invalid_Offset );
- goto Exit;
- }
-
- /* Decrypt only if lenIV >= 0. */
- if ( decoder->lenIV >= 0 )
- psaux->t1_decrypt( charstring, glyph_length, 4330 );
-
- error = decoder->funcs.parse_charstrings(
- decoder, charstring + cs_offset,
- glyph_length - cs_offset );
- }
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
-
- /* Incremental fonts can optionally override the metrics. */
- if ( !error && inc && inc->funcs->get_glyph_metrics )
- {
- FT_Incremental_MetricsRec metrics;
-
-
- metrics.bearing_x = FIXED_TO_INT( decoder->builder.left_bearing.x );
- metrics.bearing_y = 0;
- metrics.advance = FIXED_TO_INT( decoder->builder.advance.x );
- metrics.advance_v = FIXED_TO_INT( decoder->builder.advance.y );
-
- error = inc->funcs->get_glyph_metrics( inc->object,
- glyph_index, FALSE, &metrics );
-
- decoder->builder.left_bearing.x = INT_TO_FIXED( metrics.bearing_x );
- decoder->builder.advance.x = INT_TO_FIXED( metrics.advance );
- decoder->builder.advance.y = INT_TO_FIXED( metrics.advance_v );
- }
-
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
-
- Exit:
- FT_FREE( charstring );
-
- return error;
- }
-
-
-#if 0
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /********** *********/
- /********** *********/
- /********** COMPUTE THE MAXIMUM ADVANCE WIDTH *********/
- /********** *********/
- /********** The following code is in charge of computing *********/
- /********** the maximum advance width of the font. It *********/
- /********** quickly processes each glyph charstring to *********/
- /********** extract the value from either a `sbw' or `seac' *********/
- /********** operator. *********/
- /********** *********/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_face_compute_max_advance( CID_Face face,
- FT_Int* max_advance )
- {
- FT_Error error;
- T1_DecoderRec decoder;
- FT_Int glyph_index;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- *max_advance = 0;
-
- /* Initialize load decoder */
- error = psaux->t1_decoder_funcs->init( &decoder,
- (FT_Face)face,
- 0, /* size */
- 0, /* glyph slot */
- 0, /* glyph names! XXX */
- 0, /* blend == 0 */
- 0, /* hinting == 0 */
- cid_load_glyph );
- if ( error )
- return error;
-
- /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
- /* if we ever support CID-keyed multiple master fonts */
-
- decoder.builder.metrics_only = 1;
- decoder.builder.load_points = 0;
-
- /* for each glyph, parse the glyph charstring and extract */
- /* the advance width */
- for ( glyph_index = 0; glyph_index < face->root.num_glyphs;
- glyph_index++ )
- {
- /* now get load the unscaled outline */
- error = cid_load_glyph( &decoder, glyph_index );
- /* ignore the error if one occurred - skip to next glyph */
- }
-
- *max_advance = FIXED_TO_INT( decoder.builder.advance.x );
-
- psaux->t1_decoder_funcs->done( &decoder );
-
- return FT_Err_Ok;
- }
-
-
-#endif /* 0 */
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_slot_load_glyph( FT_GlyphSlot cidglyph, /* CID_GlyphSlot */
- FT_Size cidsize, /* CID_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags )
- {
- CID_GlyphSlot glyph = (CID_GlyphSlot)cidglyph;
- FT_Error error;
- T1_DecoderRec decoder;
- CID_Face face = (CID_Face)cidglyph->face;
- FT_Bool hinting;
-
- PSAux_Service psaux = (PSAux_Service)face->psaux;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
-
-
- if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
- {
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- if ( load_flags & FT_LOAD_NO_RECURSE )
- load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
-
- glyph->x_scale = cidsize->metrics.x_scale;
- glyph->y_scale = cidsize->metrics.y_scale;
-
- cidglyph->outline.n_points = 0;
- cidglyph->outline.n_contours = 0;
-
- hinting = FT_BOOL( ( load_flags & FT_LOAD_NO_SCALE ) == 0 &&
- ( load_flags & FT_LOAD_NO_HINTING ) == 0 );
-
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- error = psaux->t1_decoder_funcs->init( &decoder,
- cidglyph->face,
- cidsize,
- cidglyph,
- 0, /* glyph names -- XXX */
- 0, /* blend == 0 */
- hinting,
- FT_LOAD_TARGET_MODE( load_flags ),
- cid_load_glyph );
- if ( error )
- goto Exit;
-
- /* TODO: initialize decoder.len_buildchar and decoder.buildchar */
- /* if we ever support CID-keyed multiple master fonts */
-
- /* set up the decoder */
- decoder.builder.no_recurse = FT_BOOL(
- ( ( load_flags & FT_LOAD_NO_RECURSE ) != 0 ) );
-
- error = cid_load_glyph( &decoder, glyph_index );
- if ( error )
- goto Exit;
-
- font_matrix = decoder.font_matrix;
- font_offset = decoder.font_offset;
-
- /* save new glyph tables */
- psaux->t1_decoder_funcs->done( &decoder );
-
- /* now set the metrics -- this is rather simple, as */
- /* the left side bearing is the xMin, and the top side */
- /* bearing the yMax */
- cidglyph->outline.flags &= FT_OUTLINE_OWNER;
- cidglyph->outline.flags |= FT_OUTLINE_REVERSE_FILL;
-
- /* for composite glyphs, return only left side bearing and */
- /* advance width */
- if ( load_flags & FT_LOAD_NO_RECURSE )
- {
- FT_Slot_Internal internal = cidglyph->internal;
-
-
- cidglyph->metrics.horiBearingX =
- FIXED_TO_INT( decoder.builder.left_bearing.x );
- cidglyph->metrics.horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
-
- internal->glyph_matrix = font_matrix;
- internal->glyph_delta = font_offset;
- internal->glyph_transformed = 1;
- }
- else
- {
- FT_BBox cbox;
- FT_Glyph_Metrics* metrics = &cidglyph->metrics;
-
-
- /* copy the _unscaled_ advance width */
- metrics->horiAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- cidglyph->linearHoriAdvance =
- FIXED_TO_INT( decoder.builder.advance.x );
- cidglyph->internal->glyph_transformed = 0;
-
- /* make up vertical ones */
- metrics->vertAdvance = ( face->cid.font_bbox.yMax -
- face->cid.font_bbox.yMin ) >> 16;
- cidglyph->linearVertAdvance = metrics->vertAdvance;
-
- cidglyph->format = FT_GLYPH_FORMAT_OUTLINE;
-
- if ( cidsize->metrics.y_ppem < 24 )
- cidglyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
-
- /* apply the font matrix, if any */
- if ( font_matrix.xx != 0x10000L || font_matrix.yy != 0x10000L ||
- font_matrix.xy != 0 || font_matrix.yx != 0 )
- {
- FT_Outline_Transform( &cidglyph->outline, &font_matrix );
-
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance,
- font_matrix.xx );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance,
- font_matrix.yy );
- }
-
- if ( font_offset.x || font_offset.y )
- {
- FT_Outline_Translate( &cidglyph->outline,
- font_offset.x,
- font_offset.y );
-
- metrics->horiAdvance += font_offset.x;
- metrics->vertAdvance += font_offset.y;
- }
-
- if ( ( load_flags & FT_LOAD_NO_SCALE ) == 0 )
- {
- /* scale the outline and the metrics */
- FT_Int n;
- FT_Outline* cur = decoder.builder.base;
- FT_Vector* vec = cur->points;
- FT_Fixed x_scale = glyph->x_scale;
- FT_Fixed y_scale = glyph->y_scale;
-
-
- /* First of all, scale the points */
- if ( !hinting || !decoder.builder.hints_funcs )
- for ( n = cur->n_points; n > 0; n--, vec++ )
- {
- vec->x = FT_MulFix( vec->x, x_scale );
- vec->y = FT_MulFix( vec->y, y_scale );
- }
-
- /* Then scale the metrics */
- metrics->horiAdvance = FT_MulFix( metrics->horiAdvance, x_scale );
- metrics->vertAdvance = FT_MulFix( metrics->vertAdvance, y_scale );
- }
-
- /* compute the other metrics */
- FT_Outline_Get_CBox( &cidglyph->outline, &cbox );
-
- metrics->width = cbox.xMax - cbox.xMin;
- metrics->height = cbox.yMax - cbox.yMin;
-
- metrics->horiBearingX = cbox.xMin;
- metrics->horiBearingY = cbox.yMax;
-
- if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
- {
- /* make up vertical ones */
- ft_synthesize_vertical_metrics( metrics,
- metrics->vertAdvance );
- }
- }
-
- Exit:
- return error;
- }
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidgload.h b/third_party/freetype/src/cid/cidgload.h
deleted file mode 100644
index 7f816b5bc7..0000000000
--- a/third_party/freetype/src/cid/cidgload.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidgload.h */
-/* */
-/* OpenType Glyph Loader (specification). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef CIDGLOAD_H_
-#define CIDGLOAD_H_
-
-
-#include <ft2build.h>
-#include "cidobjs.h"
-
-
-FT_BEGIN_HEADER
-
-
-#if 0
-
- /* Compute the maximum advance width of a font through quick parsing */
- FT_LOCAL( FT_Error )
- cid_face_compute_max_advance( CID_Face face,
- FT_Int* max_advance );
-
-#endif /* 0 */
-
- FT_LOCAL( FT_Error )
- cid_slot_load_glyph( FT_GlyphSlot glyph, /* CID_Glyph_Slot */
- FT_Size size, /* CID_Size */
- FT_UInt glyph_index,
- FT_Int32 load_flags );
-
-
-FT_END_HEADER
-
-#endif /* CIDGLOAD_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidload.c b/third_party/freetype/src/cid/cidload.c
deleted file mode 100644
index ff0722110d..0000000000
--- a/third_party/freetype/src/cid/cidload.c
+++ /dev/null
@@ -1,846 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidload.c */
-/* */
-/* CID-keyed Type1 font loader (body). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_CONFIG_CONFIG_H
-#include FT_MULTIPLE_MASTERS_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-#include "cidload.h"
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* 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_cidload
-
-
- /* read a single offset */
- FT_LOCAL_DEF( FT_ULong )
- cid_get_offset( FT_Byte* *start,
- FT_Byte offsize )
- {
- FT_ULong result;
- FT_Byte* p = *start;
-
-
- for ( result = 0; offsize > 0; offsize-- )
- {
- result <<= 8;
- result |= *p++;
- }
-
- *start = p;
- return result;
- }
-
-
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** TYPE 1 SYMBOL PARSING *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
-
-
- static FT_Error
- cid_load_keyword( CID_Face face,
- CID_Loader* loader,
- const T1_Field keyword )
- {
- FT_Error error;
- CID_Parser* parser = &loader->parser;
- FT_Byte* object;
- void* dummy_object;
- CID_FaceInfo cid = &face->cid;
-
-
- /* if the keyword has a dedicated callback, call it */
- if ( keyword->type == T1_FIELD_TYPE_CALLBACK )
- {
- keyword->reader( (FT_Face)face, parser );
- error = parser->root.error;
- goto Exit;
- }
-
- /* we must now compute the address of our target object */
- switch ( keyword->location )
- {
- case T1_FIELD_LOCATION_CID_INFO:
- object = (FT_Byte*)cid;
- break;
-
- case T1_FIELD_LOCATION_FONT_INFO:
- object = (FT_Byte*)&cid->font_info;
- break;
-
- case T1_FIELD_LOCATION_FONT_EXTRA:
- object = (FT_Byte*)&face->font_extra;
- break;
-
- case T1_FIELD_LOCATION_BBOX:
- object = (FT_Byte*)&cid->font_bbox;
- break;
-
- default:
- {
- CID_FaceDict dict;
-
-
- if ( parser->num_dict < 0 || parser->num_dict >= cid->num_dicts )
- {
- FT_ERROR(( "cid_load_keyword: invalid use of `%s'\n",
- keyword->ident ));
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- dict = cid->font_dicts + parser->num_dict;
- switch ( keyword->location )
- {
- case T1_FIELD_LOCATION_PRIVATE:
- object = (FT_Byte*)&dict->private_dict;
- break;
-
- default:
- object = (FT_Byte*)dict;
- }
- }
- }
-
- dummy_object = object;
-
- /* now, load the keyword data in the object's field(s) */
- if ( keyword->type == T1_FIELD_TYPE_INTEGER_ARRAY ||
- keyword->type == T1_FIELD_TYPE_FIXED_ARRAY )
- error = cid_parser_load_field_table( &loader->parser, keyword,
- &dummy_object );
- else
- error = cid_parser_load_field( &loader->parser,
- keyword, &dummy_object );
- Exit:
- return error;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- cid_parse_font_matrix( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceDict dict;
- FT_Face root = (FT_Face)&face->root;
- FT_Fixed temp[6];
- FT_Fixed temp_scale;
-
-
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
- {
- FT_Matrix* matrix;
- FT_Vector* offset;
- FT_Int result;
-
-
- dict = face->cid.font_dicts + parser->num_dict;
- matrix = &dict->font_matrix;
- offset = &dict->font_offset;
-
- /* input is scaled by 1000 to accommodate default FontMatrix */
- result = cid_parser_to_fixed_array( parser, 6, temp, 3 );
-
- if ( result < 6 )
- return FT_THROW( Invalid_File_Format );
-
- temp_scale = FT_ABS( temp[3] );
-
- if ( temp_scale == 0 )
- {
- FT_ERROR(( "cid_parse_font_matrix: invalid font matrix\n" ));
- return FT_THROW( Invalid_File_Format );
- }
-
- /* atypical case */
- if ( temp_scale != 0x10000L )
- {
- /* set units per EM based on FontMatrix values */
- root->units_per_EM = (FT_UShort)FT_DivFix( 1000, temp_scale );
-
- temp[0] = FT_DivFix( temp[0], temp_scale );
- temp[1] = FT_DivFix( temp[1], temp_scale );
- temp[2] = FT_DivFix( temp[2], temp_scale );
- temp[4] = FT_DivFix( temp[4], temp_scale );
- temp[5] = FT_DivFix( temp[5], temp_scale );
- temp[3] = temp[3] < 0 ? -0x10000L : 0x10000L;
- }
-
- matrix->xx = temp[0];
- matrix->yx = temp[1];
- matrix->xy = temp[2];
- matrix->yy = temp[3];
-
- /* note that the font offsets are expressed in integer font units */
- offset->x = temp[4] >> 16;
- offset->y = temp[5] >> 16;
- }
-
- return FT_Err_Ok;
- }
-
-
- FT_CALLBACK_DEF( FT_Error )
- parse_fd_array( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceInfo cid = &face->cid;
- FT_Memory memory = face->root.memory;
- FT_Stream stream = parser->stream;
- FT_Error error = FT_Err_Ok;
- FT_Long num_dicts;
-
-
- num_dicts = cid_parser_to_int( parser );
- if ( num_dicts < 0 )
- {
- FT_ERROR(( "parse_fd_array: invalid number of dictionaries\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /*
- * A single entry in the FDArray must (at least) contain the following
- * structure elements.
- *
- * %ADOBeginFontDict 18
- * X dict begin 13
- * /FontMatrix [X X X X] 22
- * /Private X dict begin 22
- * end 4
- * end 4
- * %ADOEndFontDict 16
- *
- * This needs 18+13+22+22+4+4+16=99 bytes or more. Normally, you also
- * need a `dup X' at the very beginning and a `put' at the end, so a
- * rough guess using 100 bytes as the minimum is justified.
- */
- if ( (FT_ULong)num_dicts > stream->size / 100 )
- {
- FT_TRACE0(( "parse_fd_array: adjusting FDArray size"
- " (from %d to %d)\n",
- num_dicts,
- stream->size / 100 ));
- num_dicts = (FT_Long)( stream->size / 100 );
- }
-
- if ( !cid->font_dicts )
- {
- FT_Int n;
-
-
- if ( FT_NEW_ARRAY( cid->font_dicts, num_dicts ) )
- goto Exit;
-
- cid->num_dicts = num_dicts;
-
- /* don't forget to set a few defaults */
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- CID_FaceDict dict = cid->font_dicts + n;
-
-
- /* default value for lenIV */
- dict->private_dict.lenIV = 4;
- }
- }
-
- Exit:
- return error;
- }
-
-
- /* by mistake, `expansion_factor' appears both in PS_PrivateRec */
- /* and CID_FaceDictRec (both are public header files and can't */
- /* changed); we simply copy the value */
-
- FT_CALLBACK_DEF( FT_Error )
- parse_expansion_factor( CID_Face face,
- CID_Parser* parser )
- {
- CID_FaceDict dict;
-
-
- if ( parser->num_dict >= 0 && parser->num_dict < face->cid.num_dicts )
- {
- dict = face->cid.font_dicts + parser->num_dict;
-
- dict->expansion_factor = cid_parser_to_fixed( parser, 0 );
- dict->private_dict.expansion_factor = dict->expansion_factor;
- }
-
- return FT_Err_Ok;
- }
-
-
- static
- const T1_FieldRec cid_field_records[] =
- {
-
-#include "cidtoken.h"
-
- T1_FIELD_CALLBACK( "FDArray", parse_fd_array, 0 )
- T1_FIELD_CALLBACK( "FontMatrix", cid_parse_font_matrix, 0 )
- T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
-
- { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
- };
-
-
- static FT_Error
- cid_parse_dict( CID_Face face,
- CID_Loader* loader,
- FT_Byte* base,
- FT_ULong size )
- {
- CID_Parser* parser = &loader->parser;
-
-
- parser->root.cursor = base;
- parser->root.limit = base + size;
- parser->root.error = FT_Err_Ok;
-
- {
- FT_Byte* cur = base;
- FT_Byte* limit = cur + size;
-
-
- for (;;)
- {
- FT_Byte* newlimit;
-
-
- parser->root.cursor = cur;
- cid_parser_skip_spaces( parser );
-
- if ( parser->root.cursor >= limit )
- newlimit = limit - 1 - 17;
- else
- newlimit = parser->root.cursor - 17;
-
- /* look for `%ADOBeginFontDict' */
- for ( ; cur < newlimit; cur++ )
- {
- if ( *cur == '%' &&
- ft_strncmp( (char*)cur, "%ADOBeginFontDict", 17 ) == 0 )
- {
- /* if /FDArray was found, then cid->num_dicts is > 0, and */
- /* we can start increasing parser->num_dict */
- if ( face->cid.num_dicts > 0 )
- parser->num_dict++;
- }
- }
-
- cur = parser->root.cursor;
- /* no error can occur in cid_parser_skip_spaces */
- if ( cur >= limit )
- break;
-
- cid_parser_skip_PS_token( parser );
- if ( parser->root.cursor >= limit || parser->root.error )
- break;
-
- /* look for immediates */
- if ( *cur == '/' && cur + 2 < limit )
- {
- FT_UInt len;
-
-
- cur++;
- len = (FT_UInt)( parser->root.cursor - cur );
-
- if ( len > 0 && len < 22 )
- {
- /* now compare the immediate name to the keyword table */
- T1_Field keyword = (T1_Field)cid_field_records;
-
-
- for (;;)
- {
- FT_Byte* name;
-
-
- name = (FT_Byte*)keyword->ident;
- if ( !name )
- break;
-
- if ( cur[0] == name[0] &&
- len == ft_strlen( (const char*)name ) )
- {
- FT_UInt n;
-
-
- for ( n = 1; n < len; n++ )
- if ( cur[n] != name[n] )
- break;
-
- if ( n >= len )
- {
- /* we found it - run the parsing callback */
- parser->root.error = cid_load_keyword( face,
- loader,
- keyword );
- if ( parser->root.error )
- return parser->root.error;
- break;
- }
- }
- keyword++;
- }
- }
- }
-
- cur = parser->root.cursor;
- }
-
- if ( !face->cid.num_dicts )
- {
- FT_ERROR(( "cid_parse_dict: No font dictionary found\n" ));
- return FT_THROW( Invalid_File_Format );
- }
- }
-
- return parser->root.error;
- }
-
-
- /* read the subrmap and the subrs of each font dict */
- static FT_Error
- cid_read_subrs( CID_Face face )
- {
- CID_FaceInfo cid = &face->cid;
- FT_Memory memory = face->root.memory;
- FT_Stream stream = face->cid_stream;
- FT_Error error;
- FT_Int n;
- CID_Subrs subr;
- FT_UInt max_offsets = 0;
- FT_ULong* offsets = NULL;
- PSAux_Service psaux = (PSAux_Service)face->psaux;
-
-
- if ( FT_NEW_ARRAY( face->subrs, cid->num_dicts ) )
- goto Exit;
-
- subr = face->subrs;
- for ( n = 0; n < cid->num_dicts; n++, subr++ )
- {
- CID_FaceDict dict = cid->font_dicts + n;
- FT_Int lenIV = dict->private_dict.lenIV;
- FT_UInt count, num_subrs = dict->num_subrs;
- FT_ULong data_len;
- FT_Byte* p;
-
-
- if ( !num_subrs )
- continue;
-
- /* reallocate offsets array if needed */
- if ( num_subrs + 1 > max_offsets )
- {
- FT_UInt new_max = FT_PAD_CEIL( num_subrs + 1, 4 );
-
-
- if ( new_max <= max_offsets )
- {
- error = FT_THROW( Syntax_Error );
- goto Fail;
- }
-
- if ( FT_RENEW_ARRAY( offsets, max_offsets, new_max ) )
- goto Fail;
-
- max_offsets = new_max;
- }
-
- /* read the subrmap's offsets */
- if ( FT_STREAM_SEEK( cid->data_offset + dict->subrmap_offset ) ||
- FT_FRAME_ENTER( ( num_subrs + 1 ) * (FT_UInt)dict->sd_bytes ) )
- goto Fail;
-
- p = (FT_Byte*)stream->cursor;
- for ( count = 0; count <= num_subrs; count++ )
- offsets[count] = cid_get_offset( &p, (FT_Byte)dict->sd_bytes );
-
- FT_FRAME_EXIT();
-
- /* offsets must be ordered */
- for ( count = 1; count <= num_subrs; count++ )
- if ( offsets[count - 1] > offsets[count] )
- {
- FT_ERROR(( "cid_read_subrs: offsets are not ordered\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- if ( offsets[num_subrs] > stream->size - cid->data_offset )
- {
- FT_ERROR(( "cid_read_subrs: too large `subrs' offsets\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Fail;
- }
-
- /* now, compute the size of subrs charstrings, */
- /* allocate, and read them */
- data_len = offsets[num_subrs] - offsets[0];
-
- if ( FT_NEW_ARRAY( subr->code, num_subrs + 1 ) ||
- FT_ALLOC( subr->code[0], data_len ) )
- goto Fail;
-
- if ( FT_STREAM_SEEK( cid->data_offset + offsets[0] ) ||
- FT_STREAM_READ( subr->code[0], data_len ) )
- goto Fail;
-
- /* set up pointers */
- for ( count = 1; count <= num_subrs; count++ )
- {
- FT_ULong len;
-
-
- len = offsets[count] - offsets[count - 1];
- subr->code[count] = subr->code[count - 1] + len;
- }
-
- /* decrypt subroutines, but only if lenIV >= 0 */
- if ( lenIV >= 0 )
- {
- for ( count = 0; count < num_subrs; count++ )
- {
- FT_ULong len;
-
-
- len = offsets[count + 1] - offsets[count];
- psaux->t1_decrypt( subr->code[count], len, 4330 );
- }
- }
-
- subr->num_subrs = (FT_Int)num_subrs;
- }
-
- Exit:
- FT_FREE( offsets );
- return error;
-
- Fail:
- if ( face->subrs )
- {
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- if ( face->subrs[n].code )
- FT_FREE( face->subrs[n].code[0] );
-
- FT_FREE( face->subrs[n].code );
- }
- FT_FREE( face->subrs );
- }
- goto Exit;
- }
-
-
- static void
- cid_init_loader( CID_Loader* loader,
- CID_Face face )
- {
- FT_UNUSED( face );
-
- FT_ZERO( loader );
- }
-
-
- static void
- cid_done_loader( CID_Loader* loader )
- {
- CID_Parser* parser = &loader->parser;
-
-
- /* finalize parser */
- cid_parser_done( parser );
- }
-
-
- static FT_Error
- cid_hex_to_binary( FT_Byte* data,
- FT_ULong data_len,
- FT_ULong offset,
- CID_Face face )
- {
- FT_Stream stream = face->root.stream;
- FT_Error error;
-
- FT_Byte buffer[256];
- FT_Byte *p, *plimit;
- FT_Byte *d, *dlimit;
- FT_Byte val;
-
- FT_Bool upper_nibble, done;
-
-
- if ( FT_STREAM_SEEK( offset ) )
- goto Exit;
-
- d = data;
- dlimit = d + data_len;
- p = buffer;
- plimit = p;
-
- upper_nibble = 1;
- done = 0;
-
- while ( d < dlimit )
- {
- if ( p >= plimit )
- {
- FT_ULong oldpos = FT_STREAM_POS();
- FT_ULong size = stream->size - oldpos;
-
-
- if ( size == 0 )
- {
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- if ( FT_STREAM_READ( buffer, 256 > size ? size : 256 ) )
- goto Exit;
- p = buffer;
- plimit = p + FT_STREAM_POS() - oldpos;
- }
-
- if ( ft_isdigit( *p ) )
- val = (FT_Byte)( *p - '0' );
- else if ( *p >= 'a' && *p <= 'f' )
- val = (FT_Byte)( *p - 'a' );
- else if ( *p >= 'A' && *p <= 'F' )
- val = (FT_Byte)( *p - 'A' + 10 );
- else if ( *p == ' ' ||
- *p == '\t' ||
- *p == '\r' ||
- *p == '\n' ||
- *p == '\f' ||
- *p == '\0' )
- {
- p++;
- continue;
- }
- else if ( *p == '>' )
- {
- val = 0;
- done = 1;
- }
- else
- {
- error = FT_THROW( Syntax_Error );
- goto Exit;
- }
-
- if ( upper_nibble )
- *d = (FT_Byte)( val << 4 );
- else
- {
- *d = (FT_Byte)( *d + val );
- d++;
- }
-
- upper_nibble = (FT_Byte)( 1 - upper_nibble );
-
- if ( done )
- break;
-
- p++;
- }
-
- error = FT_Err_Ok;
-
- Exit:
- return error;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_face_open( CID_Face face,
- FT_Int face_index )
- {
- CID_Loader loader;
- CID_Parser* parser;
- FT_Memory memory = face->root.memory;
- FT_Error error;
- FT_Int n;
-
- CID_FaceInfo cid = &face->cid;
-
- FT_ULong binary_length;
- FT_ULong entry_len;
-
-
- cid_init_loader( &loader, face );
-
- parser = &loader.parser;
- error = cid_parser_new( parser, face->root.stream, face->root.memory,
- (PSAux_Service)face->psaux );
- if ( error )
- goto Exit;
-
- error = cid_parse_dict( face, &loader,
- parser->postscript,
- parser->postscript_len );
- if ( error )
- goto Exit;
-
- if ( face_index < 0 )
- goto Exit;
-
- if ( FT_NEW( face->cid_stream ) )
- goto Exit;
-
- if ( parser->binary_length )
- {
- if ( parser->binary_length >
- face->root.stream->size - parser->data_offset )
- {
- FT_TRACE0(( "cid_face_open: adjusting length of binary data\n"
- " (from %d to %d bytes)\n",
- parser->binary_length,
- face->root.stream->size - parser->data_offset ));
- parser->binary_length = face->root.stream->size -
- parser->data_offset;
- }
-
- /* we must convert the data section from hexadecimal to binary */
- if ( FT_ALLOC( face->binary_data, parser->binary_length ) ||
- FT_SET_ERROR( cid_hex_to_binary( face->binary_data,
- parser->binary_length,
- parser->data_offset,
- face ) ) )
- goto Exit;
-
- FT_Stream_OpenMemory( face->cid_stream,
- face->binary_data, parser->binary_length );
- cid->data_offset = 0;
- }
- else
- {
- *face->cid_stream = *face->root.stream;
- cid->data_offset = loader.parser.data_offset;
- }
-
- /* sanity tests */
-
- if ( cid->fd_bytes < 0 || cid->gd_bytes < 1 )
- {
- FT_ERROR(( "cid_parse_dict:"
- " Invalid `FDBytes' or `GDBytes' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* allow at most 32bit offsets */
- if ( cid->fd_bytes > 4 || cid->gd_bytes > 4 )
- {
- FT_ERROR(( "cid_parse_dict:"
- " Values of `FDBytes' or `GDBytes' larger than 4\n"
- " "
- " are not supported\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- binary_length = face->cid_stream->size - cid->data_offset;
- entry_len = (FT_ULong)( cid->fd_bytes + cid->gd_bytes );
-
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- CID_FaceDict dict = cid->font_dicts + n;
-
-
- if ( dict->sd_bytes < 0 ||
- ( dict->num_subrs && dict->sd_bytes < 1 ) )
- {
- FT_ERROR(( "cid_parse_dict: Invalid `SDBytes' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( dict->sd_bytes > 4 )
- {
- FT_ERROR(( "cid_parse_dict:"
- " Values of `SDBytes' larger than 4"
- " are not supported\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( dict->subrmap_offset > binary_length )
- {
- FT_ERROR(( "cid_parse_dict: Invalid `SubrMapOffset' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* `num_subrs' is scanned as a signed integer */
- if ( (FT_Int)dict->num_subrs < 0 ||
- ( dict->sd_bytes &&
- dict->num_subrs > ( binary_length - dict->subrmap_offset ) /
- (FT_UInt)dict->sd_bytes ) )
- {
- FT_ERROR(( "cid_parse_dict: Invalid `SubrCount' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
- }
-
- if ( cid->cidmap_offset > binary_length )
- {
- FT_ERROR(( "cid_parse_dict: Invalid `CIDMapOffset' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- if ( entry_len &&
- cid->cid_count >
- ( binary_length - cid->cidmap_offset ) / entry_len )
- {
- FT_ERROR(( "cid_parse_dict: Invalid `CIDCount' value\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- /* we can now safely proceed */
- error = cid_read_subrs( face );
-
- Exit:
- cid_done_loader( &loader );
- return error;
- }
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidload.h b/third_party/freetype/src/cid/cidload.h
deleted file mode 100644
index 45a0e6df25..0000000000
--- a/third_party/freetype/src/cid/cidload.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidload.h */
-/* */
-/* CID-keyed Type1 font loader (specification). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef CIDLOAD_H_
-#define CIDLOAD_H_
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_STREAM_H
-#include "cidparse.h"
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct CID_Loader_
- {
- CID_Parser parser; /* parser used to read the stream */
- FT_Int num_chars; /* number of characters in encoding */
-
- } CID_Loader;
-
-
- FT_LOCAL( FT_ULong )
- cid_get_offset( FT_Byte** start,
- FT_Byte offsize );
-
- FT_LOCAL( FT_Error )
- cid_face_open( CID_Face face,
- FT_Int face_index );
-
-
-FT_END_HEADER
-
-#endif /* CIDLOAD_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidobjs.c b/third_party/freetype/src/cid/cidobjs.c
deleted file mode 100644
index 7830e1f684..0000000000
--- a/third_party/freetype/src/cid/cidobjs.c
+++ /dev/null
@@ -1,492 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidobjs.c */
-/* */
-/* CID objects manager (body). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-
-#include "cidgload.h"
-#include "cidload.h"
-
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* 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_cidobjs
-
-
- /*************************************************************************/
- /* */
- /* SLOT FUNCTIONS */
- /* */
- /*************************************************************************/
-
- FT_LOCAL_DEF( void )
- cid_slot_done( FT_GlyphSlot slot )
- {
- slot->internal->glyph_hints = NULL;
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_slot_init( FT_GlyphSlot slot )
- {
- CID_Face face;
- PSHinter_Service pshinter;
-
-
- face = (CID_Face)slot->face;
- pshinter = (PSHinter_Service)face->pshinter;
-
- if ( pshinter )
- {
- FT_Module module;
-
-
- module = FT_Get_Module( slot->face->driver->root.library,
- "pshinter" );
- if ( module )
- {
- T1_Hints_Funcs funcs;
-
-
- funcs = pshinter->get_t1_funcs( module );
- slot->internal->glyph_hints = (void*)funcs;
- }
- }
-
- return 0;
- }
-
-
- /*************************************************************************/
- /* */
- /* SIZE FUNCTIONS */
- /* */
- /*************************************************************************/
-
-
- static PSH_Globals_Funcs
- cid_size_get_globals_funcs( CID_Size size )
- {
- CID_Face face = (CID_Face)size->root.face;
- PSHinter_Service pshinter = (PSHinter_Service)face->pshinter;
- FT_Module module;
-
-
- module = FT_Get_Module( size->root.face->driver->root.library,
- "pshinter" );
- return ( module && pshinter && pshinter->get_globals_funcs )
- ? pshinter->get_globals_funcs( module )
- : 0;
- }
-
-
- FT_LOCAL_DEF( void )
- cid_size_done( FT_Size cidsize ) /* CID_Size */
- {
- CID_Size size = (CID_Size)cidsize;
-
-
- if ( cidsize->internal )
- {
- PSH_Globals_Funcs funcs;
-
-
- funcs = cid_size_get_globals_funcs( size );
- if ( funcs )
- funcs->destroy( (PSH_Globals)cidsize->internal );
-
- cidsize->internal = NULL;
- }
- }
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_size_init( FT_Size cidsize ) /* CID_Size */
- {
- CID_Size size = (CID_Size)cidsize;
- FT_Error error = FT_Err_Ok;
- PSH_Globals_Funcs funcs = cid_size_get_globals_funcs( size );
-
-
- if ( funcs )
- {
- PSH_Globals globals;
- CID_Face face = (CID_Face)cidsize->face;
- CID_FaceDict dict = face->cid.font_dicts + face->root.face_index;
- PS_Private priv = &dict->private_dict;
-
-
- error = funcs->create( cidsize->face->memory, priv, &globals );
- if ( !error )
- cidsize->internal = (FT_Size_Internal)(void*)globals;
- }
-
- return error;
- }
-
-
- FT_LOCAL( FT_Error )
- cid_size_request( FT_Size size,
- FT_Size_Request req )
- {
- PSH_Globals_Funcs funcs;
-
-
- FT_Request_Metrics( size->face, req );
-
- funcs = cid_size_get_globals_funcs( (CID_Size)size );
-
- if ( funcs )
- funcs->set_scale( (PSH_Globals)size->internal,
- size->metrics.x_scale,
- size->metrics.y_scale,
- 0, 0 );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* FACE FUNCTIONS */
- /* */
- /*************************************************************************/
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_face_done */
- /* */
- /* <Description> */
- /* Finalizes a given face object. */
- /* */
- /* <Input> */
- /* face :: A pointer to the face object to destroy. */
- /* */
- FT_LOCAL_DEF( void )
- cid_face_done( FT_Face cidface ) /* CID_Face */
- {
- CID_Face face = (CID_Face)cidface;
- FT_Memory memory;
- CID_FaceInfo cid;
- PS_FontInfo info;
-
-
- if ( !face )
- return;
-
- cid = &face->cid;
- info = &cid->font_info;
- memory = cidface->memory;
-
- /* release subrs */
- if ( face->subrs )
- {
- FT_Int n;
-
-
- for ( n = 0; n < cid->num_dicts; n++ )
- {
- CID_Subrs subr = face->subrs + n;
-
-
- if ( subr->code )
- {
- FT_FREE( subr->code[0] );
- FT_FREE( subr->code );
- }
- }
-
- FT_FREE( face->subrs );
- }
-
- /* release FontInfo strings */
- FT_FREE( info->version );
- FT_FREE( info->notice );
- FT_FREE( info->full_name );
- FT_FREE( info->family_name );
- FT_FREE( info->weight );
-
- /* release font dictionaries */
- FT_FREE( cid->font_dicts );
- cid->num_dicts = 0;
-
- /* release other strings */
- FT_FREE( cid->cid_font_name );
- FT_FREE( cid->registry );
- FT_FREE( cid->ordering );
-
- cidface->family_name = NULL;
- cidface->style_name = NULL;
-
- FT_FREE( face->binary_data );
- FT_FREE( face->cid_stream );
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_face_init */
- /* */
- /* <Description> */
- /* Initializes a given CID face object. */
- /* */
- /* <Input> */
- /* stream :: The source font stream. */
- /* */
- /* face_index :: The index of the font face in the resource. */
- /* */
- /* num_params :: Number of additional generic parameters. Ignored. */
- /* */
- /* params :: Additional generic parameters. Ignored. */
- /* */
- /* <InOut> */
- /* face :: The newly built face object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cid_face_init( FT_Stream stream,
- FT_Face cidface, /* CID_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params )
- {
- CID_Face face = (CID_Face)cidface;
- FT_Error error;
- PSAux_Service psaux;
- PSHinter_Service pshinter;
-
- FT_UNUSED( num_params );
- FT_UNUSED( params );
- FT_UNUSED( stream );
-
-
- cidface->num_faces = 1;
-
- psaux = (PSAux_Service)face->psaux;
- if ( !psaux )
- {
- psaux = (PSAux_Service)FT_Get_Module_Interface(
- FT_FACE_LIBRARY( face ), "psaux" );
-
- if ( !psaux )
- {
- FT_ERROR(( "cid_face_init: cannot access `psaux' module\n" ));
- error = FT_THROW( Missing_Module );
- goto Exit;
- }
-
- face->psaux = psaux;
- }
-
- pshinter = (PSHinter_Service)face->pshinter;
- if ( !pshinter )
- {
- pshinter = (PSHinter_Service)FT_Get_Module_Interface(
- FT_FACE_LIBRARY( face ), "pshinter" );
-
- face->pshinter = pshinter;
- }
-
- FT_TRACE2(( "CID driver\n" ));
-
- /* open the tokenizer; this will also check the font format */
- if ( FT_STREAM_SEEK( 0 ) )
- goto Exit;
-
- error = cid_face_open( face, face_index );
- if ( error )
- goto Exit;
-
- /* if we just wanted to check the format, leave successfully now */
- if ( face_index < 0 )
- goto Exit;
-
- /* check the face index */
- /* XXX: handle CID fonts with more than a single face */
- if ( ( face_index & 0xFFFF ) != 0 )
- {
- FT_ERROR(( "cid_face_init: invalid face index\n" ));
- error = FT_THROW( Invalid_Argument );
- goto Exit;
- }
-
- /* now load the font program into the face object */
-
- /* initialize the face object fields */
-
- /* set up root face fields */
- {
- CID_FaceInfo cid = &face->cid;
- PS_FontInfo info = &cid->font_info;
-
-
- cidface->num_glyphs = (FT_Long)cid->cid_count;
- cidface->num_charmaps = 0;
-
- cidface->face_index = face_index & 0xFFFF;
-
- cidface->face_flags |= FT_FACE_FLAG_SCALABLE | /* scalable outlines */
- FT_FACE_FLAG_HORIZONTAL | /* horizontal data */
- FT_FACE_FLAG_HINTER; /* has native hinter */
-
- if ( info->is_fixed_pitch )
- cidface->face_flags |= FT_FACE_FLAG_FIXED_WIDTH;
-
- /* XXX: TODO: add kerning with .afm support */
-
- /* get style name -- be careful, some broken fonts only */
- /* have a /FontName dictionary entry! */
- cidface->family_name = info->family_name;
- /* assume "Regular" style if we don't know better */
- cidface->style_name = (char *)"Regular";
- if ( cidface->family_name )
- {
- char* full = info->full_name;
- char* family = cidface->family_name;
-
-
- if ( full )
- {
- while ( *full )
- {
- if ( *full == *family )
- {
- family++;
- full++;
- }
- else
- {
- if ( *full == ' ' || *full == '-' )
- full++;
- else if ( *family == ' ' || *family == '-' )
- family++;
- else
- {
- if ( !*family )
- cidface->style_name = full;
- break;
- }
- }
- }
- }
- }
- else
- {
- /* do we have a `/FontName'? */
- if ( cid->cid_font_name )
- cidface->family_name = cid->cid_font_name;
- }
-
- /* compute style flags */
- cidface->style_flags = 0;
- if ( info->italic_angle )
- cidface->style_flags |= FT_STYLE_FLAG_ITALIC;
- if ( info->weight )
- {
- if ( !ft_strcmp( info->weight, "Bold" ) ||
- !ft_strcmp( info->weight, "Black" ) )
- cidface->style_flags |= FT_STYLE_FLAG_BOLD;
- }
-
- /* no embedded bitmap support */
- cidface->num_fixed_sizes = 0;
- cidface->available_sizes = NULL;
-
- cidface->bbox.xMin = cid->font_bbox.xMin >> 16;
- cidface->bbox.yMin = cid->font_bbox.yMin >> 16;
- /* no `U' suffix here to 0xFFFF! */
- cidface->bbox.xMax = ( cid->font_bbox.xMax + 0xFFFF ) >> 16;
- cidface->bbox.yMax = ( cid->font_bbox.yMax + 0xFFFF ) >> 16;
-
- if ( !cidface->units_per_EM )
- cidface->units_per_EM = 1000;
-
- cidface->ascender = (FT_Short)( cidface->bbox.yMax );
- cidface->descender = (FT_Short)( cidface->bbox.yMin );
-
- cidface->height = (FT_Short)( ( cidface->units_per_EM * 12 ) / 10 );
- if ( cidface->height < cidface->ascender - cidface->descender )
- cidface->height = (FT_Short)( cidface->ascender - cidface->descender );
-
- cidface->underline_position = (FT_Short)info->underline_position;
- cidface->underline_thickness = (FT_Short)info->underline_thickness;
- }
-
- Exit:
- return error;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_driver_init */
- /* */
- /* <Description> */
- /* Initializes a given CID driver object. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target driver object. */
- /* */
- /* <Return> */
- /* FreeType error code. 0 means success. */
- /* */
- FT_LOCAL_DEF( FT_Error )
- cid_driver_init( FT_Module driver )
- {
- FT_UNUSED( driver );
-
- return FT_Err_Ok;
- }
-
-
- /*************************************************************************/
- /* */
- /* <Function> */
- /* cid_driver_done */
- /* */
- /* <Description> */
- /* Finalizes a given CID driver. */
- /* */
- /* <Input> */
- /* driver :: A handle to the target CID driver. */
- /* */
- FT_LOCAL_DEF( void )
- cid_driver_done( FT_Module driver )
- {
- FT_UNUSED( driver );
- }
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidobjs.h b/third_party/freetype/src/cid/cidobjs.h
deleted file mode 100644
index 8bcf886e10..0000000000
--- a/third_party/freetype/src/cid/cidobjs.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidobjs.h */
-/* */
-/* CID objects manager (specification). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef CIDOBJS_H_
-#define CIDOBJS_H_
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_OBJECTS_H
-#include FT_CONFIG_CONFIG_H
-#include FT_INTERNAL_TYPE1_TYPES_H
-
-
-FT_BEGIN_HEADER
-
-
- /* The following structures must be defined by the hinter */
- typedef struct CID_Size_Hints_ CID_Size_Hints;
- typedef struct CID_Glyph_Hints_ CID_Glyph_Hints;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_Driver */
- /* */
- /* <Description> */
- /* A handle to a Type 1 driver object. */
- /* */
- typedef struct CID_DriverRec_* CID_Driver;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_Size */
- /* */
- /* <Description> */
- /* A handle to a Type 1 size object. */
- /* */
- typedef struct CID_SizeRec_* CID_Size;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_GlyphSlot */
- /* */
- /* <Description> */
- /* A handle to a Type 1 glyph slot object. */
- /* */
- typedef struct CID_GlyphSlotRec_* CID_GlyphSlot;
-
-
- /*************************************************************************/
- /* */
- /* <Type> */
- /* CID_CharMap */
- /* */
- /* <Description> */
- /* A handle to a Type 1 character mapping object. */
- /* */
- /* <Note> */
- /* The Type 1 format doesn't use a charmap but an encoding table. */
- /* The driver is responsible for making up charmap objects */
- /* corresponding to these tables. */
- /* */
- typedef struct CID_CharMapRec_* CID_CharMap;
-
-
- /*************************************************************************/
- /* */
- /* HERE BEGINS THE TYPE 1 SPECIFIC STUFF */
- /* */
- /*************************************************************************/
-
-
- typedef struct CID_SizeRec_
- {
- FT_SizeRec root;
- FT_Bool valid;
-
- } CID_SizeRec;
-
-
- typedef struct CID_GlyphSlotRec_
- {
- FT_GlyphSlotRec root;
-
- FT_Bool hint;
- FT_Bool scaled;
-
- FT_Fixed x_scale;
- FT_Fixed y_scale;
-
- } CID_GlyphSlotRec;
-
-
- FT_LOCAL( void )
- cid_slot_done( FT_GlyphSlot slot );
-
- FT_LOCAL( FT_Error )
- cid_slot_init( FT_GlyphSlot slot );
-
-
- FT_LOCAL( void )
- cid_size_done( FT_Size size ); /* CID_Size */
-
- FT_LOCAL( FT_Error )
- cid_size_init( FT_Size size ); /* CID_Size */
-
- FT_LOCAL( FT_Error )
- cid_size_request( FT_Size size, /* CID_Size */
- FT_Size_Request req );
-
- FT_LOCAL( FT_Error )
- cid_face_init( FT_Stream stream,
- FT_Face face, /* CID_Face */
- FT_Int face_index,
- FT_Int num_params,
- FT_Parameter* params );
-
- FT_LOCAL( void )
- cid_face_done( FT_Face face ); /* CID_Face */
-
-
- FT_LOCAL( FT_Error )
- cid_driver_init( FT_Module driver );
-
- FT_LOCAL( void )
- cid_driver_done( FT_Module driver );
-
-
-FT_END_HEADER
-
-#endif /* CIDOBJS_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidparse.c b/third_party/freetype/src/cid/cidparse.c
deleted file mode 100644
index 007609bbdf..0000000000
--- a/third_party/freetype/src/cid/cidparse.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidparse.c */
-/* */
-/* CID-keyed Type1 parser (body). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-
-#include "cidparse.h"
-
-#include "ciderrs.h"
-
-
- /*************************************************************************/
- /* */
- /* 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_cidparse
-
-
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
- /***** *****/
- /***** INPUT STREAM PARSER *****/
- /***** *****/
- /*************************************************************************/
- /*************************************************************************/
- /*************************************************************************/
-
-
-#define STARTDATA "StartData"
-#define STARTDATA_LEN ( sizeof ( STARTDATA ) - 1 )
-#define SFNTS "/sfnts"
-#define SFNTS_LEN ( sizeof ( SFNTS ) - 1 )
-
-
- FT_LOCAL_DEF( FT_Error )
- cid_parser_new( CID_Parser* parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux )
- {
- FT_Error error;
- FT_ULong base_offset, offset, ps_len;
- FT_Byte *cur, *limit;
- FT_Byte *arg1, *arg2;
-
-
- FT_ZERO( parser );
- psaux->ps_parser_funcs->init( &parser->root, 0, 0, memory );
-
- parser->stream = stream;
-
- base_offset = FT_STREAM_POS();
-
- /* first of all, check the font format in the header */
- if ( FT_FRAME_ENTER( 31 ) )
- goto Exit;
-
- if ( ft_strncmp( (char *)stream->cursor,
- "%!PS-Adobe-3.0 Resource-CIDFont", 31 ) )
- {
- FT_TRACE2(( " not a CID-keyed font\n" ));
- error = FT_THROW( Unknown_File_Format );
- }
-
- FT_FRAME_EXIT();
- if ( error )
- goto Exit;
-
- Again:
- /* now, read the rest of the file until we find */
- /* `StartData' or `/sfnts' */
- {
- /*
- * The algorithm is as follows (omitting the case with less than 256
- * bytes to fill for simplicity).
- *
- * 1. Fill the buffer with 256 + STARTDATA_LEN bytes.
- *
- * 2. Search for the STARTDATA and SFNTS strings at positions
- * buffer[0], buffer[1], ...,
- * buffer[255 + STARTDATA_LEN - SFNTS_LEN].
- *
- * 3. Move the last STARTDATA_LEN bytes to buffer[0].
- *
- * 4. Fill the buffer with 256 bytes, starting at STARTDATA_LEN.
- *
- * 5. Repeat with step 2.
- *
- */
- FT_Byte buffer[256 + STARTDATA_LEN + 1];
-
- /* values for the first loop */
- FT_ULong read_len = 256 + STARTDATA_LEN;
- FT_ULong read_offset = 0;
- FT_Byte* p = buffer;
-
-
- for ( offset = FT_STREAM_POS(); ; offset += 256 )
- {
- FT_ULong stream_len;
-
-
- stream_len = stream->size - FT_STREAM_POS();
-
- read_len = FT_MIN( read_len, stream_len );
- if ( FT_STREAM_READ( p, read_len ) )
- goto Exit;
-
- /* ensure that we do not compare with data beyond the buffer */
- p[read_len] = '\0';
-
- limit = p + read_len - SFNTS_LEN;
-
- for ( p = buffer; p < limit; p++ )
- {
- if ( p[0] == 'S' &&
- ft_strncmp( (char*)p, STARTDATA, STARTDATA_LEN ) == 0 )
- {
- /* save offset of binary data after `StartData' */
- offset += (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
- goto Found;
- }
- else if ( p[1] == 's' &&
- ft_strncmp( (char*)p, SFNTS, SFNTS_LEN ) == 0 )
- {
- offset += (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
- goto Found;
- }
- }
-
- if ( read_offset + read_len < STARTDATA_LEN )
- {
- FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
- error = FT_THROW( Invalid_File_Format );
- goto Exit;
- }
-
- FT_MEM_MOVE( buffer,
- buffer + read_offset + read_len - STARTDATA_LEN,
- STARTDATA_LEN );
-
- /* values for the next loop */
- read_len = 256;
- read_offset = STARTDATA_LEN;
- p = buffer + read_offset;
- }
- }
-
- Found:
- /* We have found the start of the binary data or the `/sfnts' token. */
- /* Now rewind and extract the frame corresponding to this PostScript */
- /* section. */
-
- ps_len = offset - base_offset;
- if ( FT_STREAM_SEEK( base_offset ) ||
- FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
- goto Exit;
-
- parser->data_offset = offset;
- parser->postscript_len = ps_len;
- parser->root.base = parser->postscript;
- parser->root.cursor = parser->postscript;
- parser->root.limit = parser->root.cursor + ps_len;
- parser->num_dict = -1;
-
- /* Finally, we check whether `StartData' or `/sfnts' was real -- */
- /* it could be in a comment or string. We also get the arguments */
- /* of `StartData' to find out whether the data is represented in */
- /* binary or hex format. */
-
- arg1 = parser->root.cursor;
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
- arg2 = parser->root.cursor;
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
-
- limit = parser->root.limit;
- cur = parser->root.cursor;
-
- while ( cur <= limit - SFNTS_LEN )
- {
- if ( parser->root.error )
- {
- error = parser->root.error;
- goto Exit;
- }
-
- if ( cur[0] == 'S' &&
- cur <= limit - STARTDATA_LEN &&
- ft_strncmp( (char*)cur, STARTDATA, STARTDATA_LEN ) == 0 )
- {
- if ( ft_strncmp( (char*)arg1, "(Hex)", 5 ) == 0 )
- {
- FT_Long tmp = ft_strtol( (const char *)arg2, NULL, 10 );
-
-
- if ( tmp < 0 )
- {
- FT_ERROR(( "cid_parser_new: invalid length of hex data\n" ));
- error = FT_THROW( Invalid_File_Format );
- }
- else
- parser->binary_length = (FT_ULong)tmp;
- }
-
- goto Exit;
- }
- else if ( cur[1] == 's' &&
- ft_strncmp( (char*)cur, SFNTS, SFNTS_LEN ) == 0 )
- {
- FT_TRACE2(( "cid_parser_new: cannot handle Type 11 fonts\n" ));
- error = FT_THROW( Unknown_File_Format );
- goto Exit;
- }
-
- cid_parser_skip_PS_token( parser );
- cid_parser_skip_spaces ( parser );
- arg1 = arg2;
- arg2 = cur;
- cur = parser->root.cursor;
- }
-
- /* we haven't found the correct `StartData'; go back and continue */
- /* searching */
- FT_FRAME_RELEASE( parser->postscript );
- if ( !FT_STREAM_SEEK( offset ) )
- goto Again;
-
- Exit:
- return error;
- }
-
-
-#undef STARTDATA
-#undef STARTDATA_LEN
-#undef SFNTS
-#undef SFNTS_LEN
-
-
- FT_LOCAL_DEF( void )
- cid_parser_done( CID_Parser* parser )
- {
- /* always free the private dictionary */
- if ( parser->postscript )
- {
- FT_Stream stream = parser->stream;
-
-
- FT_FRAME_RELEASE( parser->postscript );
- }
- parser->root.funcs.done( &parser->root );
- }
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidparse.h b/third_party/freetype/src/cid/cidparse.h
deleted file mode 100644
index 20bebb942b..0000000000
--- a/third_party/freetype/src/cid/cidparse.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidparse.h */
-/* */
-/* CID-keyed Type1 parser (specification). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef CIDPARSE_H_
-#define CIDPARSE_H_
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_TYPE1_TYPES_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CID_Parser */
- /* */
- /* <Description> */
- /* A CID_Parser is an object used to parse a Type 1 fonts very */
- /* quickly. */
- /* */
- /* <Fields> */
- /* root :: The root PS_ParserRec fields. */
- /* */
- /* stream :: The current input stream. */
- /* */
- /* postscript :: A pointer to the data to be parsed. */
- /* */
- /* postscript_len :: The length of the data to be parsed. */
- /* */
- /* data_offset :: The start position of the binary data (i.e., the */
- /* end of the data to be parsed. */
- /* */
- /* binary_length :: The length of the data after the `StartData' */
- /* command if the data format is hexadecimal. */
- /* */
- /* cid :: A structure which holds the information about */
- /* the current font. */
- /* */
- /* num_dict :: The number of font dictionaries. */
- /* */
- typedef struct CID_Parser_
- {
- PS_ParserRec root;
- FT_Stream stream;
-
- FT_Byte* postscript;
- FT_ULong postscript_len;
-
- FT_ULong data_offset;
-
- FT_ULong binary_length;
-
- CID_FaceInfo cid;
- FT_Int num_dict;
-
- } CID_Parser;
-
-
- FT_LOCAL( FT_Error )
- cid_parser_new( CID_Parser* parser,
- FT_Stream stream,
- FT_Memory memory,
- PSAux_Service psaux );
-
- FT_LOCAL( void )
- cid_parser_done( CID_Parser* parser );
-
-
- /*************************************************************************/
- /* */
- /* PARSING ROUTINES */
- /* */
- /*************************************************************************/
-
-#define cid_parser_skip_spaces( p ) \
- (p)->root.funcs.skip_spaces( &(p)->root )
-#define cid_parser_skip_PS_token( p ) \
- (p)->root.funcs.skip_PS_token( &(p)->root )
-
-#define cid_parser_to_int( p ) (p)->root.funcs.to_int( &(p)->root )
-#define cid_parser_to_fixed( p, t ) (p)->root.funcs.to_fixed( &(p)->root, t )
-
-#define cid_parser_to_coord_array( p, m, c ) \
- (p)->root.funcs.to_coord_array( &(p)->root, m, c )
-#define cid_parser_to_fixed_array( p, m, f, t ) \
- (p)->root.funcs.to_fixed_array( &(p)->root, m, f, t )
-#define cid_parser_to_token( p, t ) \
- (p)->root.funcs.to_token( &(p)->root, t )
-#define cid_parser_to_token_array( p, t, m, c ) \
- (p)->root.funcs.to_token_array( &(p)->root, t, m, c )
-
-#define cid_parser_load_field( p, f, o ) \
- (p)->root.funcs.load_field( &(p)->root, f, o, 0, 0 )
-#define cid_parser_load_field_table( p, f, o ) \
- (p)->root.funcs.load_field_table( &(p)->root, f, o, 0, 0 )
-
-
-FT_END_HEADER
-
-#endif /* CIDPARSE_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidriver.c b/third_party/freetype/src/cid/cidriver.c
deleted file mode 100644
index bb611a961e..0000000000
--- a/third_party/freetype/src/cid/cidriver.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidriver.c */
-/* */
-/* CID driver interface (body). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include "cidriver.h"
-#include "cidgload.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "ciderrs.h"
-
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_CID_H
-
-
- /*************************************************************************/
- /* */
- /* 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_ciddriver
-
-
- /*
- * POSTSCRIPT NAME SERVICE
- *
- */
-
- static const char*
- cid_get_postscript_name( CID_Face face )
- {
- const char* result = face->cid.cid_font_name;
-
-
- if ( result && result[0] == '/' )
- result++;
-
- return result;
- }
-
-
- static const FT_Service_PsFontNameRec cid_service_ps_name =
- {
- (FT_PsName_GetFunc)cid_get_postscript_name /* get_ps_font_name */
- };
-
-
- /*
- * POSTSCRIPT INFO SERVICE
- *
- */
-
- static FT_Error
- cid_ps_get_font_info( FT_Face face,
- PS_FontInfoRec* afont_info )
- {
- *afont_info = ((CID_Face)face)->cid.font_info;
-
- return FT_Err_Ok;
- }
-
- static FT_Error
- cid_ps_get_font_extra( FT_Face face,
- PS_FontExtraRec* afont_extra )
- {
- *afont_extra = ((CID_Face)face)->font_extra;
-
- return FT_Err_Ok;
- }
-
- static const FT_Service_PsInfoRec cid_service_ps_info =
- {
- (PS_GetFontInfoFunc) cid_ps_get_font_info, /* ps_get_font_info */
- (PS_GetFontExtraFunc) cid_ps_get_font_extra, /* ps_get_font_extra */
- /* unsupported with CID fonts */
- (PS_HasGlyphNamesFunc) NULL, /* ps_has_glyph_names */
- /* unsupported */
- (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
- /* not implemented */
- (PS_GetFontValueFunc) NULL /* ps_get_font_value */
- };
-
-
- /*
- * CID INFO SERVICE
- *
- */
- static FT_Error
- cid_get_ros( CID_Face face,
- const char* *registry,
- const char* *ordering,
- FT_Int *supplement )
- {
- CID_FaceInfo cid = &face->cid;
-
-
- if ( registry )
- *registry = cid->registry;
-
- if ( ordering )
- *ordering = cid->ordering;
-
- if ( supplement )
- *supplement = cid->supplement;
-
- return FT_Err_Ok;
- }
-
-
- static FT_Error
- cid_get_is_cid( CID_Face face,
- FT_Bool *is_cid )
- {
- FT_Error error = FT_Err_Ok;
- FT_UNUSED( face );
-
-
- if ( is_cid )
- *is_cid = 1; /* cid driver is only used for CID keyed fonts */
-
- return error;
- }
-
-
- static FT_Error
- cid_get_cid_from_glyph_index( CID_Face face,
- FT_UInt glyph_index,
- FT_UInt *cid )
- {
- FT_Error error = FT_Err_Ok;
- FT_UNUSED( face );
-
-
- if ( cid )
- *cid = glyph_index; /* identity mapping */
-
- return error;
- }
-
-
- static const FT_Service_CIDRec cid_service_cid_info =
- {
- (FT_CID_GetRegistryOrderingSupplementFunc)
- cid_get_ros, /* get_ros */
- (FT_CID_GetIsInternallyCIDKeyedFunc)
- cid_get_is_cid, /* get_is_cid */
- (FT_CID_GetCIDFromGlyphIndexFunc)
- cid_get_cid_from_glyph_index /* get_cid_from_glyph_index */
- };
-
-
- /*
- * SERVICE LIST
- *
- */
-
- static const FT_ServiceDescRec cid_services[] =
- {
- { FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CID },
- { FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cid_service_ps_name },
- { FT_SERVICE_ID_POSTSCRIPT_INFO, &cid_service_ps_info },
- { FT_SERVICE_ID_CID, &cid_service_cid_info },
- { NULL, NULL }
- };
-
-
- FT_CALLBACK_DEF( FT_Module_Interface )
- cid_get_interface( FT_Module module,
- const char* cid_interface )
- {
- FT_UNUSED( module );
-
- return ft_service_list_lookup( cid_services, cid_interface );
- }
-
-
-
- FT_CALLBACK_TABLE_DEF
- const FT_Driver_ClassRec t1cid_driver_class =
- {
- {
- FT_MODULE_FONT_DRIVER |
- FT_MODULE_DRIVER_SCALABLE |
- FT_MODULE_DRIVER_HAS_HINTER,
- sizeof ( FT_DriverRec ),
-
- "t1cid", /* module name */
- 0x10000L, /* version 1.0 of driver */
- 0x20000L, /* requires FreeType 2.0 */
-
- NULL, /* module-specific interface */
-
- cid_driver_init, /* FT_Module_Constructor module_init */
- cid_driver_done, /* FT_Module_Destructor module_done */
- cid_get_interface /* FT_Module_Requester get_interface */
- },
-
- sizeof ( CID_FaceRec ),
- sizeof ( CID_SizeRec ),
- sizeof ( CID_GlyphSlotRec ),
-
- cid_face_init, /* FT_Face_InitFunc init_face */
- cid_face_done, /* FT_Face_DoneFunc done_face */
- cid_size_init, /* FT_Size_InitFunc init_size */
- cid_size_done, /* FT_Size_DoneFunc done_size */
- cid_slot_init, /* FT_Slot_InitFunc init_slot */
- cid_slot_done, /* FT_Slot_DoneFunc done_slot */
-
- cid_slot_load_glyph, /* FT_Slot_LoadFunc load_glyph */
-
- NULL, /* FT_Face_GetKerningFunc get_kerning */
- NULL, /* FT_Face_AttachFunc attach_file */
- NULL, /* FT_Face_GetAdvancesFunc get_advances */
-
- cid_size_request, /* FT_Size_RequestFunc request_size */
- NULL /* FT_Size_SelectFunc select_size */
- };
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidriver.h b/third_party/freetype/src/cid/cidriver.h
deleted file mode 100644
index 76640c57ba..0000000000
--- a/third_party/freetype/src/cid/cidriver.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidriver.h */
-/* */
-/* High-level CID driver interface (specification). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef CIDRIVER_H_
-#define CIDRIVER_H_
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
-
-
-FT_BEGIN_HEADER
-
-#ifdef FT_CONFIG_OPTION_PIC
-#error "this module does not support PIC yet"
-#endif
-
-
- FT_CALLBACK_TABLE
- const FT_Driver_ClassRec t1cid_driver_class;
-
-
-FT_END_HEADER
-
-#endif /* CIDRIVER_H_ */
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/cidtoken.h b/third_party/freetype/src/cid/cidtoken.h
deleted file mode 100644
index 653cc5586e..0000000000
--- a/third_party/freetype/src/cid/cidtoken.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* cidtoken.h */
-/* */
-/* CID token definitions (specification only). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CID_FaceInfoRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_CID_INFO
-
- T1_FIELD_KEY ( "CIDFontName", cid_font_name, 0 )
- T1_FIELD_FIXED ( "CIDFontVersion", cid_version, 0 )
- T1_FIELD_NUM ( "CIDFontType", cid_font_type, 0 )
- T1_FIELD_STRING( "Registry", registry, 0 )
- T1_FIELD_STRING( "Ordering", ordering, 0 )
- T1_FIELD_NUM ( "Supplement", supplement, 0 )
- T1_FIELD_NUM ( "UIDBase", uid_base, 0 )
- T1_FIELD_NUM ( "CIDMapOffset", cidmap_offset, 0 )
- T1_FIELD_NUM ( "FDBytes", fd_bytes, 0 )
- T1_FIELD_NUM ( "GDBytes", gd_bytes, 0 )
- T1_FIELD_NUM ( "CIDCount", cid_count, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontInfoRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_INFO
-
- T1_FIELD_STRING( "version", version, 0 )
- T1_FIELD_STRING( "Notice", notice, 0 )
- T1_FIELD_STRING( "FullName", full_name, 0 )
- T1_FIELD_STRING( "FamilyName", family_name, 0 )
- T1_FIELD_STRING( "Weight", weight, 0 )
- T1_FIELD_NUM ( "ItalicAngle", italic_angle, 0 )
- T1_FIELD_BOOL ( "isFixedPitch", is_fixed_pitch, 0 )
- T1_FIELD_NUM ( "UnderlinePosition", underline_position, 0 )
- T1_FIELD_NUM ( "UnderlineThickness", underline_thickness, 0 )
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_FontExtraRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_EXTRA
-
- T1_FIELD_NUM ( "FSType", fs_type, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE CID_FaceDictRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_FONT_DICT
-
- T1_FIELD_NUM ( "PaintType", paint_type, 0 )
- T1_FIELD_NUM ( "FontType", font_type, 0 )
- T1_FIELD_NUM ( "SubrMapOffset", subrmap_offset, 0 )
- T1_FIELD_NUM ( "SDBytes", sd_bytes, 0 )
- T1_FIELD_NUM ( "SubrCount", num_subrs, 0 )
- T1_FIELD_NUM ( "lenBuildCharArray", len_buildchar, 0 )
- T1_FIELD_FIXED( "ForceBoldThreshold", forcebold_threshold, 0 )
- T1_FIELD_FIXED( "StrokeWidth", stroke_width, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE PS_PrivateRec
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_PRIVATE
-
- T1_FIELD_NUM ( "UniqueID", unique_id, 0 )
- T1_FIELD_NUM ( "lenIV", lenIV, 0 )
- T1_FIELD_NUM ( "LanguageGroup", language_group, 0 )
- T1_FIELD_NUM ( "password", password, 0 )
-
- T1_FIELD_FIXED_1000( "BlueScale", blue_scale, 0 )
- T1_FIELD_NUM ( "BlueShift", blue_shift, 0 )
- T1_FIELD_NUM ( "BlueFuzz", blue_fuzz, 0 )
-
- T1_FIELD_NUM_TABLE ( "BlueValues", blue_values, 14, 0 )
- T1_FIELD_NUM_TABLE ( "OtherBlues", other_blues, 10, 0 )
- T1_FIELD_NUM_TABLE ( "FamilyBlues", family_blues, 14, 0 )
- T1_FIELD_NUM_TABLE ( "FamilyOtherBlues", family_other_blues, 10, 0 )
-
- T1_FIELD_NUM_TABLE2( "StdHW", standard_width, 1, 0 )
- T1_FIELD_NUM_TABLE2( "StdVW", standard_height, 1, 0 )
- T1_FIELD_NUM_TABLE2( "MinFeature", min_feature, 2, 0 )
-
- T1_FIELD_NUM_TABLE ( "StemSnapH", snap_widths, 12, 0 )
- T1_FIELD_NUM_TABLE ( "StemSnapV", snap_heights, 12, 0 )
-
- T1_FIELD_BOOL ( "ForceBold", force_bold, 0 )
-
-
-#undef FT_STRUCTURE
-#define FT_STRUCTURE FT_BBox
-#undef T1CODE
-#define T1CODE T1_FIELD_LOCATION_BBOX
-
- T1_FIELD_BBOX( "FontBBox", xMin, 0 )
-
-
-/* END */
diff --git a/third_party/freetype/src/cid/type1cid.c b/third_party/freetype/src/cid/type1cid.c
deleted file mode 100644
index aeb9c3eabf..0000000000
--- a/third_party/freetype/src/cid/type1cid.c
+++ /dev/null
@@ -1,29 +0,0 @@
-/***************************************************************************/
-/* */
-/* type1cid.c */
-/* */
-/* FreeType OpenType driver component (body only). */
-/* */
-/* Copyright 1996-2017 by */
-/* David Turner, Robert Wilhelm, and Werner Lemberg. */
-/* */
-/* This file is part of the FreeType project, and may only be used, */
-/* modified, and distributed under the terms of the FreeType project */
-/* license, LICENSE.TXT. By continuing to use, modify, or distribute */
-/* this file you indicate that you have read the license and */
-/* understand and accept it fully. */
-/* */
-/***************************************************************************/
-
-
-#define FT_MAKE_OPTION_SINGLE_OBJECT
-
-#include <ft2build.h>
-#include "cidparse.c"
-#include "cidload.c"
-#include "cidobjs.c"
-#include "cidriver.c"
-#include "cidgload.c"
-
-
-/* END */