summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/freetype/src/cff
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/freetype/src/cff')
-rw-r--r--src/3rdparty/freetype/src/cff/Jamfile36
-rw-r--r--src/3rdparty/freetype/src/cff/cf2arrst.c241
-rw-r--r--src/3rdparty/freetype/src/cff/cf2arrst.h100
-rw-r--r--src/3rdparty/freetype/src/cff/cf2blues.c579
-rw-r--r--src/3rdparty/freetype/src/cff/cf2blues.h185
-rw-r--r--src/3rdparty/freetype/src/cff/cf2error.c52
-rw-r--r--src/3rdparty/freetype/src/cff/cf2error.h119
-rw-r--r--src/3rdparty/freetype/src/cff/cf2fixed.h95
-rw-r--r--src/3rdparty/freetype/src/cff/cf2font.c512
-rw-r--r--src/3rdparty/freetype/src/cff/cf2font.h121
-rw-r--r--src/3rdparty/freetype/src/cff/cf2ft.c700
-rw-r--r--src/3rdparty/freetype/src/cff/cf2ft.h147
-rw-r--r--src/3rdparty/freetype/src/cff/cf2glue.h144
-rw-r--r--src/3rdparty/freetype/src/cff/cf2hints.c1847
-rw-r--r--src/3rdparty/freetype/src/cff/cf2hints.h289
-rw-r--r--src/3rdparty/freetype/src/cff/cf2intrp.c1571
-rw-r--r--src/3rdparty/freetype/src/cff/cf2intrp.h83
-rw-r--r--src/3rdparty/freetype/src/cff/cf2read.c112
-rw-r--r--src/3rdparty/freetype/src/cff/cf2read.h68
-rw-r--r--src/3rdparty/freetype/src/cff/cf2stack.c205
-rw-r--r--src/3rdparty/freetype/src/cff/cf2stack.h106
-rw-r--r--src/3rdparty/freetype/src/cff/cf2types.h78
-rw-r--r--src/3rdparty/freetype/src/cff/cff.c3
-rw-r--r--src/3rdparty/freetype/src/cff/cffcmap.c112
-rw-r--r--src/3rdparty/freetype/src/cff/cffcmap.h8
-rw-r--r--src/3rdparty/freetype/src/cff/cffdrivr.c540
-rw-r--r--src/3rdparty/freetype/src/cff/cffdrivr.h5
-rw-r--r--src/3rdparty/freetype/src/cff/cfferrs.h6
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.c125
-rw-r--r--src/3rdparty/freetype/src/cff/cffgload.h7
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.c208
-rw-r--r--src/3rdparty/freetype/src/cff/cffload.h11
-rw-r--r--src/3rdparty/freetype/src/cff/cffobjs.c154
-rw-r--r--src/3rdparty/freetype/src/cff/cffobjs.h3
-rw-r--r--src/3rdparty/freetype/src/cff/cffparse.c293
-rw-r--r--src/3rdparty/freetype/src/cff/cffparse.h20
-rw-r--r--src/3rdparty/freetype/src/cff/cffpic.c138
-rw-r--r--src/3rdparty/freetype/src/cff/cffpic.h121
-rw-r--r--src/3rdparty/freetype/src/cff/cfftoken.h2
-rw-r--r--src/3rdparty/freetype/src/cff/cfftypes.h284
-rw-r--r--src/3rdparty/freetype/src/cff/module.mk2
-rw-r--r--src/3rdparty/freetype/src/cff/rules.mk2
42 files changed, 782 insertions, 8652 deletions
diff --git a/src/3rdparty/freetype/src/cff/Jamfile b/src/3rdparty/freetype/src/cff/Jamfile
deleted file mode 100644
index 10f49cef12..0000000000
--- a/src/3rdparty/freetype/src/cff/Jamfile
+++ /dev/null
@@ -1,36 +0,0 @@
-# FreeType 2 src/cff Jamfile
-#
-# Copyright (C) 2001-2019 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.
-
-SubDir FT2_TOP $(FT2_SRC_DIR) cff ;
-
-{
- local _sources ;
-
- if $(FT2_MULTI)
- {
- _sources = cffcmap
- cffdrivr
- cffgload
- cffload
- cffobjs
- cffparse
- cffpic
- ;
- }
- else
- {
- _sources = cff ;
- }
-
- Library $(FT2_LIB) : $(_sources).c ;
-}
-
-# end of src/cff Jamfile
diff --git a/src/3rdparty/freetype/src/cff/cf2arrst.c b/src/3rdparty/freetype/src/cff/cf2arrst.c
deleted file mode 100644
index 89f3e9f1d7..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2arrst.c
+++ /dev/null
@@ -1,241 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2arrst.c */
-/* */
-/* Adobe's code for Array Stacks (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2arrst.h"
-
-#include "cf2error.h"
-
-
- /*
- * CF2_ArrStack uses an error pointer, to enable shared errors.
- * Shared errors are necessary when multiple objects allow the program
- * to continue after detecting errors. Only the first error should be
- * recorded.
- */
-
- FT_LOCAL_DEF( void )
- cf2_arrstack_init( CF2_ArrStack arrstack,
- FT_Memory memory,
- FT_Error* error,
- size_t sizeItem )
- {
- FT_ASSERT( arrstack != NULL );
-
- /* initialize the structure */
- arrstack->memory = memory;
- arrstack->error = error;
- arrstack->sizeItem = sizeItem;
- arrstack->allocated = 0;
- arrstack->chunk = 10; /* chunks of 10 items */
- arrstack->count = 0;
- arrstack->totalSize = 0;
- arrstack->ptr = NULL;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_arrstack_finalize( CF2_ArrStack arrstack )
- {
- FT_Memory memory = arrstack->memory; /* for FT_FREE */
-
-
- FT_ASSERT( arrstack != NULL );
-
- arrstack->allocated = 0;
- arrstack->count = 0;
- arrstack->totalSize = 0;
-
- /* free the data buffer */
- FT_FREE( arrstack->ptr );
- }
-
-
- /* allocate or reallocate the buffer size; */
- /* return false on memory error */
- static FT_Bool
- cf2_arrstack_setNumElements( CF2_ArrStack arrstack,
- size_t numElements )
- {
- FT_ASSERT( arrstack != NULL );
-
- {
- FT_Error error = FT_Err_Ok; /* for FT_REALLOC */
- FT_Memory memory = arrstack->memory; /* for FT_REALLOC */
-
- size_t newSize = numElements * arrstack->sizeItem;
-
-
- if ( numElements > FT_LONG_MAX / arrstack->sizeItem )
- goto exit;
-
-
- FT_ASSERT( newSize > 0 ); /* avoid realloc with zero size */
-
- if ( !FT_REALLOC( arrstack->ptr, arrstack->totalSize, newSize ) )
- {
- arrstack->allocated = numElements;
- arrstack->totalSize = newSize;
-
- if ( arrstack->count > numElements )
- {
- /* we truncated the list! */
- CF2_SET_ERROR( arrstack->error, Stack_Overflow );
- arrstack->count = numElements;
- return FALSE;
- }
-
- return TRUE; /* success */
- }
- }
-
- exit:
- /* if there's not already an error, store this one */
- CF2_SET_ERROR( arrstack->error, Out_Of_Memory );
-
- return FALSE;
- }
-
-
- /* set the count, ensuring allocation is sufficient */
- FT_LOCAL_DEF( void )
- cf2_arrstack_setCount( CF2_ArrStack arrstack,
- size_t numElements )
- {
- FT_ASSERT( arrstack != NULL );
-
- if ( numElements > arrstack->allocated )
- {
- /* expand the allocation first */
- if ( !cf2_arrstack_setNumElements( arrstack, numElements ) )
- return;
- }
-
- arrstack->count = numElements;
- }
-
-
- /* clear the count */
- FT_LOCAL_DEF( void )
- cf2_arrstack_clear( CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- arrstack->count = 0;
- }
-
-
- /* current number of items */
- FT_LOCAL_DEF( size_t )
- cf2_arrstack_size( const CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- return arrstack->count;
- }
-
-
- FT_LOCAL_DEF( void* )
- cf2_arrstack_getBuffer( const CF2_ArrStack arrstack )
- {
- FT_ASSERT( arrstack != NULL );
-
- return arrstack->ptr;
- }
-
-
- /* return pointer to the given element */
- FT_LOCAL_DEF( void* )
- cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
- size_t idx )
- {
- void* newPtr;
-
-
- FT_ASSERT( arrstack != NULL );
-
- if ( idx >= arrstack->count )
- {
- /* overflow */
- CF2_SET_ERROR( arrstack->error, Stack_Overflow );
- idx = 0; /* choose safe default */
- }
-
- newPtr = (FT_Byte*)arrstack->ptr + idx * arrstack->sizeItem;
-
- return newPtr;
- }
-
-
- /* push (append) an element at the end of the list; */
- /* return false on memory error */
- /* TODO: should there be a length param for extra checking? */
- FT_LOCAL_DEF( void )
- cf2_arrstack_push( CF2_ArrStack arrstack,
- const void* ptr )
- {
- FT_ASSERT( arrstack != NULL );
-
- if ( arrstack->count == arrstack->allocated )
- {
- /* grow the buffer by one chunk */
- if ( !cf2_arrstack_setNumElements(
- arrstack, arrstack->allocated + arrstack->chunk ) )
- {
- /* on error, ignore the push */
- return;
- }
- }
-
- FT_ASSERT( ptr != NULL );
-
- {
- size_t offset = arrstack->count * arrstack->sizeItem;
- void* newPtr = (FT_Byte*)arrstack->ptr + offset;
-
-
- FT_MEM_COPY( newPtr, ptr, arrstack->sizeItem );
- arrstack->count += 1;
- }
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2arrst.h b/src/3rdparty/freetype/src/cff/cf2arrst.h
deleted file mode 100644
index ff5ad8b126..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2arrst.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2arrst.h */
-/* */
-/* Adobe's code for Array Stacks (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2ARRST_H__
-#define __CF2ARRST_H__
-
-
-#include "cf2error.h"
-
-
-FT_BEGIN_HEADER
-
-
- /* need to define the struct here (not opaque) so it can be allocated by */
- /* clients */
- typedef struct CF2_ArrStackRec_
- {
- FT_Memory memory;
- FT_Error* error;
-
- size_t sizeItem; /* bytes per element */
- size_t allocated; /* items allocated */
- size_t chunk; /* allocation increment in items */
- size_t count; /* number of elements allocated */
- size_t totalSize; /* total bytes allocated */
-
- void* ptr; /* ptr to data */
-
- } CF2_ArrStackRec, *CF2_ArrStack;
-
-
- FT_LOCAL( void )
- cf2_arrstack_init( CF2_ArrStack arrstack,
- FT_Memory memory,
- FT_Error* error,
- size_t sizeItem );
- FT_LOCAL( void )
- cf2_arrstack_finalize( CF2_ArrStack arrstack );
-
- FT_LOCAL( void )
- cf2_arrstack_setCount( CF2_ArrStack arrstack,
- size_t numElements );
- FT_LOCAL( void )
- cf2_arrstack_clear( CF2_ArrStack arrstack );
- FT_LOCAL( size_t )
- cf2_arrstack_size( const CF2_ArrStack arrstack );
-
- FT_LOCAL( void* )
- cf2_arrstack_getBuffer( const CF2_ArrStack arrstack );
- FT_LOCAL( void* )
- cf2_arrstack_getPointer( const CF2_ArrStack arrstack,
- size_t idx );
-
- FT_LOCAL( void )
- cf2_arrstack_push( CF2_ArrStack arrstack,
- const void* ptr );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2ARRST_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2blues.c b/src/3rdparty/freetype/src/cff/cf2blues.c
deleted file mode 100644
index 250f89e0df..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2blues.c
+++ /dev/null
@@ -1,579 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2blues.c */
-/* */
-/* Adobe's code for handling Blue Zones (body). */
-/* */
-/* Copyright 2009-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2blues.h"
-#include "cf2hints.h"
-#include "cf2font.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_cf2blues
-
-
- /*
- * For blue values, the FreeType parser produces an array of integers,
- * while the Adobe CFF engine produces an array of fixed.
- * Define a macro to convert FreeType to fixed.
- */
-#define cf2_blueToFixed( x ) cf2_intToFixed( x )
-
-
- FT_LOCAL_DEF( void )
- cf2_blues_init( CF2_Blues blues,
- CF2_Font font )
- {
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- CF2_Fixed zoneHeight;
- CF2_Fixed maxZoneHeight = 0;
- CF2_Fixed csUnitsPerPixel;
-
- size_t numBlueValues;
- size_t numOtherBlues;
- size_t numFamilyBlues;
- size_t numFamilyOtherBlues;
-
- FT_Pos* blueValues;
- FT_Pos* otherBlues;
- FT_Pos* familyBlues;
- FT_Pos* familyOtherBlues;
-
- size_t i;
- CF2_Fixed emBoxBottom, emBoxTop;
-
-#if 0
- CF2_Int unitsPerEm = font->unitsPerEm;
-
-
- if ( unitsPerEm == 0 )
- unitsPerEm = 1000;
-#endif
-
- FT_ZERO( blues );
- blues->scale = font->innerTransform.d;
-
- cf2_getBlueMetrics( decoder,
- &blues->blueScale,
- &blues->blueShift,
- &blues->blueFuzz );
-
- cf2_getBlueValues( decoder, &numBlueValues, &blueValues );
- cf2_getOtherBlues( decoder, &numOtherBlues, &otherBlues );
- cf2_getFamilyBlues( decoder, &numFamilyBlues, &familyBlues );
- cf2_getFamilyOtherBlues( decoder, &numFamilyOtherBlues, &familyOtherBlues );
-
- /*
- * synthetic em box hint heuristic
- *
- * Apply this when ideographic dictionary (LanguageGroup 1) has no
- * real alignment zones. Adobe tools generate dummy zones at -250 and
- * 1100 for a 1000 unit em. Fonts with ICF-based alignment zones
- * should not enable the heuristic. When the heuristic is enabled,
- * the font's blue zones are ignored.
- *
- */
-
- /* get em box from OS/2 typoAscender/Descender */
- /* TODO: FreeType does not parse these metrics. Skip them for now. */
-#if 0
- FCM_getHorizontalLineMetrics( &e,
- font->font,
- &ascender,
- &descender,
- &linegap );
- if ( ascender - descender == unitsPerEm )
- {
- emBoxBottom = cf2_intToFixed( descender );
- emBoxTop = cf2_intToFixed( ascender );
- }
- else
-#endif
- {
- emBoxBottom = CF2_ICF_Bottom;
- emBoxTop = CF2_ICF_Top;
- }
-
- if ( cf2_getLanguageGroup( decoder ) == 1 &&
- ( numBlueValues == 0 ||
- ( numBlueValues == 4 &&
- cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&
- cf2_blueToFixed( blueValues[2] ) > emBoxTop &&
- cf2_blueToFixed( blueValues[3] ) > emBoxTop ) ) )
- {
- /*
- * Construct hint edges suitable for synthetic ghost hints at top
- * and bottom of em box. +-CF2_MIN_COUNTER allows for unhinted
- * features above or below the last hinted edge. This also gives a
- * net 1 pixel boost to the height of ideographic glyphs.
- *
- * Note: Adjust synthetic hints outward by epsilon (0x.0001) to
- * avoid interference. E.g., some fonts have real hints at
- * 880 and -120.
- */
-
- blues->emBoxBottomEdge.csCoord = emBoxBottom - CF2_FIXED_EPSILON;
- blues->emBoxBottomEdge.dsCoord = cf2_fixedRound(
- FT_MulFix(
- blues->emBoxBottomEdge.csCoord,
- blues->scale ) ) -
- CF2_MIN_COUNTER;
- blues->emBoxBottomEdge.scale = blues->scale;
- blues->emBoxBottomEdge.flags = CF2_GhostBottom |
- CF2_Locked |
- CF2_Synthetic;
-
- blues->emBoxTopEdge.csCoord = emBoxTop + CF2_FIXED_EPSILON +
- 2 * font->darkenY;
- blues->emBoxTopEdge.dsCoord = cf2_fixedRound(
- FT_MulFix(
- blues->emBoxTopEdge.csCoord,
- blues->scale ) ) +
- CF2_MIN_COUNTER;
- blues->emBoxTopEdge.scale = blues->scale;
- blues->emBoxTopEdge.flags = CF2_GhostTop |
- CF2_Locked |
- CF2_Synthetic;
-
- blues->doEmBoxHints = TRUE; /* enable the heuristic */
-
- return;
- }
-
- /* copy `BlueValues' and `OtherBlues' to a combined array of top and */
- /* bottom zones */
- for ( i = 0; i < numBlueValues; i += 2 )
- {
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( blueValues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( blueValues[i + 1] );
-
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
-
- if ( zoneHeight < 0 )
- {
- FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
- continue; /* reject this zone */
- }
-
- if ( zoneHeight > maxZoneHeight )
- {
- /* take maximum before darkening adjustment */
- /* so overshoot suppression point doesn't change */
- maxZoneHeight = zoneHeight;
- }
-
- /* adjust both edges of top zone upward by twice darkening amount */
- if ( i != 0 )
- {
- blues->zone[blues->count].csTopEdge += 2 * font->darkenY;
- blues->zone[blues->count].csBottomEdge += 2 * font->darkenY;
- }
-
- /* first `BlueValue' is bottom zone; others are top */
- if ( i == 0 )
- {
- blues->zone[blues->count].bottomZone =
- TRUE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csTopEdge;
- }
- else
- {
- blues->zone[blues->count].bottomZone =
- FALSE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csBottomEdge;
- }
-
- blues->count += 1;
- }
-
- for ( i = 0; i < numOtherBlues; i += 2 )
- {
- blues->zone[blues->count].csBottomEdge =
- cf2_blueToFixed( otherBlues[i] );
- blues->zone[blues->count].csTopEdge =
- cf2_blueToFixed( otherBlues[i + 1] );
-
- zoneHeight = blues->zone[blues->count].csTopEdge -
- blues->zone[blues->count].csBottomEdge;
-
- if ( zoneHeight < 0 )
- {
- FT_TRACE4(( "cf2_blues_init: ignoring negative zone height\n" ));
- continue; /* reject this zone */
- }
-
- if ( zoneHeight > maxZoneHeight )
- {
- /* take maximum before darkening adjustment */
- /* so overshoot suppression point doesn't change */
- maxZoneHeight = zoneHeight;
- }
-
- /* Note: bottom zones are not adjusted for darkening amount */
-
- /* all OtherBlues are bottom zone */
- blues->zone[blues->count].bottomZone =
- TRUE;
- blues->zone[blues->count].csFlatEdge =
- blues->zone[blues->count].csTopEdge;
-
- blues->count += 1;
- }
-
- /* Adjust for FamilyBlues */
-
- /* Search for the nearest flat edge in `FamilyBlues' or */
- /* `FamilyOtherBlues'. According to the Black Book, any matching edge */
- /* must be within one device pixel */
-
- csUnitsPerPixel = FT_DivFix( cf2_intToFixed( 1 ), blues->scale );
-
- /* loop on all zones in this font */
- for ( i = 0; i < blues->count; i++ )
- {
- size_t j;
- CF2_Fixed minDiff;
- CF2_Fixed flatFamilyEdge, diff;
- /* value for this font */
- CF2_Fixed flatEdge = blues->zone[i].csFlatEdge;
-
-
- if ( blues->zone[i].bottomZone )
- {
- /* In a bottom zone, the top edge is the flat edge. */
- /* Search `FamilyOtherBlues' for bottom zones; look for closest */
- /* Family edge that is within the one pixel threshold. */
-
- minDiff = CF2_FIXED_MAX;
-
- for ( j = 0; j < numFamilyOtherBlues; j += 2 )
- {
- /* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- {
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- minDiff = diff;
-
- if ( diff == 0 )
- break;
- }
- }
-
- /* check the first member of FamilyBlues, which is a bottom zone */
- if ( numFamilyBlues >= 2 )
- {
- /* top edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- }
- }
- else
- {
- /* In a top zone, the bottom edge is the flat edge. */
- /* Search `FamilyBlues' for top zones; skip first zone, which is a */
- /* bottom zone; look for closest Family edge that is within the */
- /* one pixel threshold */
-
- minDiff = CF2_FIXED_MAX;
-
- for ( j = 2; j < numFamilyBlues; j += 2 )
- {
- /* bottom edge */
- flatFamilyEdge = cf2_blueToFixed( familyBlues[j] );
-
- /* adjust edges of top zone upward by twice darkening amount */
- flatFamilyEdge += 2 * font->darkenY; /* bottom edge */
-
- diff = cf2_fixedAbs( flatEdge - flatFamilyEdge );
-
- if ( diff < minDiff && diff < csUnitsPerPixel )
- {
- blues->zone[i].csFlatEdge = flatFamilyEdge;
- minDiff = diff;
-
- if ( diff == 0 )
- break;
- }
- }
- }
- }
-
- /* TODO: enforce separation of zones, including BlueFuzz */
-
- /* Adjust BlueScale; similar to AdjustBlueScale() in coretype */
- /* `bcsetup.c'. */
-
- if ( maxZoneHeight > 0 )
- {
- if ( blues->blueScale > FT_DivFix( cf2_intToFixed( 1 ),
- maxZoneHeight ) )
- {
- /* clamp at maximum scale */
- blues->blueScale = FT_DivFix( cf2_intToFixed( 1 ),
- maxZoneHeight );
- }
-
- /*
- * TODO: Revisit the bug fix for 613448. The minimum scale
- * requirement catches a number of library fonts. For
- * example, with default BlueScale (.039625) and 0.4 minimum,
- * the test below catches any font with maxZoneHeight < 10.1.
- * There are library fonts ranging from 2 to 10 that get
- * caught, including e.g., Eurostile LT Std Medium with
- * maxZoneHeight of 6.
- *
- */
-#if 0
- if ( blueScale < .4 / maxZoneHeight )
- {
- tetraphilia_assert( 0 );
- /* clamp at minimum scale, per bug 0613448 fix */
- blueScale = .4 / maxZoneHeight;
- }
-#endif
-
- }
-
- /*
- * Suppress overshoot and boost blue zones at small sizes. Boost
- * amount varies linearly from 0.5 pixel near 0 to 0 pixel at
- * blueScale cutoff.
- * Note: This boost amount is different from the coretype heuristic.
- *
- */
-
- if ( blues->scale < blues->blueScale )
- {
- blues->suppressOvershoot = TRUE;
-
- /* Change rounding threshold for `dsFlatEdge'. */
- /* Note: constant changed from 0.5 to 0.6 to avoid a problem with */
- /* 10ppem Arial */
-
- blues->boost = cf2_floatToFixed( .6 ) -
- FT_MulDiv( cf2_floatToFixed ( .6 ),
- blues->scale,
- blues->blueScale );
- if ( blues->boost > 0x7FFF )
- {
- /* boost must remain less than 0.5, or baseline could go negative */
- blues->boost = 0x7FFF;
- }
- }
-
- /* boost and darkening have similar effects; don't do both */
- if ( font->stemDarkened )
- blues->boost = 0;
-
- /* set device space alignment for each zone; */
- /* apply boost amount before rounding flat edge */
-
- for ( i = 0; i < blues->count; i++ )
- {
- if ( blues->zone[i].bottomZone )
- blues->zone[i].dsFlatEdge = cf2_fixedRound(
- FT_MulFix(
- blues->zone[i].csFlatEdge,
- blues->scale ) -
- blues->boost );
- else
- blues->zone[i].dsFlatEdge = cf2_fixedRound(
- FT_MulFix(
- blues->zone[i].csFlatEdge,
- blues->scale ) +
- blues->boost );
- }
- }
-
-
- /*
- * Check whether `stemHint' is captured by one of the blue zones.
- *
- * Zero, one or both edges may be valid; only valid edges can be
- * captured. For compatibility with CoolType, search top and bottom
- * zones in the same pass (see `BlueLock'). If a hint is captured,
- * return true and position the edge(s) in one of 3 ways:
- *
- * 1) If `BlueScale' suppresses overshoot, position the captured edge
- * at the flat edge of the zone.
- * 2) If overshoot is not suppressed and `BlueShift' requires
- * overshoot, position the captured edge a minimum of 1 device pixel
- * from the flat edge.
- * 3) If overshoot is not suppressed or required, position the captured
- * edge at the nearest device pixel.
- *
- */
- FT_LOCAL_DEF( FT_Bool )
- cf2_blues_capture( const CF2_Blues blues,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge )
- {
- /* TODO: validate? */
- CF2_Fixed csFuzz = blues->blueFuzz;
-
- /* new position of captured edge */
- CF2_Fixed dsNew;
-
- /* amount that hint is moved when positioned */
- CF2_Fixed dsMove = 0;
-
- FT_Bool captured = FALSE;
- CF2_UInt i;
-
-
- /* assert edge flags are consistent */
- FT_ASSERT( !cf2_hint_isTop( bottomHintEdge ) &&
- !cf2_hint_isBottom( topHintEdge ) );
-
- /* TODO: search once without blue fuzz for compatibility with coretype? */
- for ( i = 0; i < blues->count; i++ )
- {
- if ( blues->zone[i].bottomZone &&
- cf2_hint_isBottom( bottomHintEdge ) )
- {
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- bottomHintEdge->csCoord &&
- bottomHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
- {
- /* bottom edge captured by bottom zone */
-
- if ( blues->suppressOvershoot )
- dsNew = blues->zone[i].dsFlatEdge;
-
- else if ( ( blues->zone[i].csTopEdge - bottomHintEdge->csCoord ) >=
- blues->blueShift )
- {
- /* guarantee minimum of 1 pixel overshoot */
- dsNew = FT_MIN(
- cf2_fixedRound( bottomHintEdge->dsCoord ),
- blues->zone[i].dsFlatEdge - cf2_intToFixed( 1 ) );
- }
-
- else
- {
- /* simply round captured edge */
- dsNew = cf2_fixedRound( bottomHintEdge->dsCoord );
- }
-
- dsMove = dsNew - bottomHintEdge->dsCoord;
- captured = TRUE;
-
- break;
- }
- }
-
- if ( !blues->zone[i].bottomZone && cf2_hint_isTop( topHintEdge ) )
- {
- if ( ( blues->zone[i].csBottomEdge - csFuzz ) <=
- topHintEdge->csCoord &&
- topHintEdge->csCoord <=
- ( blues->zone[i].csTopEdge + csFuzz ) )
- {
- /* top edge captured by top zone */
-
- if ( blues->suppressOvershoot )
- dsNew = blues->zone[i].dsFlatEdge;
-
- else if ( ( topHintEdge->csCoord - blues->zone[i].csBottomEdge ) >=
- blues->blueShift )
- {
- /* guarantee minimum of 1 pixel overshoot */
- dsNew = FT_MAX(
- cf2_fixedRound( topHintEdge->dsCoord ),
- blues->zone[i].dsFlatEdge + cf2_intToFixed( 1 ) );
- }
-
- else
- {
- /* simply round captured edge */
- dsNew = cf2_fixedRound( topHintEdge->dsCoord );
- }
-
- dsMove = dsNew - topHintEdge->dsCoord;
- captured = TRUE;
-
- break;
- }
- }
- }
-
- if ( captured )
- {
- /* move both edges and flag them `locked' */
- if ( cf2_hint_isValid( bottomHintEdge ) )
- {
- bottomHintEdge->dsCoord += dsMove;
- cf2_hint_lock( bottomHintEdge );
- }
-
- if ( cf2_hint_isValid( topHintEdge ) )
- {
- topHintEdge->dsCoord += dsMove;
- cf2_hint_lock( topHintEdge );
- }
- }
-
- return captured;
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2blues.h b/src/3rdparty/freetype/src/cff/cf2blues.h
deleted file mode 100644
index 2f38fcad8f..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2blues.h
+++ /dev/null
@@ -1,185 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2blues.h */
-/* */
-/* Adobe's code for handling Blue Zones (specification). */
-/* */
-/* Copyright 2009-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
- /*
- * A `CF2_Blues' object stores the blue zones (horizontal alignment
- * zones) of a font. These are specified in the CFF private dictionary
- * by `BlueValues', `OtherBlues', `FamilyBlues', and `FamilyOtherBlues'.
- * Each zone is defined by a top and bottom edge in character space.
- * Further, each zone is either a top zone or a bottom zone, as recorded
- * by `bottomZone'.
- *
- * The maximum number of `BlueValues' and `FamilyBlues' is 7 each.
- * However, these are combined to produce a total of 7 zones.
- * Similarly, the maximum number of `OtherBlues' and `FamilyOtherBlues'
- * is 5 and these are combined to produce an additional 5 zones.
- *
- * Blue zones are used to `capture' hints and force them to a common
- * alignment point. This alignment is recorded in device space in
- * `dsFlatEdge'. Except for this value, a `CF2_Blues' object could be
- * constructed independently of scaling. Construction may occur once
- * the matrix is known. Other features implemented in the Capture
- * method are overshoot suppression, overshoot enforcement, and Blue
- * Boost.
- *
- * Capture is determined by `BlueValues' and `OtherBlues', but the
- * alignment point may be adjusted to the scaled flat edge of
- * `FamilyBlues' or `FamilyOtherBlues'. No alignment is done to the
- * curved edge of a zone.
- *
- */
-
-
-#ifndef __CF2BLUES_H__
-#define __CF2BLUES_H__
-
-
-#include "cf2glue.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * `CF2_Hint' is shared by `cf2hints.h' and
- * `cf2blues.h', but `cf2blues.h' depends on
- * `cf2hints.h', so define it here. Note: The typedef is in
- * `cf2glue.h'.
- *
- */
- enum
- {
- CF2_GhostBottom = 0x1, /* a single bottom edge */
- CF2_GhostTop = 0x2, /* a single top edge */
- CF2_PairBottom = 0x4, /* the bottom edge of a stem hint */
- CF2_PairTop = 0x8, /* the top edge of a stem hint */
- CF2_Locked = 0x10, /* this edge has been aligned */
- /* by a blue zone */
- CF2_Synthetic = 0x20 /* this edge was synthesized */
- };
-
-
- /*
- * Default value for OS/2 typoAscender/Descender when their difference
- * is not equal to `unitsPerEm'. The default is based on -250 and 1100
- * in `CF2_Blues', assuming 1000 units per em here.
- *
- */
- enum
- {
- CF2_ICF_Top = cf2_intToFixed( 880 ),
- CF2_ICF_Bottom = cf2_intToFixed( -120 )
- };
-
-
- /*
- * Constant used for hint adjustment and for synthetic em box hint
- * placement.
- */
-#define CF2_MIN_COUNTER cf2_floatToFixed( 0.5 )
-
-
- /* shared typedef is in cf2glue.h */
- struct CF2_HintRec_
- {
- CF2_UInt flags; /* attributes of the edge */
- size_t index; /* index in original stem hint array */
- /* (if not synthetic) */
- CF2_Fixed csCoord;
- CF2_Fixed dsCoord;
- CF2_Fixed scale;
- };
-
-
- typedef struct CF2_BlueRec_
- {
- CF2_Fixed csBottomEdge;
- CF2_Fixed csTopEdge;
- CF2_Fixed csFlatEdge; /* may be from either local or Family zones */
- CF2_Fixed dsFlatEdge; /* top edge of bottom zone or bottom edge */
- /* of top zone (rounded) */
- FT_Bool bottomZone;
-
- } CF2_BlueRec;
-
-
- /* max total blue zones is 12 */
- enum
- {
- CF2_MAX_BLUES = 7,
- CF2_MAX_OTHERBLUES = 5
- };
-
-
- typedef struct CF2_BluesRec_
- {
- CF2_Fixed scale;
- CF2_UInt count;
- FT_Bool suppressOvershoot;
- FT_Bool doEmBoxHints;
-
- CF2_Fixed blueScale;
- CF2_Fixed blueShift;
- CF2_Fixed blueFuzz;
-
- CF2_Fixed boost;
-
- CF2_HintRec emBoxTopEdge;
- CF2_HintRec emBoxBottomEdge;
-
- CF2_BlueRec zone[CF2_MAX_BLUES + CF2_MAX_OTHERBLUES];
-
- } CF2_BluesRec, *CF2_Blues;
-
-
- FT_LOCAL( void )
- cf2_blues_init( CF2_Blues blues,
- CF2_Font font );
- FT_LOCAL( FT_Bool )
- cf2_blues_capture( const CF2_Blues blues,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2BLUES_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2error.c b/src/3rdparty/freetype/src/cff/cf2error.c
deleted file mode 100644
index b5595a3d1f..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2error.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2error.c */
-/* */
-/* Adobe's code for error handling (body). */
-/* */
-/* Copyright 2006-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include "cf2error.h"
-
-
- FT_LOCAL_DEF( void )
- cf2_setError( FT_Error* error,
- FT_Error value )
- {
- if ( error && *error == 0 )
- *error = value;
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2error.h b/src/3rdparty/freetype/src/cff/cf2error.h
deleted file mode 100644
index 6453ebcb7b..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2error.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2error.h */
-/* */
-/* Adobe's code for error handling (specification). */
-/* */
-/* Copyright 2006-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2ERROR_H__
-#define __CF2ERROR_H__
-
-
-#include FT_MODULE_ERRORS_H
-
-#undef __FTERRORS_H__
-
-#undef FT_ERR_PREFIX
-#define FT_ERR_PREFIX CF2_Err_
-#define FT_ERR_BASE FT_Mod_Err_CF2
-
-
-#include FT_ERRORS_H
-#include "cf2ft.h"
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * A poor-man error facility.
- *
- * This code being written in vanilla C, doesn't have the luxury of a
- * language-supported exception mechanism such as the one available in
- * Java. Instead, we are stuck with using error codes that must be
- * carefully managed and preserved. However, it is convenient for us to
- * model our error mechanism on a Java-like exception mechanism.
- * When we assign an error code we are thus `throwing' an error.
- *
- * The perservation of an error code is done by coding convention.
- * Upon a function call if the error code is anything other than
- * `FT_Err_Ok', which is guaranteed to be zero, we
- * will return without altering that error. This will allow the
- * error to propogate and be handled at the appropriate location in
- * the code.
- *
- * This allows a style of code where the error code is initialized
- * up front and a block of calls are made with the error code only
- * being checked after the block. If a new error occurs, the original
- * error will be preserved and a functional no-op should result in any
- * subsequent function that has an initial error code not equal to
- * `FT_Err_Ok'.
- *
- * Errors are encoded by calling the `FT_THROW' macro. For example,
- *
- * {
- * FT_Error e;
- *
- *
- * ...
- * e = FT_THROW( Out_Of_Memory );
- * }
- *
- */
-
-
- /* Set error code to a particular value. */
- FT_LOCAL( void )
- cf2_setError( FT_Error* error,
- FT_Error value );
-
-
- /*
- * A macro that conditionally sets an error code.
- *
- * This macro will first check whether `error' is set;
- * if not, it will set it to `e'.
- *
- */
-#define CF2_SET_ERROR( error, e ) \
- cf2_setError( error, FT_THROW( e ) )
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2ERROR_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2fixed.h b/src/3rdparty/freetype/src/cff/cf2fixed.h
deleted file mode 100644
index d6d9faf8e5..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2fixed.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2fixed.h */
-/* */
-/* Adobe's code for Fixed Point Mathematics (specification only). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FIXED_H__
-#define __CF2FIXED_H__
-
-
-FT_BEGIN_HEADER
-
-
- /* rasterizer integer and fixed point arithmetic must be 32-bit */
-
-#define CF2_Fixed CF2_F16Dot16
- typedef FT_Int32 CF2_Frac; /* 2.30 fixed point */
-
-
-#define CF2_FIXED_MAX ( (CF2_Fixed)0x7FFFFFFFL )
-#define CF2_FIXED_MIN ( (CF2_Fixed)0x80000000L )
-#define CF2_FIXED_ONE 0x10000L
-#define CF2_FIXED_EPSILON 0x0001
-
- /* in C 89, left and right shift of negative numbers is */
- /* implementation specific behaviour in the general case */
-
-#define cf2_intToFixed( i ) \
- ( (CF2_Fixed)( (FT_UInt32)(i) << 16 ) )
-#define cf2_fixedToInt( x ) \
- ( (FT_Short)( ( (FT_UInt32)(x) + 0x8000U ) >> 16 ) )
-#define cf2_fixedRound( x ) \
- ( (CF2_Fixed)( ( (FT_UInt32)(x) + 0x8000U ) & 0xFFFF0000UL ) )
-#define cf2_floatToFixed( f ) \
- ( (CF2_Fixed)( (f) * 65536.0 + 0.5 ) )
-#define cf2_fixedAbs( x ) \
- ( (x) < 0 ? -(x) : (x) )
-#define cf2_fixedFloor( x ) \
- ( (CF2_Fixed)( (FT_UInt32)(x) & 0xFFFF0000UL ) )
-#define cf2_fixedFraction( x ) \
- ( (x) - cf2_fixedFloor( x ) )
-#define cf2_fracToFixed( x ) \
- ( (x) < 0 ? -( ( -(x) + 0x2000 ) >> 14 ) \
- : ( ( (x) + 0x2000 ) >> 14 ) )
-
-
- /* signed numeric types */
- typedef enum CF2_NumberType_
- {
- CF2_NumberFixed, /* 16.16 */
- CF2_NumberFrac, /* 2.30 */
- CF2_NumberInt /* 32.0 */
-
- } CF2_NumberType;
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FIXED_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2font.c b/src/3rdparty/freetype/src/cff/cf2font.c
deleted file mode 100644
index 83fd348f2d..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2font.c
+++ /dev/null
@@ -1,512 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.c */
-/* */
-/* Adobe's code for font instances (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include <ft2build.h>
-#include FT_INTERNAL_CALC_H
-
-#include "cf2ft.h"
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2error.h"
-#include "cf2intrp.h"
-
-
- /* Compute a stem darkening amount in character space. */
- static void
- cf2_computeDarkening( CF2_Fixed emRatio,
- CF2_Fixed ppem,
- CF2_Fixed stemWidth,
- CF2_Fixed* darkenAmount,
- CF2_Fixed boldenAmount,
- FT_Bool stemDarkened,
- FT_Int* darkenParams )
- {
- /*
- * Total darkening amount is computed in 1000 unit character space
- * using the modified 5 part curve as Adobe's Avalon rasterizer.
- * The darkening amount is smaller for thicker stems.
- * It becomes zero when the stem is thicker than 2.333 pixels.
- *
- * By default, we use
- *
- * darkenAmount = 0.4 pixels if scaledStem <= 0.5 pixels,
- * darkenAmount = 0.275 pixels if 1 <= scaledStem <= 1.667 pixels,
- * darkenAmount = 0 pixel if scaledStem >= 2.333 pixels,
- *
- * and piecewise linear in-between:
- *
- *
- * darkening
- * ^
- * |
- * | (x1,y1)
- * |--------+
- * | \
- * | \
- * | \ (x3,y3)
- * | +----------+
- * | (x2,y2) \
- * | \
- * | \
- * | +-----------------
- * | (x4,y4)
- * +---------------------------------------------> stem
- * thickness
- *
- *
- * This corresponds to the following values for the
- * `darkening-parameters' property:
- *
- * (x1, y1) = (500, 400)
- * (x2, y2) = (1000, 275)
- * (x3, y3) = (1667, 275)
- * (x4, y4) = (2333, 0)
- *
- */
-
- /* Internal calculations are done in units per thousand for */
- /* convenience. The x axis is scaled stem width in */
- /* thousandths of a pixel. That is, 1000 is 1 pixel. */
- /* The y axis is darkening amount in thousandths of a pixel.*/
- /* In the code, below, dividing by ppem and */
- /* adjusting for emRatio converts darkenAmount to character */
- /* space (font units). */
- CF2_Fixed stemWidthPer1000, scaledStem;
- FT_Int logBase2;
-
-
- *darkenAmount = 0;
-
- if ( boldenAmount == 0 && !stemDarkened )
- return;
-
- /* protect against range problems and divide by zero */
- if ( emRatio < cf2_floatToFixed( .01 ) )
- return;
-
- if ( stemDarkened )
- {
- FT_Int x1 = darkenParams[0];
- FT_Int y1 = darkenParams[1];
- FT_Int x2 = darkenParams[2];
- FT_Int y2 = darkenParams[3];
- FT_Int x3 = darkenParams[4];
- FT_Int y3 = darkenParams[5];
- FT_Int x4 = darkenParams[6];
- FT_Int y4 = darkenParams[7];
-
-
- /* convert from true character space to 1000 unit character space; */
- /* add synthetic emboldening effect */
-
- /* `stemWidthPer1000' will not overflow for a legitimate font */
-
- stemWidthPer1000 = FT_MulFix( stemWidth + boldenAmount, emRatio );
-
- /* `scaledStem' can easily overflow, so we must clamp its maximum */
- /* value; the test doesn't need to be precise, but must be */
- /* conservative. The clamp value (default 2333) where */
- /* `darkenAmount' is zero is well below the overflow value of */
- /* 32767. */
- /* */
- /* FT_MSB computes the integer part of the base 2 logarithm. The */
- /* number of bits for the product is 1 or 2 more than the sum of */
- /* logarithms; remembering that the 16 lowest bits of the fraction */
- /* are dropped this is correct to within a factor of almost 4. */
- /* For example, 0x80.0000 * 0x80.0000 = 0x4000.0000 is 23+23 and */
- /* is flagged as possible overflow because 0xFF.FFFF * 0xFF.FFFF = */
- /* 0xFFFF.FE00 is also 23+23. */
-
- logBase2 = FT_MSB( (FT_UInt32)stemWidthPer1000 ) +
- FT_MSB( (FT_UInt32)ppem );
-
- if ( logBase2 >= 46 )
- /* possible overflow */
- scaledStem = cf2_intToFixed( x4 );
- else
- scaledStem = FT_MulFix( stemWidthPer1000, ppem );
-
- /* now apply the darkening parameters */
-
- if ( scaledStem < cf2_intToFixed( x1 ) )
- *darkenAmount = FT_DivFix( cf2_intToFixed( y1 ), ppem );
-
- else if ( scaledStem < cf2_intToFixed( x2 ) )
- {
- FT_Int xdelta = x2 - x1;
- FT_Int ydelta = y2 - y1;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x1 ), ppem );
-
-
- if ( !xdelta )
- goto Try_x3;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y1 ), ppem );
- }
-
- else if ( scaledStem < cf2_intToFixed( x3 ) )
- {
- Try_x3:
- {
- FT_Int xdelta = x3 - x2;
- FT_Int ydelta = y3 - y2;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x2 ), ppem );
-
-
- if ( !xdelta )
- goto Try_x4;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y2 ), ppem );
- }
- }
-
- else if ( scaledStem < cf2_intToFixed( x4 ) )
- {
- Try_x4:
- {
- FT_Int xdelta = x4 - x3;
- FT_Int ydelta = y4 - y3;
- FT_Int x = stemWidthPer1000 -
- FT_DivFix( cf2_intToFixed( x3 ), ppem );
-
-
- if ( !xdelta )
- goto Use_y4;
-
- *darkenAmount = FT_MulDiv( x, ydelta, xdelta ) +
- FT_DivFix( cf2_intToFixed( y3 ), ppem );
- }
- }
-
- else
- {
- Use_y4:
- *darkenAmount = FT_DivFix( cf2_intToFixed( y4 ), ppem );
- }
-
- /* use half the amount on each side and convert back to true */
- /* character space */
- *darkenAmount = FT_DivFix( *darkenAmount, 2 * emRatio );
- }
-
- /* add synthetic emboldening effect in character space */
- *darkenAmount += boldenAmount / 2;
- }
-
-
- /* set up values for the current FontDict and matrix */
-
- /* caller's transform is adjusted for subpixel positioning */
- static void
- cf2_font_setup( CF2_Font font,
- const CF2_Matrix* transform )
- {
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- FT_Bool needExtraSetup = FALSE;
-
- /* character space units */
- CF2_Fixed boldenX = font->syntheticEmboldeningAmountX;
- CF2_Fixed boldenY = font->syntheticEmboldeningAmountY;
-
- CFF_SubFont subFont;
- CF2_Fixed ppem;
-
-
- /* clear previous error */
- font->error = FT_Err_Ok;
-
- /* if a CID fontDict has changed, we need to recompute some cached */
- /* data */
- subFont = cf2_getSubfont( decoder );
- if ( font->lastSubfont != subFont )
- {
- font->lastSubfont = subFont;
- needExtraSetup = TRUE;
- }
-
- /* if ppem has changed, we need to recompute some cached data */
- /* note: because of CID font matrix concatenation, ppem and transform */
- /* do not necessarily track. */
- ppem = cf2_getPpemY( decoder );
- if ( font->ppem != ppem )
- {
- font->ppem = ppem;
- needExtraSetup = TRUE;
- }
-
- /* copy hinted flag on each call */
- font->hinted = (FT_Bool)( font->renderingFlags & CF2_FlagsHinted );
-
- /* determine if transform has changed; */
- /* include Fontmatrix but ignore translation */
- if ( ft_memcmp( transform,
- &font->currentTransform,
- 4 * sizeof ( CF2_Fixed ) ) != 0 )
- {
- /* save `key' information for `cache of one' matrix data; */
- /* save client transform, without the translation */
- font->currentTransform = *transform;
- font->currentTransform.tx =
- font->currentTransform.ty = cf2_intToFixed( 0 );
-
- /* TODO: FreeType transform is simple scalar; for now, use identity */
- /* for outer */
- font->innerTransform = *transform;
- font->outerTransform.a =
- font->outerTransform.d = cf2_intToFixed( 1 );
- font->outerTransform.b =
- font->outerTransform.c = cf2_intToFixed( 0 );
-
- needExtraSetup = TRUE;
- }
-
- /*
- * font->darkened is set to true if there is a stem darkening request or
- * the font is synthetic emboldened.
- * font->darkened controls whether to adjust blue zones, winding order,
- * and hinting.
- *
- */
- if ( font->stemDarkened != ( font->renderingFlags & CF2_FlagsDarkened ) )
- {
- font->stemDarkened =
- (FT_Bool)( font->renderingFlags & CF2_FlagsDarkened );
-
- /* blue zones depend on darkened flag */
- needExtraSetup = TRUE;
- }
-
- /* recompute variables that are dependent on transform or FontDict or */
- /* darken flag */
- if ( needExtraSetup )
- {
- /* StdVW is found in the private dictionary; */
- /* recompute darkening amounts whenever private dictionary or */
- /* transform change */
- /* Note: a rendering flag turns darkening on or off, so we want to */
- /* store the `on' amounts; */
- /* darkening amount is computed in character space */
- /* TODO: testing size-dependent darkening here; */
- /* what to do for rotations? */
-
- CF2_Fixed emRatio;
- CF2_Fixed stdHW;
- CF2_Int unitsPerEm = font->unitsPerEm;
-
-
- if ( unitsPerEm == 0 )
- unitsPerEm = 1000;
-
- ppem = FT_MAX( cf2_intToFixed( 4 ),
- font->ppem ); /* use minimum ppem of 4 */
-
-#if 0
- /* since vstem is measured in the x-direction, we use the `a' member */
- /* of the fontMatrix */
- emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->a );
-#endif
-
- /* Freetype does not preserve the fontMatrix when parsing; use */
- /* unitsPerEm instead. */
- /* TODO: check precision of this */
- emRatio = cf2_intToFixed( 1000 ) / unitsPerEm;
- font->stdVW = cf2_getStdVW( decoder );
-
- if ( font->stdVW <= 0 )
- font->stdVW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
-
- if ( boldenX > 0 )
- {
- /* Ensure that boldenX is at least 1 pixel for synthetic bold font */
- /* (similar to what Avalon does) */
- boldenX = FT_MAX( boldenX,
- FT_DivFix( cf2_intToFixed( unitsPerEm ), ppem ) );
-
- /* Synthetic emboldening adds at least 1 pixel to darkenX, while */
- /* stem darkening adds at most half pixel. Since the purpose of */
- /* stem darkening (readability at small sizes) is met with */
- /* synthetic emboldening, no need to add stem darkening for a */
- /* synthetic bold font. */
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdVW,
- &font->darkenX,
- boldenX,
- FALSE,
- font->darkenParams );
- }
- else
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdVW,
- &font->darkenX,
- 0,
- font->stemDarkened,
- font->darkenParams );
-
-#if 0
- /* since hstem is measured in the y-direction, we use the `d' member */
- /* of the fontMatrix */
- /* TODO: use the same units per em as above; check this */
- emRatio = cf2_fixedFracMul( cf2_intToFixed( 1000 ), fontMatrix->d );
-#endif
-
- /* set the default stem width, because it must be the same for all */
- /* family members; */
- /* choose a constant for StdHW that depends on font contrast */
- stdHW = cf2_getStdHW( decoder );
-
- if ( stdHW > 0 && font->stdVW > 2 * stdHW )
- font->stdHW = FT_DivFix( cf2_intToFixed( 75 ), emRatio );
- else
- {
- /* low contrast font gets less hstem darkening */
- font->stdHW = FT_DivFix( cf2_intToFixed( 110 ), emRatio );
- }
-
- cf2_computeDarkening( emRatio,
- ppem,
- font->stdHW,
- &font->darkenY,
- boldenY,
- font->stemDarkened,
- font->darkenParams );
-
- if ( font->darkenX != 0 || font->darkenY != 0 )
- font->darkened = TRUE;
- else
- font->darkened = FALSE;
-
- font->reverseWinding = FALSE; /* initial expectation is CCW */
-
- /* compute blue zones for this instance */
- cf2_blues_init( &font->blues, font );
- }
- }
-
-
- /* equivalent to AdobeGetOutline */
- FT_LOCAL_DEF( FT_Error )
- cf2_getGlyphOutline( CF2_Font font,
- CF2_Buffer charstring,
- const CF2_Matrix* transform,
- CF2_F16Dot16* glyphWidth )
- {
- FT_Error lastError = FT_Err_Ok;
-
- FT_Vector translation;
-
-#if 0
- FT_Vector advancePoint;
-#endif
-
- CF2_Fixed advWidth = 0;
- FT_Bool needWinding;
-
-
- /* Note: use both integer and fraction for outlines. This allows bbox */
- /* to come out directly. */
-
- translation.x = transform->tx;
- translation.y = transform->ty;
-
- /* set up values based on transform */
- cf2_font_setup( font, transform );
- if ( font->error )
- goto exit; /* setup encountered an error */
-
- /* reset darken direction */
- font->reverseWinding = FALSE;
-
- /* winding order only affects darkening */
- needWinding = font->darkened;
-
- while ( 1 )
- {
- /* reset output buffer */
- cf2_outline_reset( &font->outline );
-
- /* build the outline, passing the full translation */
- cf2_interpT2CharString( font,
- charstring,
- (CF2_OutlineCallbacks)&font->outline,
- &translation,
- FALSE,
- 0,
- 0,
- &advWidth );
-
- if ( font->error )
- goto exit;
-
- if ( !needWinding )
- break;
-
- /* check winding order */
- if ( font->outline.root.windingMomentum >= 0 ) /* CFF is CCW */
- break;
-
- /* invert darkening and render again */
- /* TODO: this should be a parameter to getOutline-computeOffset */
- font->reverseWinding = TRUE;
-
- needWinding = FALSE; /* exit after next iteration */
- }
-
- /* finish storing client outline */
- cf2_outline_close( &font->outline );
-
- exit:
- /* FreeType just wants the advance width; there is no translation */
- *glyphWidth = advWidth;
-
- /* free resources and collect errors from objects we've used */
- cf2_setError( &font->error, lastError );
-
- return font->error;
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2font.h b/src/3rdparty/freetype/src/cff/cf2font.h
deleted file mode 100644
index 86cf02f49d..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2font.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.h */
-/* */
-/* Adobe's code for font instances (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FONT_H__
-#define __CF2FONT_H__
-
-
-#include "cf2ft.h"
-#include "cf2blues.h"
-
-
-FT_BEGIN_HEADER
-
-
-#define CF2_OPERAND_STACK_SIZE 48
-#define CF2_MAX_SUBR 16 /* maximum subroutine nesting; */
- /* only 10 are allowed but there exist */
- /* fonts like `HiraKakuProN-W3.ttf' */
- /* (Hiragino Kaku Gothic ProN W3; */
- /* 8.2d6e1; 2014-12-19) that exceed */
- /* this limit */
-
-
- /* typedef is in `cf2glue.h' */
- struct CF2_FontRec_
- {
- FT_Memory memory;
- FT_Error error; /* shared error for this instance */
-
- CF2_RenderingFlags renderingFlags;
-
- /* variables that depend on Transform: */
- /* the following have zero translation; */
- /* inner * outer = font * original */
-
- CF2_Matrix currentTransform; /* original client matrix */
- CF2_Matrix innerTransform; /* for hinting; erect, scaled */
- CF2_Matrix outerTransform; /* post hinting; includes rotations */
- CF2_Fixed ppem; /* transform-dependent */
-
- CF2_Int unitsPerEm;
-
- CF2_Fixed syntheticEmboldeningAmountX; /* character space units */
- CF2_Fixed syntheticEmboldeningAmountY; /* character space units */
-
- /* FreeType related members */
- CF2_OutlineRec outline; /* freetype glyph outline functions */
- CFF_Decoder* decoder;
- CFF_SubFont lastSubfont; /* FreeType parsed data; */
- /* top font or subfont */
-
- /* these flags can vary from one call to the next */
- FT_Bool hinted;
- FT_Bool darkened; /* true if stemDarkened or synthetic bold */
- /* i.e. darkenX != 0 || darkenY != 0 */
- FT_Bool stemDarkened;
-
- FT_Int darkenParams[8]; /* 1000 unit character space */
-
- /* variables that depend on both FontDict and Transform */
- CF2_Fixed stdVW; /* in character space; depends on dict entry */
- CF2_Fixed stdHW; /* in character space; depends on dict entry */
- CF2_Fixed darkenX; /* character space units */
- CF2_Fixed darkenY; /* depends on transform */
- /* and private dict (StdVW) */
- FT_Bool reverseWinding; /* darken assuming */
- /* counterclockwise winding */
-
- CF2_BluesRec blues; /* computed zone data */
- };
-
-
- FT_LOCAL( FT_Error )
- cf2_getGlyphOutline( CF2_Font font,
- CF2_Buffer charstring,
- const CF2_Matrix* transform,
- CF2_F16Dot16* glyphWidth );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FONT_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2ft.c b/src/3rdparty/freetype/src/cff/cf2ft.c
deleted file mode 100644
index d2544a2345..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2ft.c
+++ /dev/null
@@ -1,700 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2ft.c */
-/* */
-/* FreeType Glue Component to Adobe's Interpreter (body). */
-/* */
-/* Copyright 2013-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2font.h"
-#include "cf2error.h"
-
-
-#define CF2_MAX_SIZE cf2_intToFixed( 2000 ) /* max ppem */
-
-
- /*
- * This check should avoid most internal overflow cases. Clients should
- * generally respond to `Glyph_Too_Big' by getting a glyph outline
- * at EM size, scaling it and filling it as a graphics operation.
- *
- */
- static FT_Error
- cf2_checkTransform( const CF2_Matrix* transform,
- CF2_Int unitsPerEm )
- {
- CF2_Fixed maxScale;
-
-
- FT_ASSERT( unitsPerEm > 0 );
-
- if ( transform->a <= 0 || transform->d <= 0 )
- return FT_THROW( Invalid_Size_Handle );
-
- FT_ASSERT( transform->b == 0 && transform->c == 0 );
- FT_ASSERT( transform->tx == 0 && transform->ty == 0 );
-
- if ( unitsPerEm > 0x7FFF )
- return FT_THROW( Glyph_Too_Big );
-
- maxScale = FT_DivFix( CF2_MAX_SIZE, cf2_intToFixed( unitsPerEm ) );
-
- if ( transform->a > maxScale || transform->d > maxScale )
- return FT_THROW( Glyph_Too_Big );
-
- return FT_Err_Ok;
- }
-
-
- static void
- cf2_setGlyphWidth( CF2_Outline outline,
- CF2_Fixed width )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- decoder->glyph_width = cf2_fixedToInt( width );
- }
-
-
- /* Clean up font instance. */
- static void
- cf2_free_instance( void* ptr )
- {
- CF2_Font font = (CF2_Font)ptr;
-
-
- if ( font )
- {
- FT_Memory memory = font->memory;
-
-
- (void)memory;
- }
- }
-
-
- /********************************************/
- /* */
- /* functions for handling client outline; */
- /* FreeType uses coordinates in 26.6 format */
- /* */
- /********************************************/
-
- static void
- cf2_builder_moveTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
- (void)params; /* only used in debug mode */
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpMoveTo );
-
- builder = &outline->decoder->builder;
-
- /* note: two successive moves simply close the contour twice */
- cff_builder_close_contour( builder );
- builder->path_begun = 0;
- }
-
-
- static void
- cf2_builder_lineTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- FT_Error error;
-
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpLineTo );
-
- builder = &outline->decoder->builder;
-
- if ( !builder->path_begun )
- {
- /* record the move before the line; also check points and set */
- /* `path_begun' */
- error = cff_builder_start_point( builder,
- params->pt0.x,
- params->pt0.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
- /* `cff_builder_add_point1' includes a check_points call for one point */
- error = cff_builder_add_point1( builder,
- params->pt1.x,
- params->pt1.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
-
- static void
- cf2_builder_cubeTo( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params )
- {
- FT_Error error;
-
- /* downcast the object pointer */
- CF2_Outline outline = (CF2_Outline)callbacks;
- CFF_Builder* builder;
-
-
- FT_ASSERT( outline && outline->decoder );
- FT_ASSERT( params->op == CF2_PathOpCubeTo );
-
- builder = &outline->decoder->builder;
-
- if ( !builder->path_begun )
- {
- /* record the move before the line; also check points and set */
- /* `path_begun' */
- error = cff_builder_start_point( builder,
- params->pt0.x,
- params->pt0.y );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
- }
-
- /* prepare room for 3 points: 2 off-curve, 1 on-curve */
- error = cff_check_points( builder, 3 );
- if ( error )
- {
- if ( !*callbacks->error )
- *callbacks->error = error;
- return;
- }
-
- cff_builder_add_point( builder,
- params->pt1.x,
- params->pt1.y, 0 );
- cff_builder_add_point( builder,
- params->pt2.x,
- params->pt2.y, 0 );
- cff_builder_add_point( builder,
- params->pt3.x,
- params->pt3.y, 1 );
- }
-
-
- static void
- cf2_outline_init( CF2_Outline outline,
- FT_Memory memory,
- FT_Error* error )
- {
- FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) );
-
- outline->root.memory = memory;
- outline->root.error = error;
-
- outline->root.moveTo = cf2_builder_moveTo;
- outline->root.lineTo = cf2_builder_lineTo;
- outline->root.cubeTo = cf2_builder_cubeTo;
- }
-
-
- /* get scaling and hint flag from GlyphSlot */
- static void
- cf2_getScaleAndHintFlag( CFF_Decoder* decoder,
- CF2_Fixed* x_scale,
- CF2_Fixed* y_scale,
- FT_Bool* hinted,
- FT_Bool* scaled )
- {
- FT_ASSERT( decoder && decoder->builder.glyph );
-
- /* note: FreeType scale includes a factor of 64 */
- *hinted = decoder->builder.glyph->hint;
- *scaled = decoder->builder.glyph->scaled;
-
- if ( *hinted )
- {
- *x_scale = ( decoder->builder.glyph->x_scale + 32 ) / 64;
- *y_scale = ( decoder->builder.glyph->y_scale + 32 ) / 64;
- }
- else
- {
- /* for unhinted outlines, `cff_slot_load' does the scaling, */
- /* thus render at `unity' scale */
-
- *x_scale = 0x0400; /* 1/64 as 16.16 */
- *y_scale = 0x0400;
- }
- }
-
-
- /* get units per em from `FT_Face' */
- /* TODO: should handle font matrix concatenation? */
- static FT_UShort
- cf2_getUnitsPerEm( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->builder.face );
- FT_ASSERT( decoder->builder.face->root.units_per_EM );
-
- return decoder->builder.face->root.units_per_EM;
- }
-
-
- /* Main entry point: Render one glyph. */
- FT_LOCAL_DEF( FT_Error )
- cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len )
- {
- FT_Memory memory;
- FT_Error error = FT_Err_Ok;
- CF2_Font font;
-
-
- FT_ASSERT( decoder && decoder->cff );
-
- memory = decoder->builder.memory;
-
- /* CF2 data is saved here across glyphs */
- font = (CF2_Font)decoder->cff->cf2_instance.data;
-
- /* on first glyph, allocate instance structure */
- if ( decoder->cff->cf2_instance.data == NULL )
- {
- decoder->cff->cf2_instance.finalizer =
- (FT_Generic_Finalizer)cf2_free_instance;
-
- if ( FT_ALLOC( decoder->cff->cf2_instance.data,
- sizeof ( CF2_FontRec ) ) )
- return FT_THROW( Out_Of_Memory );
-
- font = (CF2_Font)decoder->cff->cf2_instance.data;
-
- font->memory = memory;
-
- /* initialize a client outline, to be shared by each glyph rendered */
- cf2_outline_init( &font->outline, font->memory, &font->error );
- }
-
- /* save decoder; it is a stack variable and will be different on each */
- /* call */
- font->decoder = decoder;
- font->outline.decoder = decoder;
-
- {
- /* build parameters for Adobe engine */
-
- CFF_Builder* builder = &decoder->builder;
- CFF_Driver driver = (CFF_Driver)FT_FACE_DRIVER( builder->face );
-
- /* local error */
- FT_Error error2 = FT_Err_Ok;
- CF2_BufferRec buf;
- CF2_Matrix transform;
- CF2_F16Dot16 glyphWidth;
-
- FT_Bool hinted;
- FT_Bool scaled;
-
-
- /* FreeType has already looked up the GID; convert to */
- /* `RegionBuffer', assuming that the input has been validated */
- FT_ASSERT( charstring_base + charstring_len >= charstring_base );
-
- FT_ZERO( &buf );
- buf.start =
- buf.ptr = charstring_base;
- buf.end = charstring_base + charstring_len;
-
- FT_ZERO( &transform );
-
- cf2_getScaleAndHintFlag( decoder,
- &transform.a,
- &transform.d,
- &hinted,
- &scaled );
-
- font->renderingFlags = 0;
- if ( hinted )
- font->renderingFlags |= CF2_FlagsHinted;
- if ( scaled && !driver->no_stem_darkening )
- font->renderingFlags |= CF2_FlagsDarkened;
-
- font->darkenParams[0] = driver->darken_params[0];
- font->darkenParams[1] = driver->darken_params[1];
- font->darkenParams[2] = driver->darken_params[2];
- font->darkenParams[3] = driver->darken_params[3];
- font->darkenParams[4] = driver->darken_params[4];
- font->darkenParams[5] = driver->darken_params[5];
- font->darkenParams[6] = driver->darken_params[6];
- font->darkenParams[7] = driver->darken_params[7];
-
- /* now get an outline for this glyph; */
- /* also get units per em to validate scale */
- font->unitsPerEm = (CF2_Int)cf2_getUnitsPerEm( decoder );
-
- if ( scaled )
- {
- error2 = cf2_checkTransform( &transform, font->unitsPerEm );
- if ( error2 )
- return error2;
- }
-
- error2 = cf2_getGlyphOutline( font, &buf, &transform, &glyphWidth );
- if ( error2 )
- return FT_ERR( Invalid_File_Format );
-
- cf2_setGlyphWidth( &font->outline, glyphWidth );
-
- return FT_Err_Ok;
- }
- }
-
-
- /* get pointer to current FreeType subfont (based on current glyphID) */
- FT_LOCAL_DEF( CFF_SubFont )
- cf2_getSubfont( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return decoder->current_subfont;
- }
-
-
- /* get `y_ppem' from `CFF_Size' */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getPpemY( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder &&
- decoder->builder.face &&
- decoder->builder.face->root.size );
-
- /*
- * Note that `y_ppem' can be zero if there wasn't a call to
- * `FT_Set_Char_Size' or something similar. However, this isn't a
- * problem since we come to this place in the code only if
- * FT_LOAD_NO_SCALE is set (the other case gets caught by
- * `cf2_checkTransform'). The ppem value is needed to compute the stem
- * darkening, which is disabled for getting the unscaled outline.
- *
- */
- return cf2_intToFixed(
- decoder->builder.face->root.size->metrics.y_ppem );
- }
-
-
- /* get standard stem widths for the current subfont; */
- /* FreeType stores these as integer font units */
- /* (note: variable names seem swapped) */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getStdVW( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.standard_height );
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getStdHW( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.standard_width );
- }
-
-
- /* note: FreeType stores 1000 times the actual value for `BlueScale' */
- FT_LOCAL_DEF( void )
- cf2_getBlueMetrics( CFF_Decoder* decoder,
- CF2_Fixed* blueScale,
- CF2_Fixed* blueShift,
- CF2_Fixed* blueFuzz )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *blueScale = FT_DivFix(
- decoder->current_subfont->private_dict.blue_scale,
- cf2_intToFixed( 1000 ) );
- *blueShift = cf2_intToFixed(
- decoder->current_subfont->private_dict.blue_shift );
- *blueFuzz = cf2_intToFixed(
- decoder->current_subfont->private_dict.blue_fuzz );
- }
-
-
- /* get blue values counts and arrays; the FreeType parser has validated */
- /* the counts and verified that each is an even number */
- FT_LOCAL_DEF( void )
- cf2_getBlueValues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_blue_values;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.blue_values;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_other_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.other_blues;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getFamilyBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_family_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.family_blues;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- *count = decoder->current_subfont->private_dict.num_family_other_blues;
- *data = (FT_Pos*)
- &decoder->current_subfont->private_dict.family_other_blues;
- }
-
-
- FT_LOCAL_DEF( CF2_Int )
- cf2_getLanguageGroup( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return decoder->current_subfont->private_dict.language_group;
- }
-
-
- /* convert unbiased subroutine index to `CF2_Buffer' and */
- /* return 0 on success */
- FT_LOCAL_DEF( CF2_Int )
- cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
- idx += (CF2_UInt)decoder->globals_bias;
- if ( idx >= decoder->num_globals )
- return TRUE; /* error */
-
- FT_ASSERT( decoder->globals );
-
- buf->start =
- buf->ptr = decoder->globals[idx];
- buf->end = decoder->globals[idx + 1];
-
- return FALSE; /* success */
- }
-
-
- /* convert AdobeStandardEncoding code to CF2_Buffer; */
- /* used for seac component */
- FT_LOCAL_DEF( FT_Error )
- cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_Int code,
- CF2_Buffer buf )
- {
- CF2_Int gid;
- FT_Byte* charstring;
- FT_ULong len;
- FT_Error error;
-
-
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
-#ifdef FT_CONFIG_OPTION_INCREMENTAL
- /* Incremental fonts don't necessarily have valid charsets. */
- /* They use the character code, not the glyph index, in this case. */
- if ( decoder->builder.face->root.internal->incremental_interface )
- gid = code;
- else
-#endif /* FT_CONFIG_OPTION_INCREMENTAL */
- {
- gid = cff_lookup_glyph_by_stdcharcode( decoder->cff, code );
- if ( gid < 0 )
- return FT_THROW( Invalid_Glyph_Format );
- }
-
- error = cff_get_glyph_data( decoder->builder.face,
- (CF2_UInt)gid,
- &charstring,
- &len );
- /* TODO: for now, just pass the FreeType error through */
- if ( error )
- return error;
-
- /* assume input has been validated */
- FT_ASSERT( charstring + len >= charstring );
-
- buf->start = charstring;
- buf->end = charstring + len;
- buf->ptr = buf->start;
-
- return FT_Err_Ok;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_freeSeacComponent( CFF_Decoder* decoder,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- cff_free_glyph_data( decoder->builder.face,
- (FT_Byte**)&buf->start,
- (FT_ULong)( buf->end - buf->start ) );
- }
-
-
- FT_LOCAL_DEF( CF2_Int )
- cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf )
- {
- FT_ASSERT( decoder );
-
- FT_ZERO( buf );
-
- idx += (CF2_UInt)decoder->locals_bias;
- if ( idx >= decoder->num_locals )
- return TRUE; /* error */
-
- FT_ASSERT( decoder->locals );
-
- buf->start =
- buf->ptr = decoder->locals[idx];
- buf->end = decoder->locals[idx + 1];
-
- return FALSE; /* success */
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getDefaultWidthX( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.default_width );
- }
-
-
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_getNominalWidthX( CFF_Decoder* decoder )
- {
- FT_ASSERT( decoder && decoder->current_subfont );
-
- return cf2_intToFixed(
- decoder->current_subfont->private_dict.nominal_width );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_outline_reset( CF2_Outline outline )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- outline->root.windingMomentum = 0;
-
- FT_GlyphLoader_Rewind( decoder->builder.loader );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_outline_close( CF2_Outline outline )
- {
- CFF_Decoder* decoder = outline->decoder;
-
-
- FT_ASSERT( decoder );
-
- cff_builder_close_contour( &decoder->builder );
-
- FT_GlyphLoader_Add( decoder->builder.loader );
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2ft.h b/src/3rdparty/freetype/src/cff/cf2ft.h
deleted file mode 100644
index 3073df382f..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2ft.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2ft.h */
-/* */
-/* FreeType Glue Component to Adobe's Interpreter (specification). */
-/* */
-/* Copyright 2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2FT_H__
-#define __CF2FT_H__
-
-
-#include "cf2types.h"
-
-
- /* TODO: disable asserts for now */
-#define CF2_NDEBUG
-
-
-#include FT_SYSTEM_H
-
-#include "cf2glue.h"
-#include "cffgload.h" /* for CFF_Decoder */
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( FT_Error )
- cf2_decoder_parse_charstrings( CFF_Decoder* decoder,
- FT_Byte* charstring_base,
- FT_ULong charstring_len );
-
- FT_LOCAL( CFF_SubFont )
- cf2_getSubfont( CFF_Decoder* decoder );
-
-
- FT_LOCAL( CF2_Fixed )
- cf2_getPpemY( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getStdVW( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getStdHW( CFF_Decoder* decoder );
-
- FT_LOCAL( void )
- cf2_getBlueMetrics( CFF_Decoder* decoder,
- CF2_Fixed* blueScale,
- CF2_Fixed* blueShift,
- CF2_Fixed* blueFuzz );
- FT_LOCAL( void )
- cf2_getBlueValues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getFamilyBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
- FT_LOCAL( void )
- cf2_getFamilyOtherBlues( CFF_Decoder* decoder,
- size_t* count,
- FT_Pos* *data );
-
- FT_LOCAL( CF2_Int )
- cf2_getLanguageGroup( CFF_Decoder* decoder );
-
- FT_LOCAL( CF2_Int )
- cf2_initGlobalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf );
- FT_LOCAL( FT_Error )
- cf2_getSeacComponent( CFF_Decoder* decoder,
- CF2_Int code,
- CF2_Buffer buf );
- FT_LOCAL( void )
- cf2_freeSeacComponent( CFF_Decoder* decoder,
- CF2_Buffer buf );
- FT_LOCAL( CF2_Int )
- cf2_initLocalRegionBuffer( CFF_Decoder* decoder,
- CF2_UInt idx,
- CF2_Buffer buf );
-
- FT_LOCAL( CF2_Fixed )
- cf2_getDefaultWidthX( CFF_Decoder* decoder );
- FT_LOCAL( CF2_Fixed )
- cf2_getNominalWidthX( CFF_Decoder* decoder );
-
-
- /*
- * FreeType client outline
- *
- * process output from the charstring interpreter
- */
- typedef struct CF2_OutlineRec_
- {
- CF2_OutlineCallbacksRec root; /* base class must be first */
- CFF_Decoder* decoder;
-
- } CF2_OutlineRec, *CF2_Outline;
-
-
- FT_LOCAL( void )
- cf2_outline_reset( CF2_Outline outline );
- FT_LOCAL( void )
- cf2_outline_close( CF2_Outline outline );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2FT_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2glue.h b/src/3rdparty/freetype/src/cff/cf2glue.h
deleted file mode 100644
index a24da39e93..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2glue.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2glue.h */
-/* */
-/* Adobe's code for shared stuff (specification only). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2GLUE_H__
-#define __CF2GLUE_H__
-
-
-/* common includes for other modules */
-#include "cf2error.h"
-#include "cf2fixed.h"
-#include "cf2arrst.h"
-#include "cf2read.h"
-
-
-FT_BEGIN_HEADER
-
-
- /* rendering parameters */
-
- /* apply hints to rendered glyphs */
-#define CF2_FlagsHinted 1
- /* for testing */
-#define CF2_FlagsDarkened 2
-
- /* type for holding the flags */
- typedef CF2_Int CF2_RenderingFlags;
-
-
- /* elements of a glyph outline */
- typedef enum CF2_PathOp_
- {
- CF2_PathOpMoveTo = 1, /* change the current point */
- CF2_PathOpLineTo = 2, /* line */
- CF2_PathOpQuadTo = 3, /* quadratic curve */
- CF2_PathOpCubeTo = 4 /* cubic curve */
-
- } CF2_PathOp;
-
-
- /* a matrix of fixed point values */
- typedef struct CF2_Matrix_
- {
- CF2_F16Dot16 a;
- CF2_F16Dot16 b;
- CF2_F16Dot16 c;
- CF2_F16Dot16 d;
- CF2_F16Dot16 tx;
- CF2_F16Dot16 ty;
-
- } CF2_Matrix;
-
-
- /* these typedefs are needed by more than one header file */
- /* and gcc compiler doesn't allow redefinition */
- typedef struct CF2_FontRec_ CF2_FontRec, *CF2_Font;
- typedef struct CF2_HintRec_ CF2_HintRec, *CF2_Hint;
-
-
- /* A common structure for all callback parameters. */
- /* */
- /* Some members may be unused. For example, `pt0' is not used for */
- /* `moveTo' and `pt3' is not used for `quadTo'. The initial point `pt0' */
- /* is included for each path element for generality; curve conversions */
- /* need it. The `op' parameter allows one function to handle multiple */
- /* element types. */
-
- typedef struct CF2_CallbackParamsRec_
- {
- FT_Vector pt0;
- FT_Vector pt1;
- FT_Vector pt2;
- FT_Vector pt3;
-
- CF2_Int op;
-
- } CF2_CallbackParamsRec, *CF2_CallbackParams;
-
-
- /* forward reference */
- typedef struct CF2_OutlineCallbacksRec_ CF2_OutlineCallbacksRec,
- *CF2_OutlineCallbacks;
-
- /* callback function pointers */
- typedef void
- (*CF2_Callback_Type)( CF2_OutlineCallbacks callbacks,
- const CF2_CallbackParams params );
-
-
- struct CF2_OutlineCallbacksRec_
- {
- CF2_Callback_Type moveTo;
- CF2_Callback_Type lineTo;
- CF2_Callback_Type quadTo;
- CF2_Callback_Type cubeTo;
-
- CF2_Int windingMomentum; /* for winding order detection */
-
- FT_Memory memory;
- FT_Error* error;
- };
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2GLUE_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2hints.c b/src/3rdparty/freetype/src/cff/cf2hints.c
deleted file mode 100644
index 0e27000210..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2hints.c
+++ /dev/null
@@ -1,1847 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2hints.c */
-/* */
-/* Adobe's code for handling CFF hints (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2hints.h"
-#include "cf2intrp.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_cf2hints
-
-
- typedef struct CF2_HintMoveRec_
- {
- size_t j; /* index of upper hint map edge */
- CF2_Fixed moveUp; /* adjustment to optimum position */
-
- } CF2_HintMoveRec, *CF2_HintMove;
-
-
- /* Compute angular momentum for winding order detection. It is called */
- /* for all lines and curves, but not necessarily in element order. */
- static CF2_Int
- cf2_getWindingMomentum( CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2 )
- {
- /* cross product of pt1 position from origin with pt2 position from */
- /* pt1; we reduce the precision so that the result fits into 32 bits */
-
- return ( x1 >> 16 ) * ( ( y2 - y1 ) >> 16 ) -
- ( y1 >> 16 ) * ( ( x2 - x1 ) >> 16 );
- }
-
-
- /*
- * Construct from a StemHint; this is used as a parameter to
- * `cf2_blues_capture'.
- * `hintOrigin' is the character space displacement of a seac accent.
- * Adjust stem hint for darkening here.
- *
- */
- static void
- cf2_hint_init( CF2_Hint hint,
- const CF2_ArrStack stemHintArray,
- size_t indexStemHint,
- const CF2_Font font,
- CF2_Fixed hintOrigin,
- CF2_Fixed scale,
- FT_Bool bottom )
- {
- CF2_Fixed width;
- const CF2_StemHintRec* stemHint;
-
-
- FT_ZERO( hint );
-
- stemHint = (const CF2_StemHintRec*)cf2_arrstack_getPointer(
- stemHintArray,
- indexStemHint );
-
- width = stemHint->max - stemHint->min;
-
- if ( width == cf2_intToFixed( -21 ) )
- {
- /* ghost bottom */
-
- if ( bottom )
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_GhostBottom;
- }
- else
- hint->flags = 0;
- }
-
- else if ( width == cf2_intToFixed( -20 ) )
- {
- /* ghost top */
-
- if ( bottom )
- hint->flags = 0;
- else
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_GhostTop;
- }
- }
-
- else if ( width < 0 )
- {
- /* inverted pair */
-
- /*
- * Hints with negative widths were produced by an early version of a
- * non-Adobe font tool. The Type 2 spec allows edge (ghost) hints
- * with negative widths, but says
- *
- * All other negative widths have undefined meaning.
- *
- * CoolType has a silent workaround that negates the hint width; for
- * permissive mode, we do the same here.
- *
- * Note: Such fonts cannot use ghost hints, but should otherwise work.
- * Note: Some poor hints in our faux fonts can produce negative
- * widths at some blends. For example, see a light weight of
- * `u' in ASerifMM.
- *
- */
- if ( bottom )
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_PairBottom;
- }
- else
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_PairTop;
- }
- }
-
- else
- {
- /* normal pair */
-
- if ( bottom )
- {
- hint->csCoord = stemHint->min;
- hint->flags = CF2_PairBottom;
- }
- else
- {
- hint->csCoord = stemHint->max;
- hint->flags = CF2_PairTop;
- }
- }
-
- /* Now that ghost hints have been detected, adjust this edge for */
- /* darkening. Bottoms are not changed; tops are incremented by twice */
- /* `darkenY'. */
- if ( cf2_hint_isTop( hint ) )
- hint->csCoord += 2 * font->darkenY;
-
- hint->csCoord += hintOrigin;
- hint->scale = scale;
- hint->index = indexStemHint; /* index in original stem hint array */
-
- /* if original stem hint has been used, use the same position */
- if ( hint->flags != 0 && stemHint->used )
- {
- if ( cf2_hint_isTop( hint ) )
- hint->dsCoord = stemHint->maxDS;
- else
- hint->dsCoord = stemHint->minDS;
-
- cf2_hint_lock( hint );
- }
- else
- hint->dsCoord = FT_MulFix( hint->csCoord, scale );
- }
-
-
- /* initialize an invalid hint map element */
- static void
- cf2_hint_initZero( CF2_Hint hint )
- {
- FT_ZERO( hint );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isValid( const CF2_Hint hint )
- {
- return (FT_Bool)( hint->flags != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isPair( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairBottom | CF2_PairTop ) ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isPairTop( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_PairTop ) != 0 );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isTop( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairTop | CF2_GhostTop ) ) != 0 );
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hint_isBottom( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags &
- ( CF2_PairBottom | CF2_GhostBottom ) ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isLocked( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_Locked ) != 0 );
- }
-
-
- static FT_Bool
- cf2_hint_isSynthetic( const CF2_Hint hint )
- {
- return (FT_Bool)( ( hint->flags & CF2_Synthetic ) != 0 );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hint_lock( CF2_Hint hint )
- {
- hint->flags |= CF2_Locked;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmap_init( CF2_HintMap hintmap,
- CF2_Font font,
- CF2_HintMap initialMap,
- CF2_ArrStack hintMoves,
- CF2_Fixed scale )
- {
- FT_ZERO( hintmap );
-
- /* copy parameters from font instance */
- hintmap->hinted = font->hinted;
- hintmap->scale = scale;
- hintmap->font = font;
- hintmap->initialHintMap = initialMap;
- /* will clear in `cf2_hintmap_adjustHints' */
- hintmap->hintMoves = hintMoves;
- }
-
-
- static FT_Bool
- cf2_hintmap_isValid( const CF2_HintMap hintmap )
- {
- return hintmap->isValid;
- }
-
-
- /* transform character space coordinate to device space using hint map */
- static CF2_Fixed
- cf2_hintmap_map( CF2_HintMap hintmap,
- CF2_Fixed csCoord )
- {
- if ( hintmap->count == 0 || ! hintmap->hinted )
- {
- /* there are no hints; use uniform scale and zero offset */
- return FT_MulFix( csCoord, hintmap->scale );
- }
- else
- {
- /* start linear search from last hit */
- CF2_UInt i = hintmap->lastIndex;
-
- FT_ASSERT( hintmap->lastIndex < CF2_MAX_HINT_EDGES );
-
- /* search up */
- while ( i < hintmap->count - 1 &&
- csCoord >= hintmap->edge[i + 1].csCoord )
- i += 1;
-
- /* search down */
- while ( i > 0 && csCoord < hintmap->edge[i].csCoord )
- i -= 1;
-
- hintmap->lastIndex = i;
-
- if ( i == 0 && csCoord < hintmap->edge[0].csCoord )
- {
- /* special case for points below first edge: use uniform scale */
- return FT_MulFix( csCoord - hintmap->edge[0].csCoord,
- hintmap->scale ) +
- hintmap->edge[0].dsCoord;
- }
- else
- {
- /*
- * Note: entries with duplicate csCoord are allowed.
- * Use edge[i], the highest entry where csCoord >= entry[i].csCoord
- */
- return FT_MulFix( csCoord - hintmap->edge[i].csCoord,
- hintmap->edge[i].scale ) +
- hintmap->edge[i].dsCoord;
- }
- }
- }
-
-
- /*
- * This hinting policy moves a hint pair in device space so that one of
- * its two edges is on a device pixel boundary (its fractional part is
- * zero). `cf2_hintmap_insertHint' guarantees no overlap in CS
- * space. Ensure here that there is no overlap in DS.
- *
- * In the first pass, edges are adjusted relative to adjacent hints.
- * Those that are below have already been adjusted. Those that are
- * above have not yet been adjusted. If a hint above blocks an
- * adjustment to an optimal position, we will try again in a second
- * pass. The second pass is top-down.
- *
- */
-
- static void
- cf2_hintmap_adjustHints( CF2_HintMap hintmap )
- {
- size_t i, j;
-
-
- cf2_arrstack_clear( hintmap->hintMoves ); /* working storage */
-
- /*
- * First pass is bottom-up (font hint order) without look-ahead.
- * Locked edges are already adjusted.
- * Unlocked edges begin with dsCoord from `initialHintMap'.
- * Save edges that are not optimally adjusted in `hintMoves' array,
- * and process them in second pass.
- */
-
- for ( i = 0; i < hintmap->count; i++ )
- {
- FT_Bool isPair = cf2_hint_isPair( &hintmap->edge[i] );
-
-
- /* index of upper edge (same value for ghost hint) */
- j = isPair ? i + 1 : i;
-
- FT_ASSERT( j < hintmap->count );
- FT_ASSERT( cf2_hint_isValid( &hintmap->edge[i] ) );
- FT_ASSERT( cf2_hint_isValid( &hintmap->edge[j] ) );
- FT_ASSERT( cf2_hint_isLocked( &hintmap->edge[i] ) ==
- cf2_hint_isLocked( &hintmap->edge[j] ) );
-
- if ( !cf2_hint_isLocked( &hintmap->edge[i] ) )
- {
- /* hint edge is not locked, we can adjust it */
- CF2_Fixed fracDown = cf2_fixedFraction( hintmap->edge[i].dsCoord );
- CF2_Fixed fracUp = cf2_fixedFraction( hintmap->edge[j].dsCoord );
-
- /* calculate all four possibilities; moves down are negative */
- CF2_Fixed downMoveDown = 0 - fracDown;
- CF2_Fixed upMoveDown = 0 - fracUp;
- CF2_Fixed downMoveUp = fracDown == 0
- ? 0
- : cf2_intToFixed( 1 ) - fracDown;
- CF2_Fixed upMoveUp = fracUp == 0
- ? 0
- : cf2_intToFixed( 1 ) - fracUp;
-
- /* smallest move up */
- CF2_Fixed moveUp = FT_MIN( downMoveUp, upMoveUp );
- /* smallest move down */
- CF2_Fixed moveDown = FT_MAX( downMoveDown, upMoveDown );
-
- /* final amount to move edge or edge pair */
- CF2_Fixed move;
-
- CF2_Fixed downMinCounter = CF2_MIN_COUNTER;
- CF2_Fixed upMinCounter = CF2_MIN_COUNTER;
- FT_Bool saveEdge = FALSE;
-
-
- /* minimum counter constraint doesn't apply when adjacent edges */
- /* are synthetic */
- /* TODO: doesn't seem a big effect; for now, reduce the code */
-#if 0
- if ( i == 0 ||
- cf2_hint_isSynthetic( &hintmap->edge[i - 1] ) )
- downMinCounter = 0;
-
- if ( j >= hintmap->count - 1 ||
- cf2_hint_isSynthetic( &hintmap->edge[j + 1] ) )
- upMinCounter = 0;
-#endif
-
- /* is there room to move up? */
- /* there is if we are at top of array or the next edge is at or */
- /* beyond proposed move up? */
- if ( j >= hintmap->count - 1 ||
- hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + moveUp + upMinCounter )
- {
- /* there is room to move up; is there also room to move down? */
- if ( i == 0 ||
- hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
- {
- /* move smaller absolute amount */
- move = ( -moveDown < moveUp ) ? moveDown : moveUp; /* optimum */
- }
- else
- move = moveUp;
- }
- else
- {
- /* is there room to move down? */
- if ( i == 0 ||
- hintmap->edge[i - 1].dsCoord <=
- hintmap->edge[i].dsCoord + moveDown - downMinCounter )
- {
- move = moveDown;
- /* true if non-optimum move */
- saveEdge = (FT_Bool)( moveUp < -moveDown );
- }
- else
- {
- /* no room to move either way without overlapping or reducing */
- /* the counter too much */
- move = 0;
- saveEdge = TRUE;
- }
- }
-
- /* Identify non-moves and moves down that aren't optimal, and save */
- /* them for second pass. */
- /* Do this only if there is an unlocked edge above (which could */
- /* possibly move). */
- if ( saveEdge &&
- j < hintmap->count - 1 &&
- !cf2_hint_isLocked( &hintmap->edge[j + 1] ) )
- {
- CF2_HintMoveRec savedMove;
-
-
- savedMove.j = j;
- /* desired adjustment in second pass */
- savedMove.moveUp = moveUp - move;
-
- cf2_arrstack_push( hintmap->hintMoves, &savedMove );
- }
-
- /* move the edge(s) */
- hintmap->edge[i].dsCoord += move;
- if ( isPair )
- hintmap->edge[j].dsCoord += move;
- }
-
- /* assert there are no overlaps in device space */
- FT_ASSERT( i == 0 ||
- hintmap->edge[i - 1].dsCoord <= hintmap->edge[i].dsCoord );
- FT_ASSERT( i < j ||
- hintmap->edge[i].dsCoord <= hintmap->edge[j].dsCoord );
-
- /* adjust the scales, avoiding divide by zero */
- if ( i > 0 )
- {
- if ( hintmap->edge[i].csCoord != hintmap->edge[i - 1].csCoord )
- hintmap->edge[i - 1].scale =
- FT_DivFix(
- hintmap->edge[i].dsCoord - hintmap->edge[i - 1].dsCoord,
- hintmap->edge[i].csCoord - hintmap->edge[i - 1].csCoord );
- }
-
- if ( isPair )
- {
- if ( hintmap->edge[j].csCoord != hintmap->edge[j - 1].csCoord )
- hintmap->edge[j - 1].scale =
- FT_DivFix(
- hintmap->edge[j].dsCoord - hintmap->edge[j - 1].dsCoord,
- hintmap->edge[j].csCoord - hintmap->edge[j - 1].csCoord );
-
- i += 1; /* skip upper edge on next loop */
- }
- }
-
- /* second pass tries to move non-optimal hints up, in case there is */
- /* room now */
- for ( i = cf2_arrstack_size( hintmap->hintMoves ); i > 0; i-- )
- {
- CF2_HintMove hintMove = (CF2_HintMove)
- cf2_arrstack_getPointer( hintmap->hintMoves, i - 1 );
-
-
- j = hintMove->j;
-
- /* this was tested before the push, above */
- FT_ASSERT( j < hintmap->count - 1 );
-
- /* is there room to move up? */
- if ( hintmap->edge[j + 1].dsCoord >=
- hintmap->edge[j].dsCoord + hintMove->moveUp + CF2_MIN_COUNTER )
- {
- /* there is more room now, move edge up */
- hintmap->edge[j].dsCoord += hintMove->moveUp;
-
- if ( cf2_hint_isPair( &hintmap->edge[j] ) )
- {
- FT_ASSERT( j > 0 );
- hintmap->edge[j - 1].dsCoord += hintMove->moveUp;
- }
- }
- }
- }
-
-
- /* insert hint edges into map, sorted by csCoord */
- static void
- cf2_hintmap_insertHint( CF2_HintMap hintmap,
- CF2_Hint bottomHintEdge,
- CF2_Hint topHintEdge )
- {
- CF2_UInt indexInsert;
-
- /* set default values, then check for edge hints */
- FT_Bool isPair = TRUE;
- CF2_Hint firstHintEdge = bottomHintEdge;
- CF2_Hint secondHintEdge = topHintEdge;
-
-
- /* one or none of the input params may be invalid when dealing with */
- /* edge hints; at least one edge must be valid */
- FT_ASSERT( cf2_hint_isValid( bottomHintEdge ) ||
- cf2_hint_isValid( topHintEdge ) );
-
- /* determine how many and which edges to insert */
- if ( !cf2_hint_isValid( bottomHintEdge ) )
- {
- /* insert only the top edge */
- firstHintEdge = topHintEdge;
- isPair = FALSE;
- }
- else if ( !cf2_hint_isValid( topHintEdge ) )
- {
- /* insert only the bottom edge */
- isPair = FALSE;
- }
-
- /* paired edges must be in proper order */
- FT_ASSERT( !isPair ||
- topHintEdge->csCoord >= bottomHintEdge->csCoord );
-
- /* linear search to find index value of insertion point */
- indexInsert = 0;
- for ( ; indexInsert < hintmap->count; indexInsert++ )
- {
- if ( hintmap->edge[indexInsert].csCoord >= firstHintEdge->csCoord )
- break;
- }
-
- /*
- * Discard any hints that overlap in character space. Most often, this
- * is while building the initial map, where captured hints from all
- * zones are combined. Define overlap to include hints that `touch'
- * (overlap zero). Hiragino Sans/Gothic fonts have numerous hints that
- * touch. Some fonts have non-ideographic glyphs that overlap our
- * synthetic hints.
- *
- * Overlap also occurs when darkening stem hints that are close.
- *
- */
- if ( indexInsert < hintmap->count )
- {
- /* we are inserting before an existing edge: */
- /* verify that an existing edge is not the same */
- if ( hintmap->edge[indexInsert].csCoord == firstHintEdge->csCoord )
- return; /* ignore overlapping stem hint */
-
- /* verify that a new pair does not straddle the next edge */
- if ( isPair &&
- hintmap->edge[indexInsert].csCoord <= secondHintEdge->csCoord )
- return; /* ignore overlapping stem hint */
-
- /* verify that we are not inserting between paired edges */
- if ( cf2_hint_isPairTop( &hintmap->edge[indexInsert] ) )
- return; /* ignore overlapping stem hint */
- }
-
- /* recompute device space locations using initial hint map */
- if ( cf2_hintmap_isValid( hintmap->initialHintMap ) &&
- !cf2_hint_isLocked( firstHintEdge ) )
- {
- if ( isPair )
- {
- /* Use hint map to position the center of stem, and nominal scale */
- /* to position the two edges. This preserves the stem width. */
- CF2_Fixed midpoint = cf2_hintmap_map(
- hintmap->initialHintMap,
- ( secondHintEdge->csCoord +
- firstHintEdge->csCoord ) / 2 );
- CF2_Fixed halfWidth = FT_MulFix(
- ( secondHintEdge->csCoord -
- firstHintEdge->csCoord ) / 2,
- hintmap->scale );
-
-
- firstHintEdge->dsCoord = midpoint - halfWidth;
- secondHintEdge->dsCoord = midpoint + halfWidth;
- }
- else
- firstHintEdge->dsCoord = cf2_hintmap_map( hintmap->initialHintMap,
- firstHintEdge->csCoord );
- }
-
- /*
- * Discard any hints that overlap in device space; this can occur
- * because locked hints have been moved to align with blue zones.
- *
- * TODO: Although we might correct this later during adjustment, we
- * don't currently have a way to delete a conflicting hint once it has
- * been inserted. See v2.030 MinionPro-Regular, 12 ppem darkened,
- * initial hint map for second path, glyph 945 (the perispomeni (tilde)
- * in U+1F6E, Greek omega with psili and perispomeni). Darkening is
- * 25. Pair 667,747 initially conflicts in design space with top edge
- * 660. This is because 667 maps to 7.87, and the top edge was
- * captured by a zone at 8.0. The pair is later successfully inserted
- * in a zone without the top edge. In this zone it is adjusted to 8.0,
- * and no longer conflicts with the top edge in design space. This
- * means it can be included in yet a later zone which does have the top
- * edge hint. This produces a small mismatch between the first and
- * last points of this path, even though the hint masks are the same.
- * The density map difference is tiny (1/256).
- *
- */
-
- if ( indexInsert > 0 )
- {
- /* we are inserting after an existing edge */
- if ( firstHintEdge->dsCoord < hintmap->edge[indexInsert - 1].dsCoord )
- return;
- }
-
- if ( indexInsert < hintmap->count )
- {
- /* we are inserting before an existing edge */
- if ( isPair )
- {
- if ( secondHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
- return;
- }
- else
- {
- if ( firstHintEdge->dsCoord > hintmap->edge[indexInsert].dsCoord )
- return;
- }
- }
-
- /* make room to insert */
- {
- CF2_UInt iSrc = hintmap->count - 1;
- CF2_UInt iDst = isPair ? hintmap->count + 1 : hintmap->count;
-
- CF2_UInt count = hintmap->count - indexInsert;
-
-
- if ( iDst >= CF2_MAX_HINT_EDGES )
- {
- FT_TRACE4(( "cf2_hintmap_insertHint: too many hintmaps\n" ));
- return;
- }
-
- while ( count-- )
- hintmap->edge[iDst--] = hintmap->edge[iSrc--];
-
- /* insert first edge */
- hintmap->edge[indexInsert] = *firstHintEdge; /* copy struct */
- hintmap->count += 1;
-
- if ( isPair )
- {
- /* insert second edge */
- hintmap->edge[indexInsert + 1] = *secondHintEdge; /* copy struct */
- hintmap->count += 1;
- }
- }
-
- return;
- }
-
-
- /*
- * Build a map from hints and mask.
- *
- * This function may recur one level if `hintmap->initialHintMap' is not yet
- * valid.
- * If `initialMap' is true, simply build initial map.
- *
- * Synthetic hints are used in two ways. A hint at zero is inserted, if
- * needed, in the initial hint map, to prevent translations from
- * propagating across the origin. If synthetic em box hints are enabled
- * for ideographic dictionaries, then they are inserted in all hint
- * maps, including the initial one.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_hintmap_build( CF2_HintMap hintmap,
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- FT_Bool initialMap )
- {
- FT_Byte* maskPtr;
-
- CF2_Font font = hintmap->font;
- CF2_HintMaskRec tempHintMask;
-
- size_t bitCount, i;
- FT_Byte maskByte;
-
-
- /* check whether initial map is constructed */
- if ( !initialMap && !cf2_hintmap_isValid( hintmap->initialHintMap ) )
- {
- /* make recursive call with initialHintMap and temporary mask; */
- /* temporary mask will get all bits set, below */
- cf2_hintmask_init( &tempHintMask, hintMask->error );
- cf2_hintmap_build( hintmap->initialHintMap,
- hStemHintArray,
- vStemHintArray,
- &tempHintMask,
- hintOrigin,
- TRUE );
- }
-
- if ( !cf2_hintmask_isValid( hintMask ) )
- {
- /* without a hint mask, assume all hints are active */
- cf2_hintmask_setAll( hintMask,
- cf2_arrstack_size( hStemHintArray ) +
- cf2_arrstack_size( vStemHintArray ) );
- if ( !cf2_hintmask_isValid( hintMask ) )
- return; /* too many stem hints */
- }
-
- /* begin by clearing the map */
- hintmap->count = 0;
- hintmap->lastIndex = 0;
-
- /* make a copy of the hint mask so we can modify it */
- tempHintMask = *hintMask;
- maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
-
- /* use the hStem hints only, which are first in the mask */
- bitCount = cf2_arrstack_size( hStemHintArray );
-
- /* Defense-in-depth. Should never return here. */
- if ( bitCount > hintMask->bitCount )
- return;
-
- /* synthetic embox hints get highest priority */
- if ( font->blues.doEmBoxHints )
- {
- CF2_HintRec dummy;
-
-
- cf2_hint_initZero( &dummy ); /* invalid hint map element */
-
- /* ghost bottom */
- cf2_hintmap_insertHint( hintmap,
- &font->blues.emBoxBottomEdge,
- &dummy );
- /* ghost top */
- cf2_hintmap_insertHint( hintmap,
- &dummy,
- &font->blues.emBoxTopEdge );
- }
-
- /* insert hints captured by a blue zone or already locked (higher */
- /* priority) */
- for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
- {
- if ( maskByte & *maskPtr )
- {
- /* expand StemHint into two `CF2_Hint' elements */
- CF2_HintRec bottomHintEdge, topHintEdge;
-
-
- cf2_hint_init( &bottomHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- TRUE /* bottom */ );
- cf2_hint_init( &topHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- FALSE /* top */ );
-
- if ( cf2_hint_isLocked( &bottomHintEdge ) ||
- cf2_hint_isLocked( &topHintEdge ) ||
- cf2_blues_capture( &font->blues,
- &bottomHintEdge,
- &topHintEdge ) )
- {
- /* insert captured hint into map */
- cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
-
- *maskPtr &= ~maskByte; /* turn off the bit for this hint */
- }
- }
-
- if ( ( i & 7 ) == 7 )
- {
- /* move to next mask byte */
- maskPtr++;
- maskByte = 0x80;
- }
- else
- maskByte >>= 1;
- }
-
- /* initial hint map includes only captured hints plus maybe one at 0 */
-
- /*
- * TODO: There is a problem here because we are trying to build a
- * single hint map containing all captured hints. It is
- * possible for there to be conflicts between captured hints,
- * either because of darkening or because the hints are in
- * separate hint zones (we are ignoring hint zones for the
- * initial map). An example of the latter is MinionPro-Regular
- * v2.030 glyph 883 (Greek Capital Alpha with Psili) at 15ppem.
- * A stem hint for the psili conflicts with the top edge hint
- * for the base character. The stem hint gets priority because
- * of its sort order. In glyph 884 (Greek Capital Alpha with
- * Psili and Oxia), the top of the base character gets a stem
- * hint, and the psili does not. This creates different initial
- * maps for the two glyphs resulting in different renderings of
- * the base character. Will probably defer this either as not
- * worth the cost or as a font bug. I don't think there is any
- * good reason for an accent to be captured by an alignment
- * zone. -darnold 2/12/10
- */
-
- if ( initialMap )
- {
- /* Apply a heuristic that inserts a point for (0,0), unless it's */
- /* already covered by a mapping. This locks the baseline for glyphs */
- /* that have no baseline hints. */
-
- if ( hintmap->count == 0 ||
- hintmap->edge[0].csCoord > 0 ||
- hintmap->edge[hintmap->count - 1].csCoord < 0 )
- {
- /* all edges are above 0 or all edges are below 0; */
- /* construct a locked edge hint at 0 */
-
- CF2_HintRec edge, invalid;
-
-
- cf2_hint_initZero( &edge );
-
- edge.flags = CF2_GhostBottom |
- CF2_Locked |
- CF2_Synthetic;
- edge.scale = hintmap->scale;
-
- cf2_hint_initZero( &invalid );
- cf2_hintmap_insertHint( hintmap, &edge, &invalid );
- }
- }
- else
- {
- /* insert remaining hints */
-
- maskPtr = cf2_hintmask_getMaskPtr( &tempHintMask );
-
- for ( i = 0, maskByte = 0x80; i < bitCount; i++ )
- {
- if ( maskByte & *maskPtr )
- {
- CF2_HintRec bottomHintEdge, topHintEdge;
-
-
- cf2_hint_init( &bottomHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- TRUE /* bottom */ );
- cf2_hint_init( &topHintEdge,
- hStemHintArray,
- i,
- font,
- hintOrigin,
- hintmap->scale,
- FALSE /* top */ );
-
- cf2_hintmap_insertHint( hintmap, &bottomHintEdge, &topHintEdge );
- }
-
- if ( ( i & 7 ) == 7 )
- {
- /* move to next mask byte */
- maskPtr++;
- maskByte = 0x80;
- }
- else
- maskByte >>= 1;
- }
- }
-
- /*
- * Note: The following line is a convenient place to break when
- * debugging hinting. Examine `hintmap->edge' for the list of
- * enabled hints, then step over the call to see the effect of
- * adjustment. We stop here first on the recursive call that
- * creates the initial map, and then on each counter group and
- * hint zone.
- */
-
- /* adjust positions of hint edges that are not locked to blue zones */
- cf2_hintmap_adjustHints( hintmap );
-
- /* save the position of all hints that were used in this hint map; */
- /* if we use them again, we'll locate them in the same position */
- if ( !initialMap )
- {
- for ( i = 0; i < hintmap->count; i++ )
- {
- if ( !cf2_hint_isSynthetic( &hintmap->edge[i] ) )
- {
- /* Note: include both valid and invalid edges */
- /* Note: top and bottom edges are copied back separately */
- CF2_StemHint stemhint = (CF2_StemHint)
- cf2_arrstack_getPointer( hStemHintArray,
- hintmap->edge[i].index );
-
-
- if ( cf2_hint_isTop( &hintmap->edge[i] ) )
- stemhint->maxDS = hintmap->edge[i].dsCoord;
- else
- stemhint->minDS = hintmap->edge[i].dsCoord;
-
- stemhint->used = TRUE;
- }
- }
- }
-
- /* hint map is ready to use */
- hintmap->isValid = TRUE;
-
- /* remember this mask has been used */
- cf2_hintmask_setNew( hintMask, FALSE );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_init( CF2_GlyphPath glyphpath,
- CF2_Font font,
- CF2_OutlineCallbacks callbacks,
- CF2_Fixed scaleY,
- /* CF2_Fixed hShift, */
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOriginY,
- const CF2_Blues blues,
- const FT_Vector* fractionalTranslation )
- {
- FT_ZERO( glyphpath );
-
- glyphpath->font = font;
- glyphpath->callbacks = callbacks;
-
- cf2_arrstack_init( &glyphpath->hintMoves,
- font->memory,
- &font->error,
- sizeof ( CF2_HintMoveRec ) );
-
- cf2_hintmap_init( &glyphpath->initialHintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
- cf2_hintmap_init( &glyphpath->firstHintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
- cf2_hintmap_init( &glyphpath->hintMap,
- font,
- &glyphpath->initialHintMap,
- &glyphpath->hintMoves,
- scaleY );
-
- glyphpath->scaleX = font->innerTransform.a;
- glyphpath->scaleC = font->innerTransform.c;
- glyphpath->scaleY = font->innerTransform.d;
-
- glyphpath->fractionalTranslation = *fractionalTranslation;
-
-#if 0
- glyphpath->hShift = hShift; /* for fauxing */
-#endif
-
- glyphpath->hStemHintArray = hStemHintArray;
- glyphpath->vStemHintArray = vStemHintArray;
- glyphpath->hintMask = hintMask; /* ptr to current mask */
- glyphpath->hintOriginY = hintOriginY;
- glyphpath->blues = blues;
- glyphpath->darken = font->darkened; /* TODO: should we make copies? */
- glyphpath->xOffset = font->darkenX;
- glyphpath->yOffset = font->darkenY;
- glyphpath->miterLimit = 2 * FT_MAX(
- cf2_fixedAbs( glyphpath->xOffset ),
- cf2_fixedAbs( glyphpath->yOffset ) );
-
- /* .1 character space unit */
- glyphpath->snapThreshold = cf2_floatToFixed( 0.1f );
-
- glyphpath->moveIsPending = TRUE;
- glyphpath->pathIsOpen = FALSE;
- glyphpath->pathIsClosing = FALSE;
- glyphpath->elemIsQueued = FALSE;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_finalize( CF2_GlyphPath glyphpath )
- {
- cf2_arrstack_finalize( &glyphpath->hintMoves );
- }
-
-
- /*
- * Hint point in y-direction and apply outerTransform.
- * Input `current' hint map (which is actually delayed by one element).
- * Input x,y point in Character Space.
- * Output x,y point in Device Space, including translation.
- */
- static void
- cf2_glyphpath_hintPoint( CF2_GlyphPath glyphpath,
- CF2_HintMap hintmap,
- FT_Vector* ppt,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- FT_Vector pt; /* hinted point in upright DS */
-
-
- pt.x = FT_MulFix( glyphpath->scaleX, x ) +
- FT_MulFix( glyphpath->scaleC, y );
- pt.y = cf2_hintmap_map( hintmap, y );
-
- ppt->x = FT_MulFix( glyphpath->font->outerTransform.a, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.c, pt.y ) +
- glyphpath->fractionalTranslation.x;
- ppt->y = FT_MulFix( glyphpath->font->outerTransform.b, pt.x ) +
- FT_MulFix( glyphpath->font->outerTransform.d, pt.y ) +
- glyphpath->fractionalTranslation.y;
- }
-
-
- /*
- * From two line segments, (u1,u2) and (v1,v2), compute a point of
- * intersection on the corresponding lines.
- * Return false if no intersection is found, or if the intersection is
- * too far away from the ends of the line segments, u2 and v1.
- *
- */
- static FT_Bool
- cf2_glyphpath_computeIntersection( CF2_GlyphPath glyphpath,
- const FT_Vector* u1,
- const FT_Vector* u2,
- const FT_Vector* v1,
- const FT_Vector* v2,
- FT_Vector* intersection )
- {
- /*
- * Let `u' be a zero-based vector from the first segment, `v' from the
- * second segment.
- * Let `w 'be the zero-based vector from `u1' to `v1'.
- * `perp' is the `perpendicular dot product'; see
- * http://mathworld.wolfram.com/PerpDotProduct.html.
- * `s' is the parameter for the parametric line for the first segment
- * (`u').
- *
- * See notation in
- * http://softsurfer.com/Archive/algorithm_0104/algorithm_0104B.htm.
- * Calculations are done in 16.16, but must handle the squaring of
- * line lengths in character space. We scale all vectors by 1/32 to
- * avoid overflow. This allows values up to 4095 to be squared. The
- * scale factor cancels in the divide.
- *
- * TODO: the scale factor could be computed from UnitsPerEm.
- *
- */
-
-#define cf2_perp( a, b ) \
- ( FT_MulFix( a.x, b.y ) - FT_MulFix( a.y, b.x ) )
-
- /* round and divide by 32 */
-#define CF2_CS_SCALE( x ) \
- ( ( (x) + 0x10 ) >> 5 )
-
- FT_Vector u, v, w; /* scaled vectors */
- CF2_Fixed denominator, s;
-
-
- u.x = CF2_CS_SCALE( u2->x - u1->x );
- u.y = CF2_CS_SCALE( u2->y - u1->y );
- v.x = CF2_CS_SCALE( v2->x - v1->x );
- v.y = CF2_CS_SCALE( v2->y - v1->y );
- w.x = CF2_CS_SCALE( v1->x - u1->x );
- w.y = CF2_CS_SCALE( v1->y - u1->y );
-
- denominator = cf2_perp( u, v );
-
- if ( denominator == 0 )
- return FALSE; /* parallel or coincident lines */
-
- s = FT_DivFix( cf2_perp( w, v ), denominator );
-
- intersection->x = u1->x + FT_MulFix( s, u2->x - u1->x );
- intersection->y = u1->y + FT_MulFix( s, u2->y - u1->y );
-
- /*
- * Special case snapping for horizontal and vertical lines.
- * This cleans up intersections and reduces problems with winding
- * order detection.
- * Sample case is sbc cd KozGoPr6N-Medium.otf 20 16685.
- * Note: these calculations are in character space.
- *
- */
-
- if ( u1->x == u2->x &&
- cf2_fixedAbs( intersection->x - u1->x ) < glyphpath->snapThreshold )
- intersection->x = u1->x;
- if ( u1->y == u2->y &&
- cf2_fixedAbs( intersection->y - u1->y ) < glyphpath->snapThreshold )
- intersection->y = u1->y;
-
- if ( v1->x == v2->x &&
- cf2_fixedAbs( intersection->x - v1->x ) < glyphpath->snapThreshold )
- intersection->x = v1->x;
- if ( v1->y == v2->y &&
- cf2_fixedAbs( intersection->y - v1->y ) < glyphpath->snapThreshold )
- intersection->y = v1->y;
-
- /* limit the intersection distance from midpoint of u2 and v1 */
- if ( cf2_fixedAbs( intersection->x - ( u2->x + v1->x ) / 2 ) >
- glyphpath->miterLimit ||
- cf2_fixedAbs( intersection->y - ( u2->y + v1->y ) / 2 ) >
- glyphpath->miterLimit )
- return FALSE;
-
- return TRUE;
- }
-
-
- /*
- * Push the cached element (glyphpath->prevElem*) to the outline
- * consumer. When a darkening offset is used, the end point of the
- * cached element may be adjusted to an intersection point or we may
- * synthesize a connecting line to the current element. If we are
- * closing a subpath, we may also generate a connecting line to the start
- * point.
- *
- * This is where Character Space (CS) is converted to Device Space (DS)
- * using a hint map. This calculation must use a HintMap that was valid
- * at the time the element was saved. For the first point in a subpath,
- * that is a saved HintMap. For most elements, it just means the caller
- * has delayed building a HintMap from the current HintMask.
- *
- * Transform each point with outerTransform and call the outline
- * callbacks. This is a general 3x3 transform:
- *
- * x' = a*x + c*y + tx, y' = b*x + d*y + ty
- *
- * but it uses 4 elements from CF2_Font and the translation part
- * from CF2_GlyphPath.
- *
- */
- static void
- cf2_glyphpath_pushPrevElem( CF2_GlyphPath glyphpath,
- CF2_HintMap hintmap,
- FT_Vector* nextP0,
- FT_Vector nextP1,
- FT_Bool close )
- {
- CF2_CallbackParamsRec params;
-
- FT_Vector* prevP0;
- FT_Vector* prevP1;
-
- FT_Vector intersection = { 0, 0 };
- FT_Bool useIntersection = FALSE;
-
-
- FT_ASSERT( glyphpath->prevElemOp == CF2_PathOpLineTo ||
- glyphpath->prevElemOp == CF2_PathOpCubeTo );
-
- if ( glyphpath->prevElemOp == CF2_PathOpLineTo )
- {
- prevP0 = &glyphpath->prevElemP0;
- prevP1 = &glyphpath->prevElemP1;
- }
- else
- {
- prevP0 = &glyphpath->prevElemP2;
- prevP1 = &glyphpath->prevElemP3;
- }
-
- /* optimization: if previous and next elements are offset by the same */
- /* amount, then there will be no gap, and no need to compute an */
- /* intersection. */
- if ( prevP1->x != nextP0->x || prevP1->y != nextP0->y )
- {
- /* previous element does not join next element: */
- /* adjust end point of previous element to the intersection */
- useIntersection = cf2_glyphpath_computeIntersection( glyphpath,
- prevP0,
- prevP1,
- nextP0,
- &nextP1,
- &intersection );
- if ( useIntersection )
- {
- /* modify the last point of the cached element (either line or */
- /* curve) */
- *prevP1 = intersection;
- }
- }
-
- params.pt0 = glyphpath->currentDS;
-
- switch( glyphpath->prevElemOp )
- {
- case CF2_PathOpLineTo:
- params.op = CF2_PathOpLineTo;
-
- /* note: pt2 and pt3 are unused */
-
- if ( close )
- {
- /* use first hint map if closing */
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->firstHintMap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- }
- else
- {
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- }
-
- /* output only non-zero length lines */
- if ( params.pt0.x != params.pt1.x || params.pt0.y != params.pt1.y )
- {
- glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- }
- break;
-
- case CF2_PathOpCubeTo:
- params.op = CF2_PathOpCubeTo;
-
- /* TODO: should we intersect the interior joins (p1-p2 and p2-p3)? */
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- glyphpath->prevElemP1.x,
- glyphpath->prevElemP1.y );
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt2,
- glyphpath->prevElemP2.x,
- glyphpath->prevElemP2.y );
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt3,
- glyphpath->prevElemP3.x,
- glyphpath->prevElemP3.y );
-
- glyphpath->callbacks->cubeTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt3;
-
- break;
- }
-
- if ( !useIntersection || close )
- {
- /* insert connecting line between end of previous element and start */
- /* of current one */
- /* note: at the end of a subpath, we might do both, so use `nextP0' */
- /* before we change it, below */
-
- if ( close )
- {
- /* if we are closing the subpath, then nextP0 is in the first */
- /* hint zone */
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->firstHintMap,
- &params.pt1,
- nextP0->x,
- nextP0->y );
- }
- else
- {
- cf2_glyphpath_hintPoint( glyphpath,
- hintmap,
- &params.pt1,
- nextP0->x,
- nextP0->y );
- }
-
- if ( params.pt1.x != glyphpath->currentDS.x ||
- params.pt1.y != glyphpath->currentDS.y )
- {
- /* length is nonzero */
- params.op = CF2_PathOpLineTo;
- params.pt0 = glyphpath->currentDS;
-
- /* note: pt2 and pt3 are unused */
- glyphpath->callbacks->lineTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- }
- }
-
- if ( useIntersection )
- {
- /* return intersection point to caller */
- *nextP0 = intersection;
- }
- }
-
-
- /* push a MoveTo element based on current point and offset of current */
- /* element */
- static void
- cf2_glyphpath_pushMove( CF2_GlyphPath glyphpath,
- FT_Vector start )
- {
- CF2_CallbackParamsRec params;
-
-
- params.op = CF2_PathOpMoveTo;
- params.pt0 = glyphpath->currentDS;
-
- /* Test if move has really happened yet; it would have called */
- /* `cf2_hintmap_build' to set `isValid'. */
- if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) )
- {
- /* we are here iff first subpath is missing a moveto operator: */
- /* synthesize first moveTo to finish initialization of hintMap */
- cf2_glyphpath_moveTo( glyphpath,
- glyphpath->start.x,
- glyphpath->start.y );
- }
-
- cf2_glyphpath_hintPoint( glyphpath,
- &glyphpath->hintMap,
- &params.pt1,
- start.x,
- start.y );
-
- /* note: pt2 and pt3 are unused */
- glyphpath->callbacks->moveTo( glyphpath->callbacks, &params );
-
- glyphpath->currentDS = params.pt1;
- glyphpath->offsetStart0 = start;
- }
-
-
- /*
- * All coordinates are in character space.
- * On input, (x1, y1) and (x2, y2) give line segment.
- * On output, (x, y) give offset vector.
- * We use a piecewise approximation to trig functions.
- *
- * TODO: Offset true perpendicular and proper length
- * supply the y-translation for hinting here, too,
- * that adds yOffset unconditionally to *y.
- */
- static void
- cf2_glyphpath_computeOffset( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed* x,
- CF2_Fixed* y )
- {
- CF2_Fixed dx = x2 - x1;
- CF2_Fixed dy = y2 - y1;
-
-
- /* note: negative offsets don't work here; negate deltas to change */
- /* quadrants, below */
- if ( glyphpath->font->reverseWinding )
- {
- dx = -dx;
- dy = -dy;
- }
-
- *x = *y = 0;
-
- if ( !glyphpath->darken )
- return;
-
- /* add momentum for this path element */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
-
- /* note: allow mixed integer and fixed multiplication here */
- if ( dx >= 0 )
- {
- if ( dy >= 0 )
- {
- /* first quadrant, +x +y */
-
- if ( dx > 2 * dy )
- {
- /* +x */
- *x = 0;
- *y = 0;
- }
- else if ( dy > 2 * dx )
- {
- /* +y */
- *x = glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* +x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
- glyphpath->yOffset );
- }
- }
- else
- {
- /* fourth quadrant, +x -y */
-
- if ( dx > -2 * dy )
- {
- /* +x */
- *x = 0;
- *y = 0;
- }
- else if ( -dy > 2 * dx )
- {
- /* -y */
- *x = -glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* +x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 - 0.7 ),
- glyphpath->yOffset );
- }
- }
- }
- else
- {
- if ( dy >= 0 )
- {
- /* second quadrant, -x +y */
-
- if ( -dx > 2 * dy )
- {
- /* -x */
- *x = 0;
- *y = 2 * glyphpath->yOffset;
- }
- else if ( dy > -2 * dx )
- {
- /* +y */
- *x = glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* -x +y */
- *x = FT_MulFix( cf2_floatToFixed( 0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
- glyphpath->yOffset );
- }
- }
- else
- {
- /* third quadrant, -x -y */
-
- if ( -dx > -2 * dy )
- {
- /* -x */
- *x = 0;
- *y = 2 * glyphpath->yOffset;
- }
- else if ( -dy > -2 * dx )
- {
- /* -y */
- *x = -glyphpath->xOffset;
- *y = glyphpath->yOffset;
- }
- else
- {
- /* -x -y */
- *x = FT_MulFix( cf2_floatToFixed( -0.7 ),
- glyphpath->xOffset );
- *y = FT_MulFix( cf2_floatToFixed( 1.0 + 0.7 ),
- glyphpath->yOffset );
- }
- }
- }
- }
-
-
- /*
- * The functions cf2_glyphpath_{moveTo,lineTo,curveTo,closeOpenPath} are
- * called by the interpreter with Character Space (CS) coordinates. Each
- * path element is placed into a queue of length one to await the
- * calculation of the following element. At that time, the darkening
- * offset of the following element is known and joins can be computed,
- * including possible modification of this element, before mapping to
- * Device Space (DS) and passing it on to the outline consumer.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- cf2_glyphpath_closeOpenPath( glyphpath );
-
- /* save the parameters of the move for later, when we'll know how to */
- /* offset it; */
- /* also save last move point */
- glyphpath->currentCS.x = glyphpath->start.x = x;
- glyphpath->currentCS.y = glyphpath->start.y = y;
-
- glyphpath->moveIsPending = TRUE;
-
- /* ensure we have a valid map with current mask */
- if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- cf2_hintmask_isNew( glyphpath->hintMask ) )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- /* save a copy of current HintMap to use when drawing initial point */
- glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y )
- {
- CF2_Fixed xOffset, yOffset;
- FT_Vector P0, P1;
- FT_Bool newHintMap;
-
- /*
- * New hints will be applied after cf2_glyphpath_pushPrevElem has run.
- * In case this is a synthesized closing line, any new hints should be
- * delayed until this path is closed (`cf2_hintmask_isNew' will be
- * called again before the next line or curve).
- */
-
- /* true if new hint map not on close */
- newHintMap = cf2_hintmask_isNew( glyphpath->hintMask ) &&
- !glyphpath->pathIsClosing;
-
- /*
- * Zero-length lines may occur in the charstring. Because we cannot
- * compute darkening offsets or intersections from zero-length lines,
- * it is best to remove them and avoid artifacts. However, zero-length
- * lines in CS at the start of a new hint map can generate non-zero
- * lines in DS due to hint substitution. We detect a change in hint
- * map here and pass those zero-length lines along.
- */
-
- /*
- * Note: Find explicitly closed paths here with a conditional
- * breakpoint using
- *
- * !gp->pathIsClosing && gp->start.x == x && gp->start.y == y
- *
- */
-
- if ( glyphpath->currentCS.x == x &&
- glyphpath->currentCS.y == y &&
- !newHintMap )
- /*
- * Ignore zero-length lines in CS where the hint map is the same
- * because the line in DS will also be zero length.
- *
- * Ignore zero-length lines when we synthesize a closing line because
- * the close will be handled in cf2_glyphPath_pushPrevElem.
- */
- return;
-
- cf2_glyphpath_computeOffset( glyphpath,
- glyphpath->currentCS.x,
- glyphpath->currentCS.y,
- x,
- y,
- &xOffset,
- &yOffset );
-
- /* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset;
- P0.y = glyphpath->currentCS.y + yOffset;
- P1.x = x + xOffset;
- P1.y = y + yOffset;
-
- if ( glyphpath->moveIsPending )
- {
- /* emit offset 1st point as MoveTo */
- cf2_glyphpath_pushMove( glyphpath, P0 );
-
- glyphpath->moveIsPending = FALSE; /* adjust state machine */
- glyphpath->pathIsOpen = TRUE;
-
- glyphpath->offsetStart1 = P1; /* record second point */
- }
-
- if ( glyphpath->elemIsQueued )
- {
- FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- glyphpath->hintMap.count == 0 );
-
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &P0,
- P1,
- FALSE );
- }
-
- /* queue the current element with offset points */
- glyphpath->elemIsQueued = TRUE;
- glyphpath->prevElemOp = CF2_PathOpLineTo;
- glyphpath->prevElemP0 = P0;
- glyphpath->prevElemP1 = P1;
-
- /* update current map */
- if ( newHintMap )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- glyphpath->currentCS.x = x; /* pre-offset current point */
- glyphpath->currentCS.y = y;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed x3,
- CF2_Fixed y3 )
- {
- CF2_Fixed xOffset1, yOffset1, xOffset3, yOffset3;
- FT_Vector P0, P1, P2, P3;
-
-
- /* TODO: ignore zero length portions of curve?? */
- cf2_glyphpath_computeOffset( glyphpath,
- glyphpath->currentCS.x,
- glyphpath->currentCS.y,
- x1,
- y1,
- &xOffset1,
- &yOffset1 );
- cf2_glyphpath_computeOffset( glyphpath,
- x2,
- y2,
- x3,
- y3,
- &xOffset3,
- &yOffset3 );
-
- /* add momentum from the middle segment */
- glyphpath->callbacks->windingMomentum +=
- cf2_getWindingMomentum( x1, y1, x2, y2 );
-
- /* construct offset points */
- P0.x = glyphpath->currentCS.x + xOffset1;
- P0.y = glyphpath->currentCS.y + yOffset1;
- P1.x = x1 + xOffset1;
- P1.y = y1 + yOffset1;
- /* note: preserve angle of final segment by using offset3 at both ends */
- P2.x = x2 + xOffset3;
- P2.y = y2 + yOffset3;
- P3.x = x3 + xOffset3;
- P3.y = y3 + yOffset3;
-
- if ( glyphpath->moveIsPending )
- {
- /* emit offset 1st point as MoveTo */
- cf2_glyphpath_pushMove( glyphpath, P0 );
-
- glyphpath->moveIsPending = FALSE;
- glyphpath->pathIsOpen = TRUE;
-
- glyphpath->offsetStart1 = P1; /* record second point */
- }
-
- if ( glyphpath->elemIsQueued )
- {
- FT_ASSERT( cf2_hintmap_isValid( &glyphpath->hintMap ) ||
- glyphpath->hintMap.count == 0 );
-
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &P0,
- P1,
- FALSE );
- }
-
- /* queue the current element with offset points */
- glyphpath->elemIsQueued = TRUE;
- glyphpath->prevElemOp = CF2_PathOpCubeTo;
- glyphpath->prevElemP0 = P0;
- glyphpath->prevElemP1 = P1;
- glyphpath->prevElemP2 = P2;
- glyphpath->prevElemP3 = P3;
-
- /* update current map */
- if ( cf2_hintmask_isNew( glyphpath->hintMask ) )
- cf2_hintmap_build( &glyphpath->hintMap,
- glyphpath->hStemHintArray,
- glyphpath->vStemHintArray,
- glyphpath->hintMask,
- glyphpath->hintOriginY,
- FALSE );
-
- glyphpath->currentCS.x = x3; /* pre-offset current point */
- glyphpath->currentCS.y = y3;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath )
- {
- if ( glyphpath->pathIsOpen )
- {
- /*
- * A closing line in Character Space line is always generated below
- * with `cf2_glyphPath_lineTo'. It may be ignored later if it turns
- * out to be zero length in Device Space.
- */
- glyphpath->pathIsClosing = TRUE;
-
- cf2_glyphpath_lineTo( glyphpath,
- glyphpath->start.x,
- glyphpath->start.y );
-
- /* empty the final element from the queue and close the path */
- if ( glyphpath->elemIsQueued )
- cf2_glyphpath_pushPrevElem( glyphpath,
- &glyphpath->hintMap,
- &glyphpath->offsetStart0,
- glyphpath->offsetStart1,
- TRUE );
-
- /* reset state machine */
- glyphpath->moveIsPending = TRUE;
- glyphpath->pathIsOpen = FALSE;
- glyphpath->pathIsClosing = FALSE;
- glyphpath->elemIsQueued = FALSE;
- }
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2hints.h b/src/3rdparty/freetype/src/cff/cf2hints.h
deleted file mode 100644
index f25d91bf89..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2hints.h
+++ /dev/null
@@ -1,289 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2hints.h */
-/* */
-/* Adobe's code for handling CFF hints (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2HINTS_H__
-#define __CF2HINTS_H__
-
-
-FT_BEGIN_HEADER
-
-
- enum
- {
- CF2_MAX_HINTS = 96 /* maximum # of hints */
- };
-
-
- /*
- * A HintMask object stores a bit mask that specifies which hints in the
- * charstring are active at a given time. Hints in CFF must be declared
- * at the start, before any drawing operators, with horizontal hints
- * preceding vertical hints. The HintMask is ordered the same way, with
- * horizontal hints immediately followed by vertical hints. Clients are
- * responsible for knowing how many of each type are present.
- *
- * The maximum total number of hints is 96, as specified by the CFF
- * specification.
- *
- * A HintMask is built 0 or more times while interpreting a charstring, by
- * the HintMask operator. There is only one HintMask, but it is built or
- * rebuilt each time there is a hint substitution (HintMask operator) in
- * the charstring. A default HintMask with all bits set is built if there
- * has been no HintMask operator prior to the first drawing operator.
- *
- */
-
- typedef struct CF2_HintMaskRec_
- {
- FT_Error* error;
-
- FT_Bool isValid;
- FT_Bool isNew;
-
- size_t bitCount;
- size_t byteCount;
-
- FT_Byte mask[( CF2_MAX_HINTS + 7 ) / 8];
-
- } CF2_HintMaskRec, *CF2_HintMask;
-
-
- typedef struct CF2_StemHintRec_
- {
- FT_Bool used; /* DS positions are valid */
-
- CF2_Fixed min; /* original character space value */
- CF2_Fixed max;
-
- CF2_Fixed minDS; /* DS position after first use */
- CF2_Fixed maxDS;
-
- } CF2_StemHintRec, *CF2_StemHint;
-
-
- /*
- * A HintMap object stores a piecewise linear function for mapping
- * y-coordinates from character space to device space, providing
- * appropriate pixel alignment to stem edges.
- *
- * The map is implemented as an array of `CF2_Hint' elements, each
- * representing an edge. When edges are paired, as from stem hints, the
- * bottom edge must immediately precede the top edge in the array.
- * Element character space AND device space positions must both increase
- * monotonically in the array. `CF2_Hint' elements are also used as
- * parameters to `cf2_blues_capture'.
- *
- * The `cf2_hintmap_build' method must be called before any drawing
- * operation (beginning with a Move operator) and at each hint
- * substitution (HintMask operator).
- *
- * The `cf2_hintmap_map' method is called to transform y-coordinates at
- * each drawing operation (move, line, curve).
- *
- */
-
- /* TODO: make this a CF2_ArrStack and add a deep copy method */
- enum
- {
- CF2_MAX_HINT_EDGES = CF2_MAX_HINTS * 2
- };
-
-
- typedef struct CF2_HintMapRec_
- {
- CF2_Font font;
-
- /* initial map based on blue zones */
- struct CF2_HintMapRec_* initialHintMap;
-
- /* working storage for 2nd pass adjustHints */
- CF2_ArrStack hintMoves;
-
- FT_Bool isValid;
- FT_Bool hinted;
-
- CF2_Fixed scale;
- CF2_UInt count;
-
- /* start search from this index */
- CF2_UInt lastIndex;
-
- CF2_HintRec edge[CF2_MAX_HINT_EDGES]; /* 192 */
-
- } CF2_HintMapRec, *CF2_HintMap;
-
-
- FT_LOCAL( FT_Bool )
- cf2_hint_isValid( const CF2_Hint hint );
- FT_LOCAL( FT_Bool )
- cf2_hint_isTop( const CF2_Hint hint );
- FT_LOCAL( FT_Bool )
- cf2_hint_isBottom( const CF2_Hint hint );
- FT_LOCAL( void )
- cf2_hint_lock( CF2_Hint hint );
-
-
- FT_LOCAL( void )
- cf2_hintmap_init( CF2_HintMap hintmap,
- CF2_Font font,
- CF2_HintMap initialMap,
- CF2_ArrStack hintMoves,
- CF2_Fixed scale );
- FT_LOCAL( void )
- cf2_hintmap_build( CF2_HintMap hintmap,
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- FT_Bool initialMap );
-
-
- /*
- * GlyphPath is a wrapper for drawing operations that scales the
- * coordinates according to the render matrix and HintMap. It also tracks
- * open paths to control ClosePath and to insert MoveTo for broken fonts.
- *
- */
- typedef struct CF2_GlyphPathRec_
- {
- /* TODO: gather some of these into a hinting context */
-
- CF2_Font font; /* font instance */
- CF2_OutlineCallbacks callbacks; /* outline consumer */
-
-
- CF2_HintMapRec hintMap; /* current hint map */
- CF2_HintMapRec firstHintMap; /* saved copy */
- CF2_HintMapRec initialHintMap; /* based on all captured hints */
-
- CF2_ArrStackRec hintMoves; /* list of hint moves for 2nd pass */
-
- CF2_Fixed scaleX; /* matrix a */
- CF2_Fixed scaleC; /* matrix c */
- CF2_Fixed scaleY; /* matrix d */
-
- FT_Vector fractionalTranslation; /* including deviceXScale */
-#if 0
- CF2_Fixed hShift; /* character space horizontal shift */
- /* (for fauxing) */
-#endif
-
- FT_Bool pathIsOpen; /* true after MoveTo */
- FT_Bool pathIsClosing; /* true when synthesizing closepath line */
- FT_Bool darken; /* true if stem darkening */
- FT_Bool moveIsPending; /* true between MoveTo and offset MoveTo */
-
- /* references used to call `cf2_hintmap_build', if necessary */
- CF2_ArrStack hStemHintArray;
- CF2_ArrStack vStemHintArray;
- CF2_HintMask hintMask; /* ptr to the current mask */
- CF2_Fixed hintOriginY; /* copy of current origin */
- const CF2_BluesRec* blues;
-
- CF2_Fixed xOffset; /* character space offsets */
- CF2_Fixed yOffset;
-
- /* character space miter limit threshold */
- CF2_Fixed miterLimit;
- /* vertical/horzizontal snap distance in character space */
- CF2_Fixed snapThreshold;
-
- FT_Vector offsetStart0; /* first and second points of first */
- FT_Vector offsetStart1; /* element with offset applied */
-
- /* current point, character space, before offset */
- FT_Vector currentCS;
- /* current point, device space */
- FT_Vector currentDS;
- /* start point of subpath, character space */
- FT_Vector start;
-
- /* the following members constitute the `queue' of one element */
- FT_Bool elemIsQueued;
- CF2_Int prevElemOp;
-
- FT_Vector prevElemP0;
- FT_Vector prevElemP1;
- FT_Vector prevElemP2;
- FT_Vector prevElemP3;
-
- } CF2_GlyphPathRec, *CF2_GlyphPath;
-
-
- FT_LOCAL( void )
- cf2_glyphpath_init( CF2_GlyphPath glyphpath,
- CF2_Font font,
- CF2_OutlineCallbacks callbacks,
- CF2_Fixed scaleY,
- /* CF2_Fixed hShift, */
- CF2_ArrStack hStemHintArray,
- CF2_ArrStack vStemHintArray,
- CF2_HintMask hintMask,
- CF2_Fixed hintOrigin,
- const CF2_Blues blues,
- const FT_Vector* fractionalTranslation );
- FT_LOCAL( void )
- cf2_glyphpath_finalize( CF2_GlyphPath glyphpath );
-
- FT_LOCAL( void )
- cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y );
- FT_LOCAL( void )
- cf2_glyphpath_lineTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x,
- CF2_Fixed y );
- FT_LOCAL( void )
- cf2_glyphpath_curveTo( CF2_GlyphPath glyphpath,
- CF2_Fixed x1,
- CF2_Fixed y1,
- CF2_Fixed x2,
- CF2_Fixed y2,
- CF2_Fixed x3,
- CF2_Fixed y3 );
- FT_LOCAL( void )
- cf2_glyphpath_closeOpenPath( CF2_GlyphPath glyphpath );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2HINTS_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2intrp.c b/src/3rdparty/freetype/src/cff/cf2intrp.c
deleted file mode 100644
index ff3fa9aaaa..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2intrp.c
+++ /dev/null
@@ -1,1571 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2intrp.c */
-/* */
-/* Adobe's CFF Interpreter (body). */
-/* */
-/* Copyright 2007-2014 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2stack.h"
-#include "cf2hints.h"
-#include "cf2intrp.h"
-
-#include "cf2error.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_cf2interp
-
-
- /* some operators are not implemented yet */
-#define CF2_FIXME FT_TRACE4(( "cf2_interpT2CharString:" \
- " operator not implemented yet\n" ))
-
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_init( CF2_HintMask hintmask,
- FT_Error* error )
- {
- FT_ZERO( hintmask );
-
- hintmask->error = error;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hintmask_isValid( const CF2_HintMask hintmask )
- {
- return hintmask->isValid;
- }
-
-
- FT_LOCAL_DEF( FT_Bool )
- cf2_hintmask_isNew( const CF2_HintMask hintmask )
- {
- return hintmask->isNew;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_setNew( CF2_HintMask hintmask,
- FT_Bool val )
- {
- hintmask->isNew = val;
- }
-
-
- /* clients call `getMaskPtr' in order to iterate */
- /* through hint mask */
-
- FT_LOCAL_DEF( FT_Byte* )
- cf2_hintmask_getMaskPtr( CF2_HintMask hintmask )
- {
- return hintmask->mask;
- }
-
-
- static size_t
- cf2_hintmask_setCounts( CF2_HintMask hintmask,
- size_t bitCount )
- {
- if ( bitCount > CF2_MAX_HINTS )
- {
- /* total of h and v stems must be <= 96 */
- CF2_SET_ERROR( hintmask->error, Invalid_Glyph_Format );
- return 0;
- }
-
- hintmask->bitCount = bitCount;
- hintmask->byteCount = ( hintmask->bitCount + 7 ) / 8;
-
- hintmask->isValid = TRUE;
- hintmask->isNew = TRUE;
-
- return bitCount;
- }
-
-
- /* consume the hintmask bytes from the charstring, advancing the src */
- /* pointer */
- static void
- cf2_hintmask_read( CF2_HintMask hintmask,
- CF2_Buffer charstring,
- size_t bitCount )
- {
- size_t i;
-
-#ifndef CF2_NDEBUG
- /* these are the bits in the final mask byte that should be zero */
- /* Note: this variable is only used in an assert expression below */
- /* and then only if CF2_NDEBUG is not defined */
- CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
-#endif
-
-
- /* initialize counts and isValid */
- if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
- return;
-
- FT_ASSERT( hintmask->byteCount > 0 );
-
- FT_TRACE4(( " (maskbytes:" ));
-
- /* set mask and advance interpreter's charstring pointer */
- for ( i = 0; i < hintmask->byteCount; i++ )
- {
- hintmask->mask[i] = (FT_Byte)cf2_buf_readByte( charstring );
- FT_TRACE4(( " 0x%02X", hintmask->mask[i] ));
- }
-
- FT_TRACE4(( ")\n" ));
-
- /* assert any unused bits in last byte are zero unless there's a prior */
- /* error */
- /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
-#ifndef CF2_NDEBUG
- FT_ASSERT( ( hintmask->mask[hintmask->byteCount - 1] & mask ) == 0 ||
- *hintmask->error );
-#endif
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_hintmask_setAll( CF2_HintMask hintmask,
- size_t bitCount )
- {
- size_t i;
- CF2_UInt mask = ( 1 << ( -(CF2_Int)bitCount & 7 ) ) - 1;
-
-
- /* initialize counts and isValid */
- if ( cf2_hintmask_setCounts( hintmask, bitCount ) == 0 )
- return;
-
- FT_ASSERT( hintmask->byteCount > 0 );
- FT_ASSERT( hintmask->byteCount <
- sizeof ( hintmask->mask ) / sizeof ( hintmask->mask[0] ) );
-
- /* set mask to all ones */
- for ( i = 0; i < hintmask->byteCount; i++ )
- hintmask->mask[i] = 0xFF;
-
- /* clear unused bits */
- /* bitCount -> mask, 0 -> 0, 1 -> 7f, 2 -> 3f, ... 6 -> 3, 7 -> 1 */
- hintmask->mask[hintmask->byteCount - 1] &= ~mask;
- }
-
-
- /* Type2 charstring opcodes */
- enum
- {
- cf2_cmdRESERVED_0, /* 0 */
- cf2_cmdHSTEM, /* 1 */
- cf2_cmdRESERVED_2, /* 2 */
- cf2_cmdVSTEM, /* 3 */
- cf2_cmdVMOVETO, /* 4 */
- cf2_cmdRLINETO, /* 5 */
- cf2_cmdHLINETO, /* 6 */
- cf2_cmdVLINETO, /* 7 */
- cf2_cmdRRCURVETO, /* 8 */
- cf2_cmdRESERVED_9, /* 9 */
- cf2_cmdCALLSUBR, /* 10 */
- cf2_cmdRETURN, /* 11 */
- cf2_cmdESC, /* 12 */
- cf2_cmdRESERVED_13, /* 13 */
- cf2_cmdENDCHAR, /* 14 */
- cf2_cmdRESERVED_15, /* 15 */
- cf2_cmdRESERVED_16, /* 16 */
- cf2_cmdRESERVED_17, /* 17 */
- cf2_cmdHSTEMHM, /* 18 */
- cf2_cmdHINTMASK, /* 19 */
- cf2_cmdCNTRMASK, /* 20 */
- cf2_cmdRMOVETO, /* 21 */
- cf2_cmdHMOVETO, /* 22 */
- cf2_cmdVSTEMHM, /* 23 */
- cf2_cmdRCURVELINE, /* 24 */
- cf2_cmdRLINECURVE, /* 25 */
- cf2_cmdVVCURVETO, /* 26 */
- cf2_cmdHHCURVETO, /* 27 */
- cf2_cmdEXTENDEDNMBR, /* 28 */
- cf2_cmdCALLGSUBR, /* 29 */
- cf2_cmdVHCURVETO, /* 30 */
- cf2_cmdHVCURVETO /* 31 */
- };
-
- enum
- {
- cf2_escDOTSECTION, /* 0 */
- cf2_escRESERVED_1, /* 1 */
- cf2_escRESERVED_2, /* 2 */
- cf2_escAND, /* 3 */
- cf2_escOR, /* 4 */
- cf2_escNOT, /* 5 */
- cf2_escRESERVED_6, /* 6 */
- cf2_escRESERVED_7, /* 7 */
- cf2_escRESERVED_8, /* 8 */
- cf2_escABS, /* 9 */
- cf2_escADD, /* 10 like otherADD */
- cf2_escSUB, /* 11 like otherSUB */
- cf2_escDIV, /* 12 */
- cf2_escRESERVED_13, /* 13 */
- cf2_escNEG, /* 14 */
- cf2_escEQ, /* 15 */
- cf2_escRESERVED_16, /* 16 */
- cf2_escRESERVED_17, /* 17 */
- cf2_escDROP, /* 18 */
- cf2_escRESERVED_19, /* 19 */
- cf2_escPUT, /* 20 like otherPUT */
- cf2_escGET, /* 21 like otherGET */
- cf2_escIFELSE, /* 22 like otherIFELSE */
- cf2_escRANDOM, /* 23 like otherRANDOM */
- cf2_escMUL, /* 24 like otherMUL */
- cf2_escRESERVED_25, /* 25 */
- cf2_escSQRT, /* 26 */
- cf2_escDUP, /* 27 like otherDUP */
- cf2_escEXCH, /* 28 like otherEXCH */
- cf2_escINDEX, /* 29 */
- cf2_escROLL, /* 30 */
- cf2_escRESERVED_31, /* 31 */
- cf2_escRESERVED_32, /* 32 */
- cf2_escRESERVED_33, /* 33 */
- cf2_escHFLEX, /* 34 */
- cf2_escFLEX, /* 35 */
- cf2_escHFLEX1, /* 36 */
- cf2_escFLEX1 /* 37 */
- };
-
-
- /* `stemHintArray' does not change once we start drawing the outline. */
- static void
- cf2_doStems( const CF2_Font font,
- CF2_Stack opStack,
- CF2_ArrStack stemHintArray,
- CF2_Fixed* width,
- FT_Bool* haveWidth,
- CF2_Fixed hintOffset )
- {
- CF2_UInt i;
- CF2_UInt count = cf2_stack_count( opStack );
- FT_Bool hasWidthArg = (FT_Bool)( count & 1 );
-
- /* variable accumulates delta values from operand stack */
- CF2_Fixed position = hintOffset;
-
- if ( hasWidthArg && ! *haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) +
- cf2_getNominalWidthX( font->decoder );
-
- if ( font->decoder->width_only )
- goto exit;
-
- for ( i = hasWidthArg ? 1 : 0; i < count; i += 2 )
- {
- /* construct a CF2_StemHint and push it onto the list */
- CF2_StemHintRec stemhint;
-
-
- stemhint.min =
- position += cf2_stack_getReal( opStack, i );
- stemhint.max =
- position += cf2_stack_getReal( opStack, i + 1 );
-
- stemhint.used = FALSE;
- stemhint.maxDS =
- stemhint.minDS = 0;
-
- cf2_arrstack_push( stemHintArray, &stemhint ); /* defer error check */
- }
-
- cf2_stack_clear( opStack );
-
- exit:
- /* cf2_doStems must define a width (may be default) */
- *haveWidth = TRUE;
- }
-
-
- static void
- cf2_doFlex( CF2_Stack opStack,
- CF2_Fixed* curX,
- CF2_Fixed* curY,
- CF2_GlyphPath glyphPath,
- const FT_Bool* readFromStack,
- FT_Bool doConditionalLastRead )
- {
- CF2_Fixed vals[14];
- CF2_UInt index;
- FT_Bool isHFlex;
- CF2_Int top, i, j;
-
-
- vals[0] = *curX;
- vals[1] = *curY;
- index = 0;
- isHFlex = readFromStack[9] == FALSE;
- top = isHFlex ? 9 : 10;
-
- for ( i = 0; i < top; i++ )
- {
- vals[i + 2] = vals[i];
- if ( readFromStack[i] )
- vals[i + 2] += cf2_stack_getReal( opStack, index++ );
- }
-
- if ( isHFlex )
- vals[9 + 2] = *curY;
-
- if ( doConditionalLastRead )
- {
- FT_Bool lastIsX = (FT_Bool)( cf2_fixedAbs( vals[10] - *curX ) >
- cf2_fixedAbs( vals[11] - *curY ) );
- CF2_Fixed lastVal = cf2_stack_getReal( opStack, index );
-
-
- if ( lastIsX )
- {
- vals[12] = vals[10] + lastVal;
- vals[13] = *curY;
- }
- else
- {
- vals[12] = *curX;
- vals[13] = vals[11] + lastVal;
- }
- }
- else
- {
- if ( readFromStack[10] )
- vals[12] = vals[10] + cf2_stack_getReal( opStack, index++ );
- else
- vals[12] = *curX;
-
- if ( readFromStack[11] )
- vals[13] = vals[11] + cf2_stack_getReal( opStack, index );
- else
- vals[13] = *curY;
- }
-
- for ( j = 0; j < 2; j++ )
- cf2_glyphpath_curveTo( glyphPath, vals[j * 6 + 2],
- vals[j * 6 + 3],
- vals[j * 6 + 4],
- vals[j * 6 + 5],
- vals[j * 6 + 6],
- vals[j * 6 + 7] );
-
- cf2_stack_clear( opStack );
-
- *curX = vals[12];
- *curY = vals[13];
- }
-
-
- /*
- * `error' is a shared error code used by many objects in this
- * routine. Before the code continues from an error, it must check and
- * record the error in `*error'. The idea is that this shared
- * error code will record the first error encountered. If testing
- * for an error anyway, the cost of `goto exit' is small, so we do it,
- * even if continuing would be safe. In this case, `lastError' is
- * set, so the testing and storing can be done in one place, at `exit'.
- *
- * Continuing after an error is intended for objects which do their own
- * testing of `*error', e.g., array stack functions. This allows us to
- * avoid an extra test after the call.
- *
- * Unimplemented opcodes are ignored.
- *
- */
- FT_LOCAL_DEF( void )
- cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer buf,
- CF2_OutlineCallbacks callbacks,
- const FT_Vector* translation,
- FT_Bool doingSeac,
- CF2_Fixed curX,
- CF2_Fixed curY,
- CF2_Fixed* width )
- {
- /* lastError is used for errors that are immediately tested */
- FT_Error lastError = FT_Err_Ok;
-
- /* pointer to parsed font object */
- CFF_Decoder* decoder = font->decoder;
-
- FT_Error* error = &font->error;
- FT_Memory memory = font->memory;
-
- CF2_Fixed scaleY = font->innerTransform.d;
- CF2_Fixed nominalWidthX = cf2_getNominalWidthX( decoder );
-
- /* save this for hinting seac accents */
- CF2_Fixed hintOriginY = curY;
-
- CF2_Stack opStack = NULL;
- FT_Byte op1; /* first opcode byte */
-
- /* instruction limit; 20,000,000 matches Avalon */
- FT_UInt32 instructionLimit = 20000000UL;
-
- CF2_ArrStackRec subrStack;
-
- FT_Bool haveWidth;
- CF2_Buffer charstring = NULL;
-
- CF2_Int charstringIndex = -1; /* initialize to empty */
-
- /* TODO: placeholders for hint structures */
-
- /* objects used for hinting */
- CF2_ArrStackRec hStemHintArray;
- CF2_ArrStackRec vStemHintArray;
-
- CF2_HintMaskRec hintMask;
- CF2_GlyphPathRec glyphPath;
-
-
- /* initialize the remaining objects */
- cf2_arrstack_init( &subrStack,
- memory,
- error,
- sizeof ( CF2_BufferRec ) );
- cf2_arrstack_init( &hStemHintArray,
- memory,
- error,
- sizeof ( CF2_StemHintRec ) );
- cf2_arrstack_init( &vStemHintArray,
- memory,
- error,
- sizeof ( CF2_StemHintRec ) );
-
- /* initialize CF2_StemHint arrays */
- cf2_hintmask_init( &hintMask, error );
-
- /* initialize path map to manage drawing operations */
-
- /* Note: last 4 params are used to handle `MoveToPermissive', which */
- /* may need to call `hintMap.Build' */
- /* TODO: MoveToPermissive is gone; are these still needed? */
- cf2_glyphpath_init( &glyphPath,
- font,
- callbacks,
- scaleY,
- /* hShift, */
- &hStemHintArray,
- &vStemHintArray,
- &hintMask,
- hintOriginY,
- &font->blues,
- translation );
-
- /*
- * Initialize state for width parsing. From the CFF Spec:
- *
- * The first stack-clearing operator, which must be one of hstem,
- * hstemhm, vstem, vstemhm, cntrmask, hintmask, hmoveto, vmoveto,
- * rmoveto, or endchar, takes an additional argument - the width (as
- * described earlier), which may be expressed as zero or one numeric
- * argument.
- *
- * What we implement here uses the first validly specified width, but
- * does not detect errors for specifying more than one width.
- *
- * If one of the above operators occurs without explicitly specifying
- * a width, we assume the default width.
- *
- */
- haveWidth = FALSE;
- *width = cf2_getDefaultWidthX( decoder );
-
- /*
- * Note: at this point, all pointers to resources must be NULL
- * and all local objects must be initialized.
- * There must be no branches to exit: above this point.
- *
- */
-
- /* allocate an operand stack */
- opStack = cf2_stack_init( memory, error );
- if ( !opStack )
- {
- lastError = FT_THROW( Out_Of_Memory );
- goto exit;
- }
-
- /* initialize subroutine stack by placing top level charstring as */
- /* first element (max depth plus one for the charstring) */
- /* Note: Caller owns and must finalize the first charstring. */
- /* Our copy of it does not change that requirement. */
- cf2_arrstack_setCount( &subrStack, CF2_MAX_SUBR + 1 );
-
- charstring = (CF2_Buffer)cf2_arrstack_getBuffer( &subrStack );
- *charstring = *buf; /* structure copy */
-
- charstringIndex = 0; /* entry is valid now */
-
- /* catch errors so far */
- if ( *error )
- goto exit;
-
- /* main interpreter loop */
- while ( 1 )
- {
- if ( cf2_buf_isEnd( charstring ) )
- {
- /* If we've reached the end of the charstring, simulate a */
- /* cf2_cmdRETURN or cf2_cmdENDCHAR. */
- if ( charstringIndex )
- op1 = cf2_cmdRETURN; /* end of buffer for subroutine */
- else
- op1 = cf2_cmdENDCHAR; /* end of buffer for top level charstring */
- }
- else
- op1 = (FT_Byte)cf2_buf_readByte( charstring );
-
- /* check for errors once per loop */
- if ( *error )
- goto exit;
-
- instructionLimit--;
- if ( instructionLimit == 0 )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit;
- }
-
- switch( op1 )
- {
- case cf2_cmdRESERVED_0:
- case cf2_cmdRESERVED_2:
- case cf2_cmdRESERVED_9:
- case cf2_cmdRESERVED_13:
- case cf2_cmdRESERVED_15:
- case cf2_cmdRESERVED_16:
- case cf2_cmdRESERVED_17:
- /* we may get here if we have a prior error */
- FT_TRACE4(( " unknown op (%d)\n", op1 ));
- break;
-
- case cf2_cmdHSTEMHM:
- case cf2_cmdHSTEM:
- FT_TRACE4(( op1 == cf2_cmdHSTEMHM ? " hstemhm\n" : " hstem\n" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString:"
- " invalid horizontal hint mask\n" ));
- break;
- }
-
- cf2_doStems( font,
- opStack,
- &hStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- break;
-
- case cf2_cmdVSTEMHM:
- case cf2_cmdVSTEM:
- FT_TRACE4(( op1 == cf2_cmdVSTEMHM ? " vstemhm\n" : " vstem\n" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString:"
- " invalid vertical hint mask\n" ));
- break;
- }
-
- cf2_doStems( font,
- opStack,
- &vStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- break;
-
- case cf2_cmdVMOVETO:
- FT_TRACE4(( " vmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curY += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdRLINETO:
- {
- CF2_UInt index;
- CF2_UInt count = cf2_stack_count( opStack );
-
-
- FT_TRACE4(( " rlineto\n" ));
-
- for ( index = 0; index < count; index += 2 )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdHLINETO:
- case cf2_cmdVLINETO:
- {
- CF2_UInt index;
- CF2_UInt count = cf2_stack_count( opStack );
-
- FT_Bool isX = op1 == cf2_cmdHLINETO;
-
-
- FT_TRACE4(( isX ? " hlineto\n" : " vlineto\n" ));
-
- for ( index = 0; index < count; index++ )
- {
- CF2_Fixed v = cf2_stack_getReal( opStack, index );
-
-
- if ( isX )
- curX += v;
- else
- curY += v;
-
- isX = !isX;
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue;
-
- case cf2_cmdRCURVELINE:
- case cf2_cmdRRCURVETO:
- {
- CF2_UInt count = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- FT_TRACE4(( op1 == cf2_cmdRCURVELINE ? " rcurveline\n"
- : " rrcurveto\n" ));
-
- while ( index + 6 <= count )
- {
- CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
-
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 6;
- }
-
- if ( op1 == cf2_cmdRCURVELINE )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdCALLGSUBR:
- case cf2_cmdCALLSUBR:
- {
- CF2_UInt subrIndex;
-
-
- FT_TRACE4(( op1 == cf2_cmdCALLGSUBR ? " callgsubr"
- : " callsubr" ));
-
- if ( charstringIndex > CF2_MAX_SUBR )
- {
- /* max subr plus one for charstring */
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* overflow of stack */
- }
-
- /* push our current CFF charstring region on subrStack */
- charstring = (CF2_Buffer)
- cf2_arrstack_getPointer(
- &subrStack,
- (size_t)charstringIndex + 1 );
-
- /* set up the new CFF region and pointer */
- subrIndex = (CF2_UInt)cf2_stack_popInt( opStack );
-
- switch ( op1 )
- {
- case cf2_cmdCALLGSUBR:
- FT_TRACE4(( " (idx %d, entering level %d)\n",
- subrIndex + (CF2_UInt)decoder->globals_bias,
- charstringIndex + 1 ));
-
- if ( cf2_initGlobalRegionBuffer( decoder,
- subrIndex,
- charstring ) )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* subroutine lookup or stream error */
- }
- break;
-
- default:
- /* cf2_cmdCALLSUBR */
- FT_TRACE4(( " (idx %d, entering level %d)\n",
- subrIndex + (CF2_UInt)decoder->locals_bias,
- charstringIndex + 1 ));
-
- if ( cf2_initLocalRegionBuffer( decoder,
- subrIndex,
- charstring ) )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* subroutine lookup or stream error */
- }
- }
-
- charstringIndex += 1; /* entry is valid now */
- }
- continue; /* do not clear the stack */
-
- case cf2_cmdRETURN:
- FT_TRACE4(( " return (leaving level %d)\n", charstringIndex ));
-
- if ( charstringIndex < 1 )
- {
- /* Note: cannot return from top charstring */
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* underflow of stack */
- }
-
- /* restore position in previous charstring */
- charstring = (CF2_Buffer)
- cf2_arrstack_getPointer(
- &subrStack,
- (CF2_UInt)--charstringIndex );
- continue; /* do not clear the stack */
-
- case cf2_cmdESC:
- {
- FT_Byte op2 = (FT_Byte)cf2_buf_readByte( charstring );
-
-
- switch ( op2 )
- {
- case cf2_escDOTSECTION:
- /* something about `flip type of locking' -- ignore it */
- FT_TRACE4(( " dotsection\n" ));
-
- break;
-
- /* TODO: should these operators be supported? */
- case cf2_escAND: /* in spec */
- FT_TRACE4(( " and\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escOR: /* in spec */
- FT_TRACE4(( " or\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escNOT: /* in spec */
- FT_TRACE4(( " not\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escABS: /* in spec */
- FT_TRACE4(( " abs\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escADD: /* in spec */
- FT_TRACE4(( " add\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escSUB: /* in spec */
- FT_TRACE4(( " sub\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDIV: /* in spec */
- FT_TRACE4(( " div\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escNEG: /* in spec */
- FT_TRACE4(( " neg\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escEQ: /* in spec */
- FT_TRACE4(( " eq\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDROP: /* in spec */
- FT_TRACE4(( " drop\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escPUT: /* in spec */
- FT_TRACE4(( " put\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escGET: /* in spec */
- FT_TRACE4(( " get\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escIFELSE: /* in spec */
- FT_TRACE4(( " ifelse\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escRANDOM: /* in spec */
- FT_TRACE4(( " random\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escMUL: /* in spec */
- FT_TRACE4(( " mul\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escSQRT: /* in spec */
- FT_TRACE4(( " sqrt\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escDUP: /* in spec */
- FT_TRACE4(( " dup\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escEXCH: /* in spec */
- FT_TRACE4(( " exch\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escINDEX: /* in spec */
- FT_TRACE4(( " index\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escROLL: /* in spec */
- FT_TRACE4(( " roll\n" ));
-
- CF2_FIXME;
- break;
-
- case cf2_escHFLEX:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, FALSE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, FALSE /* dy3 */,
- TRUE /* dx4 */, FALSE /* dy4 */,
- TRUE /* dx5 */, FALSE /* dy5 */,
- TRUE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " hflex\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escFLEX:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, TRUE /* dy3 */,
- TRUE /* dx4 */, TRUE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- TRUE /* dx6 */, TRUE /* dy6 */
- };
-
-
- FT_TRACE4(( " flex\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- break; /* TODO: why is this not a continue? */
-
- case cf2_escHFLEX1:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, FALSE /* dy3 */,
- TRUE /* dx4 */, FALSE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- TRUE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " hflex1\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- FALSE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escFLEX1:
- {
- static const FT_Bool readFromStack[12] =
- {
- TRUE /* dx1 */, TRUE /* dy1 */,
- TRUE /* dx2 */, TRUE /* dy2 */,
- TRUE /* dx3 */, TRUE /* dy3 */,
- TRUE /* dx4 */, TRUE /* dy4 */,
- TRUE /* dx5 */, TRUE /* dy5 */,
- FALSE /* dx6 */, FALSE /* dy6 */
- };
-
-
- FT_TRACE4(( " flex1\n" ));
-
- cf2_doFlex( opStack,
- &curX,
- &curY,
- &glyphPath,
- readFromStack,
- TRUE /* doConditionalLastRead */ );
- }
- continue;
-
- case cf2_escRESERVED_1:
- case cf2_escRESERVED_2:
- case cf2_escRESERVED_6:
- case cf2_escRESERVED_7:
- case cf2_escRESERVED_8:
- case cf2_escRESERVED_13:
- case cf2_escRESERVED_16:
- case cf2_escRESERVED_17:
- case cf2_escRESERVED_19:
- case cf2_escRESERVED_25:
- case cf2_escRESERVED_31:
- case cf2_escRESERVED_32:
- case cf2_escRESERVED_33:
- default:
- FT_TRACE4(( " unknown op (12, %d)\n", op2 ));
-
- }; /* end of switch statement checking `op2' */
-
- } /* case cf2_cmdESC */
- break;
-
- case cf2_cmdENDCHAR:
- FT_TRACE4(( " endchar\n" ));
-
- if ( cf2_stack_count( opStack ) == 1 ||
- cf2_stack_count( opStack ) == 5 )
- {
- if ( !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
- }
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- /* close path if still open */
- cf2_glyphpath_closeOpenPath( &glyphPath );
-
- if ( cf2_stack_count( opStack ) > 1 )
- {
- /* must be either 4 or 5 -- */
- /* this is a (deprecated) implied `seac' operator */
-
- CF2_Int achar;
- CF2_Int bchar;
- CF2_BufferRec component;
- CF2_Fixed dummyWidth; /* ignore component width */
- FT_Error error2;
-
-
- if ( doingSeac )
- {
- lastError = FT_THROW( Invalid_Glyph_Format );
- goto exit; /* nested seac */
- }
-
- achar = cf2_stack_popInt( opStack );
- bchar = cf2_stack_popInt( opStack );
-
- curY = cf2_stack_popFixed( opStack );
- curX = cf2_stack_popFixed( opStack );
-
- error2 = cf2_getSeacComponent( decoder, achar, &component );
- if ( error2 )
- {
- lastError = error2; /* pass FreeType error through */
- goto exit;
- }
- cf2_interpT2CharString( font,
- &component,
- callbacks,
- translation,
- TRUE,
- curX,
- curY,
- &dummyWidth );
- cf2_freeSeacComponent( decoder, &component );
-
- error2 = cf2_getSeacComponent( decoder, bchar, &component );
- if ( error2 )
- {
- lastError = error2; /* pass FreeType error through */
- goto exit;
- }
- cf2_interpT2CharString( font,
- &component,
- callbacks,
- translation,
- TRUE,
- 0,
- 0,
- &dummyWidth );
- cf2_freeSeacComponent( decoder, &component );
- }
- goto exit;
-
- case cf2_cmdCNTRMASK:
- case cf2_cmdHINTMASK:
- /* the final \n in the tracing message gets added in */
- /* `cf2_hintmask_read' (which also traces the mask bytes) */
- FT_TRACE4(( op1 == cf2_cmdCNTRMASK ? " cntrmask" : " hintmask" ));
-
- /* never add hints after the mask is computed */
- if ( cf2_stack_count( opStack ) > 1 &&
- cf2_hintmask_isValid( &hintMask ) )
- {
- FT_TRACE4(( "cf2_interpT2CharString: invalid hint mask\n" ));
- break;
- }
-
- /* if there are arguments on the stack, there this is an */
- /* implied cf2_cmdVSTEMHM */
- cf2_doStems( font,
- opStack,
- &vStemHintArray,
- width,
- &haveWidth,
- 0 );
-
- if ( font->decoder->width_only )
- goto exit;
-
- if ( op1 == cf2_cmdHINTMASK )
- {
- /* consume the hint mask bytes which follow the operator */
- cf2_hintmask_read( &hintMask,
- charstring,
- cf2_arrstack_size( &hStemHintArray ) +
- cf2_arrstack_size( &vStemHintArray ) );
- }
- else
- {
- /*
- * Consume the counter mask bytes which follow the operator:
- * Build a temporary hint map, just to place and lock those
- * stems participating in the counter mask. These are most
- * likely the dominant hstems, and are grouped together in a
- * few counter groups, not necessarily in correspondence
- * with the hint groups. This reduces the chances of
- * conflicts between hstems that are initially placed in
- * separate hint groups and then brought together. The
- * positions are copied back to `hStemHintArray', so we can
- * discard `counterMask' and `counterHintMap'.
- *
- */
- CF2_HintMapRec counterHintMap;
- CF2_HintMaskRec counterMask;
-
-
- cf2_hintmap_init( &counterHintMap,
- font,
- &glyphPath.initialHintMap,
- &glyphPath.hintMoves,
- scaleY );
- cf2_hintmask_init( &counterMask, error );
-
- cf2_hintmask_read( &counterMask,
- charstring,
- cf2_arrstack_size( &hStemHintArray ) +
- cf2_arrstack_size( &vStemHintArray ) );
- cf2_hintmap_build( &counterHintMap,
- &hStemHintArray,
- &vStemHintArray,
- &counterMask,
- 0,
- FALSE );
- }
- break;
-
- case cf2_cmdRMOVETO:
- FT_TRACE4(( " rmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 2 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curY += cf2_stack_popFixed( opStack );
- curX += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdHMOVETO:
- FT_TRACE4(( " hmoveto\n" ));
-
- if ( cf2_stack_count( opStack ) > 1 && !haveWidth )
- *width = cf2_stack_getReal( opStack, 0 ) + nominalWidthX;
-
- /* width is defined or default after this */
- haveWidth = TRUE;
-
- if ( font->decoder->width_only )
- goto exit;
-
- curX += cf2_stack_popFixed( opStack );
-
- cf2_glyphpath_moveTo( &glyphPath, curX, curY );
-
- break;
-
- case cf2_cmdRLINECURVE:
- {
- CF2_UInt count = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- FT_TRACE4(( " rlinecurve\n" ));
-
- while ( index + 6 < count )
- {
- curX += cf2_stack_getReal( opStack, index + 0 );
- curY += cf2_stack_getReal( opStack, index + 1 );
-
- cf2_glyphpath_lineTo( &glyphPath, curX, curY );
- index += 2;
- }
-
- while ( index < count )
- {
- CF2_Fixed x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- CF2_Fixed y1 = cf2_stack_getReal( opStack, index + 1 ) + curY;
- CF2_Fixed x2 = cf2_stack_getReal( opStack, index + 2 ) + x1;
- CF2_Fixed y2 = cf2_stack_getReal( opStack, index + 3 ) + y1;
- CF2_Fixed x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
- CF2_Fixed y3 = cf2_stack_getReal( opStack, index + 5 ) + y2;
-
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 6;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdVVCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( " vvcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, y1, x2, y2, x3, y3;
-
-
- if ( ( count - index ) & 1 )
- {
- x1 = cf2_stack_getReal( opStack, index ) + curX;
-
- ++index;
- }
- else
- x1 = curX;
-
- y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = x2;
- y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdHHCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
-
- /* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
- /* we enforce it by clearing the second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( " hhcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, y1, x2, y2, x3, y3;
-
-
- if ( ( count - index ) & 1 )
- {
- y1 = cf2_stack_getReal( opStack, index ) + curY;
-
- ++index;
- }
- else
- y1 = curY;
-
- x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
- y3 = y2;
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdVHCURVETO:
- case cf2_cmdHVCURVETO:
- {
- CF2_UInt count, count1 = cf2_stack_count( opStack );
- CF2_UInt index = 0;
-
- FT_Bool alternate = op1 == cf2_cmdHVCURVETO;
-
-
- /* if `cf2_stack_count' isn't of the form 8n, 8n+1, */
- /* 8n+4, or 8n+5, we enforce it by clearing the */
- /* second bit */
- /* (and sorting the stack indexing to suit) */
- count = count1 & ~2U;
- index += count1 - count;
-
- FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
-
- while ( index < count )
- {
- CF2_Fixed x1, x2, x3, y1, y2, y3;
-
-
- if ( alternate )
- {
- x1 = cf2_stack_getReal( opStack, index + 0 ) + curX;
- y1 = curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- y3 = cf2_stack_getReal( opStack, index + 3 ) + y2;
-
- if ( count - index == 5 )
- {
- x3 = cf2_stack_getReal( opStack, index + 4 ) + x2;
-
- ++index;
- }
- else
- x3 = x2;
-
- alternate = FALSE;
- }
- else
- {
- x1 = curX;
- y1 = cf2_stack_getReal( opStack, index + 0 ) + curY;
- x2 = cf2_stack_getReal( opStack, index + 1 ) + x1;
- y2 = cf2_stack_getReal( opStack, index + 2 ) + y1;
- x3 = cf2_stack_getReal( opStack, index + 3 ) + x2;
-
- if ( count - index == 5 )
- {
- y3 = cf2_stack_getReal( opStack, index + 4 ) + y2;
-
- ++index;
- }
- else
- y3 = y2;
-
- alternate = TRUE;
- }
-
- cf2_glyphpath_curveTo( &glyphPath, x1, y1, x2, y2, x3, y3 );
-
- curX = x3;
- curY = y3;
- index += 4;
- }
-
- cf2_stack_clear( opStack );
- }
- continue; /* no need to clear stack again */
-
- case cf2_cmdEXTENDEDNMBR:
- {
- CF2_Int v;
-
-
- v = (FT_Short)( ( cf2_buf_readByte( charstring ) << 8 ) |
- cf2_buf_readByte( charstring ) );
-
- FT_TRACE4(( " %d", v ));
-
- cf2_stack_pushInt( opStack, v );
- }
- continue;
-
- default:
- /* numbers */
- {
- if ( /* op1 >= 32 && */ op1 <= 246 )
- {
- CF2_Int v;
-
-
- v = op1 - 139;
-
- FT_TRACE4(( " %d", v ));
-
- /* -107 .. 107 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else if ( /* op1 >= 247 && */ op1 <= 250 )
- {
- CF2_Int v;
-
-
- v = op1;
- v -= 247;
- v *= 256;
- v += cf2_buf_readByte( charstring );
- v += 108;
-
- FT_TRACE4(( " %d", v ));
-
- /* 108 .. 1131 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else if ( /* op1 >= 251 && */ op1 <= 254 )
- {
- CF2_Int v;
-
-
- v = op1;
- v -= 251;
- v *= 256;
- v += cf2_buf_readByte( charstring );
- v = -v - 108;
-
- FT_TRACE4(( " %d", v ));
-
- /* -1131 .. -108 */
- cf2_stack_pushInt( opStack, v );
- }
-
- else /* op1 == 255 */
- {
- CF2_Fixed v;
-
-
- v = (CF2_Fixed)
- ( ( (FT_UInt32)cf2_buf_readByte( charstring ) << 24 ) |
- ( (FT_UInt32)cf2_buf_readByte( charstring ) << 16 ) |
- ( (FT_UInt32)cf2_buf_readByte( charstring ) << 8 ) |
- (FT_UInt32)cf2_buf_readByte( charstring ) );
-
- FT_TRACE4(( " %.2f", v / 65536.0 ));
-
- cf2_stack_pushFixed( opStack, v );
- }
- }
- continue; /* don't clear stack */
-
- } /* end of switch statement checking `op1' */
-
- cf2_stack_clear( opStack );
-
- } /* end of main interpreter loop */
-
- /* we get here if the charstring ends without cf2_cmdENDCHAR */
- FT_TRACE4(( "cf2_interpT2CharString:"
- " charstring ends without ENDCHAR\n" ));
-
- exit:
- /* check whether last error seen is also the first one */
- cf2_setError( error, lastError );
-
- /* free resources from objects we've used */
- cf2_glyphpath_finalize( &glyphPath );
- cf2_arrstack_finalize( &vStemHintArray );
- cf2_arrstack_finalize( &hStemHintArray );
- cf2_arrstack_finalize( &subrStack );
- cf2_stack_free( opStack );
-
- FT_TRACE4(( "\n" ));
-
- return;
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2intrp.h b/src/3rdparty/freetype/src/cff/cf2intrp.h
deleted file mode 100644
index b5d8947838..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2intrp.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2font.h */
-/* */
-/* Adobe's CFF Interpreter (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2INTRP_H__
-#define __CF2INTRP_H__
-
-
-#include "cf2ft.h"
-#include "cf2hints.h"
-
-
-FT_BEGIN_HEADER
-
-
- FT_LOCAL( void )
- cf2_hintmask_init( CF2_HintMask hintmask,
- FT_Error* error );
- FT_LOCAL( FT_Bool )
- cf2_hintmask_isValid( const CF2_HintMask hintmask );
- FT_LOCAL( FT_Bool )
- cf2_hintmask_isNew( const CF2_HintMask hintmask );
- FT_LOCAL( void )
- cf2_hintmask_setNew( CF2_HintMask hintmask,
- FT_Bool val );
- FT_LOCAL( FT_Byte* )
- cf2_hintmask_getMaskPtr( CF2_HintMask hintmask );
- FT_LOCAL( void )
- cf2_hintmask_setAll( CF2_HintMask hintmask,
- size_t bitCount );
-
- FT_LOCAL( void )
- cf2_interpT2CharString( CF2_Font font,
- CF2_Buffer charstring,
- CF2_OutlineCallbacks callbacks,
- const FT_Vector* translation,
- FT_Bool doingSeac,
- CF2_Fixed curX,
- CF2_Fixed curY,
- CF2_Fixed* width );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2INTRP_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2read.c b/src/3rdparty/freetype/src/cff/cf2read.c
deleted file mode 100644
index 2b429e3eeb..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2read.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2read.c */
-/* */
-/* Adobe's code for stream handling (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-
-#include "cf2error.h"
-
-
- /* Define CF2_IO_FAIL as 1 to enable random errors and random */
- /* value errors in I/O. */
-#define CF2_IO_FAIL 0
-
-
-#if CF2_IO_FAIL
-
- /* set the .00 value to a nonzero probability */
- static int
- randomError2( void )
- {
- /* for region buffer ReadByte (interp) function */
- return (double)rand() / RAND_MAX < .00;
- }
-
- /* set the .00 value to a nonzero probability */
- static CF2_Int
- randomValue()
- {
- return (double)rand() / RAND_MAX < .00 ? rand() : 0;
- }
-
-#endif /* CF2_IO_FAIL */
-
-
- /* Region Buffer */
- /* */
- /* Can be constructed from a copied buffer managed by */
- /* `FCM_getDatablock'. */
- /* Reads bytes with check for end of buffer. */
-
- /* reading past the end of the buffer sets error and returns zero */
- FT_LOCAL_DEF( CF2_Int )
- cf2_buf_readByte( CF2_Buffer buf )
- {
- if ( buf->ptr < buf->end )
- {
-#if CF2_IO_FAIL
- if ( randomError2() )
- {
- CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
- return 0;
- }
-
- return *(buf->ptr)++ + randomValue();
-#else
- return *(buf->ptr)++;
-#endif
- }
- else
- {
- CF2_SET_ERROR( buf->error, Invalid_Stream_Operation );
- return 0;
- }
- }
-
-
- /* note: end condition can occur without error */
- FT_LOCAL_DEF( FT_Bool )
- cf2_buf_isEnd( CF2_Buffer buf )
- {
- return (FT_Bool)( buf->ptr >= buf->end );
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2read.h b/src/3rdparty/freetype/src/cff/cf2read.h
deleted file mode 100644
index 7ef7c8c149..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2read.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2read.h */
-/* */
-/* Adobe's code for stream handling (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2READ_H__
-#define __CF2READ_H__
-
-
-FT_BEGIN_HEADER
-
-
- typedef struct CF2_BufferRec_
- {
- FT_Error* error;
- const FT_Byte* start;
- const FT_Byte* end;
- const FT_Byte* ptr;
-
- } CF2_BufferRec, *CF2_Buffer;
-
-
- FT_LOCAL( CF2_Int )
- cf2_buf_readByte( CF2_Buffer buf );
- FT_LOCAL( FT_Bool )
- cf2_buf_isEnd( CF2_Buffer buf );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2READ_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2stack.c b/src/3rdparty/freetype/src/cff/cf2stack.c
deleted file mode 100644
index 8332b5d91a..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2stack.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2stack.c */
-/* */
-/* Adobe's code for emulating a CFF stack (body). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#include "cf2ft.h"
-#include FT_INTERNAL_DEBUG_H
-
-#include "cf2glue.h"
-#include "cf2font.h"
-#include "cf2stack.h"
-
-#include "cf2error.h"
-
-
- /* Allocate and initialize an instance of CF2_Stack. */
- /* Note: This function returns NULL on error (does not set */
- /* `error'). */
- FT_LOCAL_DEF( CF2_Stack )
- cf2_stack_init( FT_Memory memory,
- FT_Error* e )
- {
- FT_Error error = FT_Err_Ok; /* for FT_QNEW */
-
- CF2_Stack stack = NULL;
-
-
- if ( !FT_QNEW( stack ) )
- {
- /* initialize the structure; FT_QNEW zeroes it */
- stack->memory = memory;
- stack->error = e;
- stack->top = &stack->buffer[0]; /* empty stack */
- }
-
- return stack;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_free( CF2_Stack stack )
- {
- if ( stack )
- {
- FT_Memory memory = stack->memory;
-
-
- /* free the main structure */
- FT_FREE( stack );
- }
- }
-
-
- FT_LOCAL_DEF( CF2_UInt )
- cf2_stack_count( CF2_Stack stack )
- {
- return (CF2_UInt)( stack->top - &stack->buffer[0] );
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_pushInt( CF2_Stack stack,
- CF2_Int val )
- {
- if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return; /* stack overflow */
- }
-
- stack->top->u.i = val;
- stack->top->type = CF2_NumberInt;
- ++stack->top;
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_pushFixed( CF2_Stack stack,
- CF2_Fixed val )
- {
- if ( stack->top == &stack->buffer[CF2_OPERAND_STACK_SIZE] )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return; /* stack overflow */
- }
-
- stack->top->u.r = val;
- stack->top->type = CF2_NumberFixed;
- ++stack->top;
- }
-
-
- /* this function is only allowed to pop an integer type */
- FT_LOCAL_DEF( CF2_Int )
- cf2_stack_popInt( CF2_Stack stack )
- {
- if ( stack->top == &stack->buffer[0] )
- {
- CF2_SET_ERROR( stack->error, Stack_Underflow );
- return 0; /* underflow */
- }
- if ( stack->top[-1].type != CF2_NumberInt )
- {
- CF2_SET_ERROR( stack->error, Syntax_Error );
- return 0; /* type mismatch */
- }
-
- --stack->top;
-
- return stack->top->u.i;
- }
-
-
- /* Note: type mismatch is silently cast */
- /* TODO: check this */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_stack_popFixed( CF2_Stack stack )
- {
- if ( stack->top == &stack->buffer[0] )
- {
- CF2_SET_ERROR( stack->error, Stack_Underflow );
- return cf2_intToFixed( 0 ); /* underflow */
- }
-
- --stack->top;
-
- switch ( stack->top->type )
- {
- case CF2_NumberInt:
- return cf2_intToFixed( stack->top->u.i );
- case CF2_NumberFrac:
- return cf2_fracToFixed( stack->top->u.f );
- default:
- return stack->top->u.r;
- }
- }
-
-
- /* Note: type mismatch is silently cast */
- /* TODO: check this */
- FT_LOCAL_DEF( CF2_Fixed )
- cf2_stack_getReal( CF2_Stack stack,
- CF2_UInt idx )
- {
- FT_ASSERT( cf2_stack_count( stack ) <= CF2_OPERAND_STACK_SIZE );
-
- if ( idx >= cf2_stack_count( stack ) )
- {
- CF2_SET_ERROR( stack->error, Stack_Overflow );
- return cf2_intToFixed( 0 ); /* bounds error */
- }
-
- switch ( stack->buffer[idx].type )
- {
- case CF2_NumberInt:
- return cf2_intToFixed( stack->buffer[idx].u.i );
- case CF2_NumberFrac:
- return cf2_fracToFixed( stack->buffer[idx].u.f );
- default:
- return stack->buffer[idx].u.r;
- }
- }
-
-
- FT_LOCAL_DEF( void )
- cf2_stack_clear( CF2_Stack stack )
- {
- stack->top = &stack->buffer[0];
- }
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2stack.h b/src/3rdparty/freetype/src/cff/cf2stack.h
deleted file mode 100644
index 7d6d1961fe..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2stack.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2stack.h */
-/* */
-/* Adobe's code for emulating a CFF stack (specification). */
-/* */
-/* Copyright 2007-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2STACK_H__
-#define __CF2STACK_H__
-
-
-FT_BEGIN_HEADER
-
-
- /* CFF operand stack; specified maximum of 48 or 192 values */
- typedef struct CF2_StackNumber_
- {
- union
- {
- CF2_Fixed r; /* 16.16 fixed point */
- CF2_Frac f; /* 2.30 fixed point (for font matrix) */
- CF2_Int i;
- } u;
-
- CF2_NumberType type;
-
- } CF2_StackNumber;
-
-
- typedef struct CF2_StackRec_
- {
- FT_Memory memory;
- FT_Error* error;
- CF2_StackNumber buffer[CF2_OPERAND_STACK_SIZE];
- CF2_StackNumber* top;
-
- } CF2_StackRec, *CF2_Stack;
-
-
- FT_LOCAL( CF2_Stack )
- cf2_stack_init( FT_Memory memory,
- FT_Error* error );
- FT_LOCAL( void )
- cf2_stack_free( CF2_Stack stack );
-
- FT_LOCAL( CF2_UInt )
- cf2_stack_count( CF2_Stack stack );
-
- FT_LOCAL( void )
- cf2_stack_pushInt( CF2_Stack stack,
- CF2_Int val );
- FT_LOCAL( void )
- cf2_stack_pushFixed( CF2_Stack stack,
- CF2_Fixed val );
-
- FT_LOCAL( CF2_Int )
- cf2_stack_popInt( CF2_Stack stack );
- FT_LOCAL( CF2_Fixed )
- cf2_stack_popFixed( CF2_Stack stack );
-
- FT_LOCAL( CF2_Fixed )
- cf2_stack_getReal( CF2_Stack stack,
- CF2_UInt idx );
-
- FT_LOCAL( void )
- cf2_stack_clear( CF2_Stack stack );
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2STACK_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cf2types.h b/src/3rdparty/freetype/src/cff/cf2types.h
deleted file mode 100644
index ac6a02266e..0000000000
--- a/src/3rdparty/freetype/src/cff/cf2types.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/***************************************************************************/
-/* */
-/* cf2types.h */
-/* */
-/* Adobe's code for defining data types (specification only). */
-/* */
-/* Copyright 2011-2013 Adobe Systems Incorporated. */
-/* */
-/* This software, and all works of authorship, whether in source or */
-/* object code form as indicated by the copyright notice(s) included */
-/* herein (collectively, the "Work") is made available, and may only be */
-/* used, modified, and distributed under the FreeType Project License, */
-/* LICENSE.TXT. Additionally, subject to the terms and conditions of the */
-/* FreeType Project License, each contributor to the Work hereby grants */
-/* to any individual or legal entity exercising permissions granted by */
-/* the FreeType Project License and this section (hereafter, "You" or */
-/* "Your") a perpetual, worldwide, non-exclusive, no-charge, */
-/* royalty-free, irrevocable (except as stated in this section) patent */
-/* license to make, have made, use, offer to sell, sell, import, and */
-/* otherwise transfer the Work, where such license applies only to those */
-/* patent claims licensable by such contributor that are necessarily */
-/* infringed by their contribution(s) alone or by combination of their */
-/* contribution(s) with the Work to which such contribution(s) was */
-/* submitted. If You institute patent litigation against any entity */
-/* (including a cross-claim or counterclaim in a lawsuit) alleging that */
-/* the Work or a contribution incorporated within the Work constitutes */
-/* direct or contributory patent infringement, then any patent licenses */
-/* granted to You under this License for that Work shall terminate as of */
-/* the date such litigation is filed. */
-/* */
-/* By using, modifying, or distributing the Work you indicate that you */
-/* have read and understood the terms and conditions of the */
-/* FreeType Project License as well as those provided in this section, */
-/* and you accept them fully. */
-/* */
-/***************************************************************************/
-
-
-#ifndef __CF2TYPES_H__
-#define __CF2TYPES_H__
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-
-FT_BEGIN_HEADER
-
-
- /*
- * The data models that we expect to support are as follows:
- *
- * name char short int long long-long pointer example
- * -----------------------------------------------------
- * ILP32 8 16 32 32 64* 32 32-bit MacOS, x86
- * LLP64 8 16 32 32 64 64 x64
- * LP64 8 16 32 64 64 64 64-bit MacOS
- *
- * *) type may be supported by emulation on a 32-bit architecture
- *
- */
-
-
- /* integers at least 32 bits wide */
-#define CF2_UInt FT_UFast
-#define CF2_Int FT_Fast
-
-
- /* fixed-float numbers */
- typedef FT_Int32 CF2_F16Dot16;
-
-
-FT_END_HEADER
-
-
-#endif /* __CF2TYPES_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cff.c b/src/3rdparty/freetype/src/cff/cff.c
index a34ba9b710..b486c389e1 100644
--- a/src/3rdparty/freetype/src/cff/cff.c
+++ b/src/3rdparty/freetype/src/cff/cff.c
@@ -4,7 +4,7 @@
*
* FreeType OpenType driver component (body only).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -17,7 +17,6 @@
#define FT_MAKE_OPTION_SINGLE_OBJECT
-#include <ft2build.h>
#include "cffcmap.c"
#include "cffdrivr.c"
diff --git a/src/3rdparty/freetype/src/cff/cffcmap.c b/src/3rdparty/freetype/src/cff/cffcmap.c
index 15cc94cafb..10d287bc81 100644
--- a/src/3rdparty/freetype/src/cff/cffcmap.c
+++ b/src/3rdparty/freetype/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (body).
*
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -16,8 +16,7 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
+#include <freetype/internal/ftdebug.h>
#include "cffcmap.h"
#include "cffload.h"
@@ -33,9 +32,10 @@
/*************************************************************************/
FT_CALLBACK_DEF( FT_Error )
- cff_cmap_encoding_init( CFF_CMapStd cmap,
- FT_Pointer pointer )
+ cff_cmap_encoding_init( FT_CMap cmap,
+ FT_Pointer pointer )
{
+ CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Encoding encoding = &cff->encoding;
@@ -43,63 +43,56 @@
FT_UNUSED( pointer );
- cmap->gids = encoding->codes;
+ cffcmap->gids = encoding->codes;
return 0;
}
FT_CALLBACK_DEF( void )
- cff_cmap_encoding_done( CFF_CMapStd cmap )
+ cff_cmap_encoding_done( FT_CMap cmap )
{
- cmap->gids = NULL;
+ CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
+
+
+ cffcmap->gids = NULL;
}
FT_CALLBACK_DEF( FT_UInt )
- cff_cmap_encoding_char_index( CFF_CMapStd cmap,
- FT_UInt32 char_code )
+ cff_cmap_encoding_char_index( FT_CMap cmap,
+ FT_UInt32 char_code )
{
- FT_UInt result = 0;
+ CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
+ FT_UInt result = 0;
if ( char_code < 256 )
- result = cmap->gids[char_code];
+ result = cffcmap->gids[char_code];
return result;
}
- FT_CALLBACK_DEF( FT_UInt32 )
- cff_cmap_encoding_char_next( CFF_CMapStd cmap,
- FT_UInt32 *pchar_code )
+ FT_CALLBACK_DEF( FT_UInt )
+ cff_cmap_encoding_char_next( FT_CMap cmap,
+ FT_UInt32 *pchar_code )
{
- FT_UInt result = 0;
- FT_UInt32 char_code = *pchar_code;
+ CFF_CMapStd cffcmap = (CFF_CMapStd)cmap;
+ FT_UInt result = 0;
+ FT_UInt32 char_code = *pchar_code;
- *pchar_code = 0;
-
- if ( char_code < 255 )
+ while ( char_code < 255 )
{
- FT_UInt code = (FT_UInt)(char_code + 1);
-
-
- for (;;)
+ result = cffcmap->gids[++char_code];
+ if ( result )
{
- if ( code >= 256 )
- break;
-
- result = cmap->gids[code];
- if ( result != 0 )
- {
- *pchar_code = code;
- break;
- }
-
- code++;
+ *pchar_code = char_code;
+ break;
}
}
+
return result;
}
@@ -131,9 +124,10 @@
/*************************************************************************/
FT_CALLBACK_DEF( const char* )
- cff_sid_to_glyph_name( TT_Face face,
+ cff_sid_to_glyph_name( void* face_, /* TT_Face */
FT_UInt idx )
{
+ TT_Face face = (TT_Face)face_;
CFF_Font cff = (CFF_Font)face->extra.data;
CFF_Charset charset = &cff->charset;
FT_UInt sid = charset->sids[idx];
@@ -144,14 +138,15 @@
FT_CALLBACK_DEF( FT_Error )
- cff_cmap_unicode_init( PS_Unicodes unicodes,
+ cff_cmap_unicode_init( FT_CMap cmap, /* PS_Unicodes */
FT_Pointer pointer )
{
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
- CFF_Font cff = (CFF_Font)face->extra.data;
- CFF_Charset charset = &cff->charset;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
+ PS_Unicodes unicodes = (PS_Unicodes)cmap;
+ TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ CFF_Font cff = (CFF_Font)face->extra.data;
+ CFF_Charset charset = &cff->charset;
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
FT_UNUSED( pointer );
@@ -167,17 +162,18 @@
return psnames->unicodes_init( memory,
unicodes,
cff->num_glyphs,
- (PS_GetGlyphNameFunc)&cff_sid_to_glyph_name,
+ &cff_sid_to_glyph_name,
(PS_FreeGlyphNameFunc)NULL,
(FT_Pointer)face );
}
FT_CALLBACK_DEF( void )
- cff_cmap_unicode_done( PS_Unicodes unicodes )
+ cff_cmap_unicode_done( FT_CMap cmap ) /* PS_Unicodes */
{
- FT_Face face = FT_CMAP_FACE( unicodes );
- FT_Memory memory = FT_FACE_MEMORY( face );
+ PS_Unicodes unicodes = (PS_Unicodes)cmap;
+ FT_Face face = FT_CMAP_FACE( cmap );
+ FT_Memory memory = FT_FACE_MEMORY( face );
FT_FREE( unicodes->maps );
@@ -186,25 +182,27 @@
FT_CALLBACK_DEF( FT_UInt )
- cff_cmap_unicode_char_index( PS_Unicodes unicodes,
- FT_UInt32 char_code )
+ cff_cmap_unicode_char_index( FT_CMap cmap, /* PS_Unicodes */
+ FT_UInt32 char_code )
{
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
+ PS_Unicodes unicodes = (PS_Unicodes)cmap;
+ TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
+ CFF_Font cff = (CFF_Font)face->extra.data;
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
return psnames->unicodes_char_index( unicodes, char_code );
}
- FT_CALLBACK_DEF( FT_UInt32 )
- cff_cmap_unicode_char_next( PS_Unicodes unicodes,
- FT_UInt32 *pchar_code )
+ FT_CALLBACK_DEF( FT_UInt )
+ cff_cmap_unicode_char_next( FT_CMap cmap, /* PS_Unicodes */
+ FT_UInt32 *pchar_code )
{
- TT_Face face = (TT_Face)FT_CMAP_FACE( unicodes );
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
+ PS_Unicodes unicodes = (PS_Unicodes)cmap;
+ TT_Face face = (TT_Face)FT_CMAP_FACE( cmap );
+ CFF_Font cff = (CFF_Font)face->extra.data;
+ FT_Service_PsCMaps psnames = (FT_Service_PsCMaps)cff->psnames;
return psnames->unicodes_char_next( unicodes, pchar_code );
diff --git a/src/3rdparty/freetype/src/cff/cffcmap.h b/src/3rdparty/freetype/src/cff/cffcmap.h
index 07366bc748..b2afc2fab6 100644
--- a/src/3rdparty/freetype/src/cff/cffcmap.h
+++ b/src/3rdparty/freetype/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
*
* CFF character mapping table (cmap) support (specification).
*
- * Copyright (C) 2002-2019 by
+ * Copyright (C) 2002-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -19,7 +19,7 @@
#ifndef CFFCMAP_H_
#define CFFCMAP_H_
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
FT_BEGIN_HEADER
@@ -43,7 +43,7 @@ FT_BEGIN_HEADER
} CFF_CMapStdRec;
- FT_DECLARE_CMAP_CLASS(cff_cmap_encoding_class_rec)
+ FT_DECLARE_CMAP_CLASS( cff_cmap_encoding_class_rec )
/*************************************************************************/
@@ -56,7 +56,7 @@ FT_BEGIN_HEADER
/* unicode (synthetic) cmaps */
- FT_DECLARE_CMAP_CLASS(cff_cmap_unicode_class_rec)
+ FT_DECLARE_CMAP_CLASS( cff_cmap_unicode_class_rec )
FT_END_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.c b/src/3rdparty/freetype/src/cff/cffdrivr.c
index 2324989811..9898d625ca 100644
--- a/src/3rdparty/freetype/src/cff/cffdrivr.c
+++ b/src/3rdparty/freetype/src/cff/cffdrivr.c
@@ -4,8 +4,8 @@
*
* OpenType font driver implementation (body).
*
- * Copyright (C) 1996-2019 by
- * David Turner, Robert Wilhelm, and Werner Lemberg.
+ * Copyright (C) 1996-2023 by
+ * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
*
* This file is part of the FreeType project, and may only be used,
* modified, and distributed under the terms of the FreeType project
@@ -16,18 +16,17 @@
*/
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_INTERNAL_POSTSCRIPT_PROPS_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/freetype.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/ftpsprop.h>
+#include <freetype/internal/services/svcid.h>
+#include <freetype/internal/services/svpsinfo.h>
+#include <freetype/internal/services/svpostnm.h>
+#include <freetype/internal/services/svttcmap.h>
+#include <freetype/internal/services/svcfftl.h>
#include "cffdrivr.h"
#include "cffgload.h"
@@ -37,16 +36,16 @@
#include "cffobjs.h"
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
#include "cfferrs.h"
-#include FT_SERVICE_FONT_FORMAT_H
-#include FT_SERVICE_GLYPH_DICT_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_DRIVER_H
+#include <freetype/internal/services/svfntfmt.h>
+#include <freetype/internal/services/svgldict.h>
+#include <freetype/internal/services/svprop.h>
+#include <freetype/ftdriver.h>
/**************************************************************************
@@ -109,20 +108,20 @@
* They can be implemented by format-specific interfaces.
*/
FT_CALLBACK_DEF( FT_Error )
- cff_get_kerning( FT_Face ttface, /* TT_Face */
+ cff_get_kerning( FT_Face face, /* CFF_Face */
FT_UInt left_glyph,
FT_UInt right_glyph,
FT_Vector* kerning )
{
- TT_Face face = (TT_Face)ttface;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ CFF_Face cffface = (CFF_Face)face;
+ SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
kerning->x = 0;
kerning->y = 0;
if ( sfnt )
- kerning->x = sfnt->get_kerning( face, left_glyph, right_glyph );
+ kerning->x = sfnt->get_kerning( cffface, left_glyph, right_glyph );
return FT_Err_Ok;
}
@@ -159,23 +158,23 @@
* FreeType error code. 0 means success.
*/
FT_CALLBACK_DEF( FT_Error )
- cff_glyph_load( FT_GlyphSlot cffslot, /* CFF_GlyphSlot */
- FT_Size cffsize, /* CFF_Size */
+ cff_glyph_load( FT_GlyphSlot slot, /* CFF_GlyphSlot */
+ FT_Size size, /* CFF_Size */
FT_UInt glyph_index,
FT_Int32 load_flags )
{
FT_Error error;
- CFF_GlyphSlot slot = (CFF_GlyphSlot)cffslot;
- CFF_Size size = (CFF_Size)cffsize;
+ CFF_GlyphSlot cffslot = (CFF_GlyphSlot)slot;
+ CFF_Size cffsize = (CFF_Size)size;
- if ( !slot )
+ if ( !cffslot )
return FT_THROW( Invalid_Slot_Handle );
FT_TRACE1(( "cff_glyph_load: glyph index %d\n", glyph_index ));
/* check whether we want a scaled outline or bitmap */
- if ( !size )
+ if ( !cffsize )
load_flags |= FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING;
/* reset the size object if necessary */
@@ -185,12 +184,12 @@
if ( size )
{
/* these two objects must have the same parent */
- if ( cffsize->face != cffslot->face )
+ if ( size->face != slot->face )
return FT_THROW( Invalid_Face_Handle );
}
/* now load the glyph outline if necessary */
- error = cff_slot_load( slot, size, glyph_index, load_flags );
+ error = cff_slot_load( cffslot, cffsize, glyph_index, load_flags );
/* force drop-out mode to 2 - irrelevant now */
/* slot->outline.dropout_mode = 2; */
@@ -217,7 +216,7 @@
/* it is no longer necessary that those values are identical to */
/* the values in the `CFF' table */
- TT_Face ttface = (TT_Face)face;
+ CFF_Face cffface = (CFF_Face)face;
FT_Short dummy;
@@ -226,7 +225,7 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without VVAR table */
if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
- !( ttface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
+ !( cffface->variation_support & TT_FACE_FLAG_VAR_VADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
@@ -234,7 +233,7 @@
/* otherwise we extract the info from the CFF glyphstrings */
/* (instead of synthesizing a global value using the `OS/2' */
/* table) */
- if ( !ttface->vertical_info )
+ if ( !cffface->vertical_info )
goto Missing_Table;
for ( nn = 0; nn < count; nn++ )
@@ -242,11 +241,11 @@
FT_UShort ah;
- ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
- 1,
- start + nn,
- &dummy,
- &ah );
+ ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
+ 1,
+ start + nn,
+ &dummy,
+ &ah );
FT_TRACE5(( " idx %d: advance height %d font unit%s\n",
start + nn,
@@ -260,12 +259,12 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
/* no fast retrieval for blended MM fonts without HVAR table */
if ( ( FT_IS_NAMED_INSTANCE( face ) || FT_IS_VARIATION( face ) ) &&
- !( ttface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
+ !( cffface->variation_support & TT_FACE_FLAG_VAR_HADVANCE ) )
return FT_THROW( Unimplemented_Feature );
#endif
/* check whether we have data from the `hmtx' table at all */
- if ( !ttface->horizontal.number_Of_HMetrics )
+ if ( !cffface->horizontal.number_Of_HMetrics )
goto Missing_Table;
for ( nn = 0; nn < count; nn++ )
@@ -273,11 +272,11 @@
FT_UShort aw;
- ( (SFNT_Service)ttface->sfnt )->get_metrics( ttface,
- 0,
- start + nn,
- &dummy,
- &aw );
+ ( (SFNT_Service)cffface->sfnt )->get_metrics( cffface,
+ 0,
+ start + nn,
+ &dummy,
+ &aw );
FT_TRACE5(( " idx %d: advance width %d font unit%s\n",
start + nn,
@@ -313,13 +312,14 @@
*
*/
- static FT_Error
- cff_get_glyph_name( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_glyph_name( FT_Face face, /* CFF_Face */
FT_UInt glyph_index,
FT_Pointer buffer,
FT_UInt buffer_max )
{
- CFF_Font font = (CFF_Font)face->extra.data;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font font = (CFF_Font)cffface->extra.data;
FT_String* gname;
FT_UShort sid;
FT_Error error;
@@ -339,15 +339,12 @@
if ( service && service->get_name )
- return service->get_name( FT_FACE( face ),
- glyph_index,
- buffer,
- buffer_max );
+ return service->get_name( face, glyph_index, buffer, buffer_max );
else
{
FT_ERROR(( "cff_get_glyph_name:"
- " cannot get glyph name from a CFF2 font\n"
- " "
+ " cannot get glyph name from a CFF2 font\n" ));
+ FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -357,8 +354,8 @@
if ( !font->psnames )
{
FT_ERROR(( "cff_get_glyph_name:"
- " cannot get glyph name from CFF & CEF fonts\n"
- " "
+ " cannot get glyph name from CFF & CEF fonts\n" ));
+ FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -367,7 +364,7 @@
/* first, locate the sid in the charset table */
sid = font->charset.sids[glyph_index];
- /* now, lookup the name itself */
+ /* now, look up the name itself */
gname = cff_index_get_sid_string( font, sid );
if ( gname )
@@ -380,21 +377,19 @@
}
- static FT_UInt
- cff_get_name_index( CFF_Face face,
+ FT_CALLBACK_DEF( FT_UInt )
+ cff_get_name_index( FT_Face face, /* CFF_Face */
const FT_String* glyph_name )
{
- CFF_Font cff;
- CFF_Charset charset;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
+ CFF_Charset charset = &cff->charset;
FT_Service_PsCMaps psnames;
FT_String* name;
FT_UShort sid;
FT_UInt i;
- cff = (CFF_FontRec *)face->extra.data;
- charset = &cff->charset;
-
/* CFF2 table does not have glyph names; */
/* we need to use `post' table method */
if ( cff->version_major == 2 )
@@ -409,12 +404,12 @@
if ( service && service->name_index )
- return service->name_index( FT_FACE( face ), glyph_name );
+ return service->name_index( face, glyph_name );
else
{
FT_ERROR(( "cff_get_name_index:"
- " cannot get glyph index from a CFF2 font\n"
- " "
+ " cannot get glyph index from a CFF2 font\n" ));
+ FT_ERROR(( " "
" without the `psnames' module\n" ));
return 0;
}
@@ -447,8 +442,8 @@
FT_DEFINE_SERVICE_GLYPHDICTREC(
cff_service_glyph_dict,
- (FT_GlyphDict_GetNameFunc) cff_get_glyph_name, /* get_name */
- (FT_GlyphDict_NameIndexFunc)cff_get_name_index /* name_index */
+ cff_get_glyph_name, /* FT_GlyphDict_GetNameFunc get_name */
+ cff_get_name_index /* FT_GlyphDict_NameIndexFunc name_index */
)
@@ -457,29 +452,36 @@
*
*/
- static FT_Int
+ FT_CALLBACK_DEF( FT_Int )
cff_ps_has_glyph_names( FT_Face face )
{
return ( face->face_flags & FT_FACE_FLAG_GLYPH_NAMES ) > 0;
}
- static FT_Error
- cff_ps_get_font_info( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_ps_get_font_info( FT_Face face, /* CFF_Face */
PS_FontInfoRec* afont_info )
{
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Error error = FT_Err_Ok;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
+ FT_Error error = FT_Err_Ok;
+ if ( cffface->is_cff2 )
+ {
+ error = FT_THROW( Invalid_Argument );
+ goto Fail;
+ }
+
if ( cff && !cff->font_info )
{
CFF_FontRecDict dict = &cff->top_font.font_dict;
- PS_FontInfoRec *font_info = NULL;
- FT_Memory memory = face->root.memory;
+ FT_Memory memory = FT_FACE_MEMORY( face );
+ PS_FontInfoRec* font_info = NULL;
- if ( FT_ALLOC( font_info, sizeof ( *font_info ) ) )
+ if ( FT_QNEW( font_info ) )
goto Fail;
font_info->version = cff_index_get_sid_string( cff,
@@ -508,23 +510,24 @@
}
- static FT_Error
- cff_ps_get_font_extra( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_ps_get_font_extra( FT_Face face, /* CFF_Face */
PS_FontExtraRec* afont_extra )
{
- CFF_Font cff = (CFF_Font)face->extra.data;
- FT_Error error = FT_Err_Ok;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
+ FT_Error error = FT_Err_Ok;
- if ( cff && cff->font_extra == NULL )
+ if ( cff && !cff->font_extra )
{
CFF_FontRecDict dict = &cff->top_font.font_dict;
+ FT_Memory memory = FT_FACE_MEMORY( face );
PS_FontExtraRec* font_extra = NULL;
- FT_Memory memory = face->root.memory;
FT_String* embedded_postscript;
- if ( FT_ALLOC( font_extra, sizeof ( *font_extra ) ) )
+ if ( FT_QNEW( font_extra ) )
goto Fail;
font_extra->fs_type = 0U;
@@ -589,13 +592,13 @@
FT_DEFINE_SERVICE_PSINFOREC(
cff_service_ps_info,
- (PS_GetFontInfoFunc) cff_ps_get_font_info, /* ps_get_font_info */
- (PS_GetFontExtraFunc) cff_ps_get_font_extra, /* ps_get_font_extra */
- (PS_HasGlyphNamesFunc) cff_ps_has_glyph_names, /* ps_has_glyph_names */
+ cff_ps_get_font_info, /* PS_GetFontInfoFunc ps_get_font_info */
+ cff_ps_get_font_extra, /* PS_GetFontExtraFunc ps_get_font_extra */
+ cff_ps_has_glyph_names, /* PS_HasGlyphNamesFunc ps_has_glyph_names */
/* unsupported with CFF fonts */
- (PS_GetFontPrivateFunc)NULL, /* ps_get_font_private */
+ NULL, /* PS_GetFontPrivateFunc ps_get_font_private */
/* not implemented */
- (PS_GetFontValueFunc) NULL /* ps_get_font_value */
+ NULL /* PS_GetFontValueFunc ps_get_font_value */
)
@@ -604,17 +607,18 @@
*
*/
- static const char*
- cff_get_ps_name( CFF_Face face )
+ FT_CALLBACK_DEF( const char* )
+ cff_get_ps_name( FT_Face face ) /* CFF_Face */
{
- CFF_Font cff = (CFF_Font)face->extra.data;
- SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
+ SFNT_Service sfnt = (SFNT_Service)cffface->sfnt;
/* following the OpenType specification 1.7, we return the name stored */
/* in the `name' table for a CFF wrapped into an SFNT container */
- if ( FT_IS_SFNT( FT_FACE( face ) ) && sfnt )
+ if ( FT_IS_SFNT( face ) && sfnt )
{
FT_Library library = FT_FACE_LIBRARY( face );
FT_Module sfnt_module = FT_Get_Module( library, "sfnt" );
@@ -626,17 +630,17 @@
if ( service && service->get_ps_font_name )
- return service->get_ps_font_name( FT_FACE( face ) );
+ return service->get_ps_font_name( face );
}
- return (const char*)cff->font_name;
+ return cff ? (const char*)cff->font_name : NULL;
}
FT_DEFINE_SERVICE_PSFONTNAMEREC(
cff_service_ps_name,
- (FT_PsName_GetFunc)cff_get_ps_name /* get_ps_font_name */
+ cff_get_ps_name /* FT_PsName_GetFunc get_ps_font_name */
)
@@ -650,7 +654,7 @@
* Otherwise call the service function in the sfnt module.
*
*/
- static FT_Error
+ FT_CALLBACK_DEF( FT_Error )
cff_get_cmap_info( FT_CharMap charmap,
TT_CMapInfo *cmap_info )
{
@@ -684,7 +688,7 @@
FT_DEFINE_SERVICE_TTCMAPSREC(
cff_service_get_cmap_info,
- (TT_CMap_Info_GetFunc)cff_get_cmap_info /* get_cmap_info */
+ cff_get_cmap_info /* TT_CMap_Info_GetFunc get_cmap_info */
)
@@ -692,14 +696,15 @@
* CID INFO SERVICE
*
*/
- static FT_Error
- cff_get_ros( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_ros( FT_Face face, /* FT_Face */
const char* *registry,
const char* *ordering,
FT_Int *supplement )
{
- FT_Error error = FT_Err_Ok;
- CFF_Font cff = (CFF_Font)face->extra.data;
+ FT_Error error = FT_Err_Ok;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
if ( cff )
@@ -738,7 +743,7 @@
{
if ( dict->cid_supplement < FT_INT_MIN ||
dict->cid_supplement > FT_INT_MAX )
- FT_TRACE1(( "cff_get_ros: too large supplement %d is truncated\n",
+ FT_TRACE1(( "cff_get_ros: too large supplement %ld is truncated\n",
dict->cid_supplement ));
*supplement = (FT_Int)dict->cid_supplement;
}
@@ -749,12 +754,13 @@
}
- static FT_Error
- cff_get_is_cid( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_is_cid( FT_Face face, /* CFF_Face */
FT_Bool *is_cid )
{
- FT_Error error = FT_Err_Ok;
- CFF_Font cff = (CFF_Font)face->extra.data;
+ FT_Error error = FT_Err_Ok;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
*is_cid = 0;
@@ -772,17 +778,16 @@
}
- static FT_Error
- cff_get_cid_from_glyph_index( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_cid_from_glyph_index( FT_Face face, /* CFF_Face */
FT_UInt glyph_index,
FT_UInt *cid )
{
- FT_Error error = FT_Err_Ok;
- CFF_Font cff;
+ FT_Error error = FT_Err_Ok;
+ CFF_Face cffface = (CFF_Face)face;
+ CFF_Font cff = (CFF_Font)cffface->extra.data;
- cff = (CFF_Font)face->extra.data;
-
if ( cff )
{
FT_UInt c;
@@ -815,12 +820,12 @@
FT_DEFINE_SERVICE_CIDREC(
cff_service_cid_info,
- (FT_CID_GetRegistryOrderingSupplementFunc)
- cff_get_ros, /* get_ros */
- (FT_CID_GetIsInternallyCIDKeyedFunc)
- cff_get_is_cid, /* get_is_cid */
- (FT_CID_GetCIDFromGlyphIndexFunc)
- cff_get_cid_from_glyph_index /* get_cid_from_glyph_index */
+ cff_get_ros,
+ /* FT_CID_GetRegistryOrderingSupplementFunc get_ros */
+ cff_get_is_cid,
+ /* FT_CID_GetIsInternallyCIDKeyedFunc get_is_cid */
+ cff_get_cid_from_glyph_index
+ /* FT_CID_GetCIDFromGlyphIndexFunc get_cid_from_glyph_index */
)
@@ -832,9 +837,9 @@
FT_DEFINE_SERVICE_PROPERTIESREC(
cff_service_properties,
- (FT_Properties_SetFunc)ps_property_set, /* set_property */
- (FT_Properties_GetFunc)ps_property_get ) /* get_property */
-
+ ps_property_set, /* FT_Properties_SetFunc set_property */
+ ps_property_get /* FT_Properties_GetFunc get_property */
+ )
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -843,116 +848,231 @@
*
*/
- static FT_Error
- cff_set_mm_blend( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_set_mm_blend( FT_Face face, /* CFF_Face */
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->set_mm_blend( FT_FACE( face ), num_coords, coords );
+ return mm->set_mm_blend( face, num_coords, coords );
}
- static FT_Error
- cff_get_mm_blend( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_mm_blend( FT_Face face, /* CFF_Face */
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->get_mm_blend( FT_FACE( face ), num_coords, coords );
+ return mm->get_mm_blend( face, num_coords, coords );
}
- static FT_Error
- cff_set_mm_weightvector( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_set_mm_weightvector( FT_Face face, /* CFF_Face */
FT_UInt len,
FT_Fixed* weightvector )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->set_mm_weightvector( FT_FACE( face ), len, weightvector );
+ return mm->set_mm_weightvector( face, len, weightvector );
}
- static FT_Error
- cff_get_mm_weightvector( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_mm_weightvector( FT_Face face, /* CFF_Face */
FT_UInt* len,
FT_Fixed* weightvector )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->get_mm_weightvector( FT_FACE( face ), len, weightvector );
+ return mm->get_mm_weightvector( face, len, weightvector );
}
- static FT_Error
- cff_get_mm_var( CFF_Face face,
+ FT_CALLBACK_DEF( void )
+ cff_construct_ps_name( FT_Face face ) /* CFF_Face */
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ mm->construct_ps_name( face );
+ }
+
+
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_mm_var( FT_Face face, /* CFF_Face */
FT_MM_Var* *master )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->get_mm_var( FT_FACE( face ), master );
+ return mm->get_mm_var( face, master );
}
- static FT_Error
- cff_set_var_design( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_set_var_design( FT_Face face, /* CFF_Face */
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->set_var_design( FT_FACE( face ), num_coords, coords );
+ return mm->set_var_design( face, num_coords, coords );
}
- static FT_Error
- cff_get_var_design( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_var_design( FT_Face face, /* CFF_Face */
FT_UInt num_coords,
FT_Fixed* coords )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ return mm->get_var_design( face, num_coords, coords );
+ }
+
+
+ FT_CALLBACK_DEF( FT_Error )
+ cff_set_named_instance( FT_Face face, /* CFF_Face */
+ FT_UInt instance_index )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ return mm->set_named_instance( face, instance_index );
+ }
+
+
+ FT_CALLBACK_DEF( FT_Error )
+ cff_get_default_named_instance( FT_Face face, /* CFF_Face */
+ FT_UInt *instance_index )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->get_var_design( FT_FACE( face ), num_coords, coords );
+ return mm->get_default_named_instance( face, instance_index );
}
- static FT_Error
- cff_set_instance( CFF_Face face,
- FT_UInt instance_index )
+ FT_CALLBACK_DEF( FT_Error )
+ cff_load_item_variation_store( FT_Face face, /* CFF_Face */
+ FT_ULong offset,
+ GX_ItemVarStore itemStore )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->set_instance( FT_FACE( face ), instance_index );
+ return mm->load_item_var_store( face, offset, itemStore );
}
+ FT_CALLBACK_DEF( FT_Error )
+ cff_load_delta_set_index_mapping( FT_Face face, /* CFF_Face */
+ FT_ULong offset,
+ GX_DeltaSetIdxMap map,
+ GX_ItemVarStore itemStore,
+ FT_ULong table_len )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ return mm->load_delta_set_idx_map( face, offset, map,
+ itemStore, table_len );
+ }
+
+
+ FT_CALLBACK_DEF( FT_Int )
+ cff_get_item_delta( FT_Face face, /* CFF_Face */
+ GX_ItemVarStore itemStore,
+ FT_UInt outerIndex,
+ FT_UInt innerIndex )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ return mm->get_item_delta( face, itemStore, outerIndex, innerIndex );
+ }
+
+
+ FT_CALLBACK_DEF( void )
+ cff_done_item_variation_store( FT_Face face, /* CFF_Face */
+ GX_ItemVarStore itemStore )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ mm->done_item_var_store( face, itemStore );
+ }
+
+
+ FT_CALLBACK_DEF( void )
+ cff_done_delta_set_index_map( FT_Face face, /* CFF_Face */
+ GX_DeltaSetIdxMap deltaSetIdxMap )
+ {
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
+
+
+ mm->done_delta_set_idx_map( face, deltaSetIdxMap );
+ }
+
+
+
FT_DEFINE_SERVICE_MULTIMASTERSREC(
cff_service_multi_masters,
- (FT_Get_MM_Func) NULL, /* get_mm */
- (FT_Set_MM_Design_Func) NULL, /* set_mm_design */
- (FT_Set_MM_Blend_Func) cff_set_mm_blend, /* set_mm_blend */
- (FT_Get_MM_Blend_Func) cff_get_mm_blend, /* get_mm_blend */
- (FT_Get_MM_Var_Func) cff_get_mm_var, /* get_mm_var */
- (FT_Set_Var_Design_Func) cff_set_var_design, /* set_var_design */
- (FT_Get_Var_Design_Func) cff_get_var_design, /* get_var_design */
- (FT_Set_Instance_Func) cff_set_instance, /* set_instance */
- (FT_Set_MM_WeightVector_Func)cff_set_mm_weightvector, /* set_mm_weightvector */
- (FT_Get_MM_WeightVector_Func)cff_get_mm_weightvector, /* get_mm_weightvector */
-
- (FT_Get_Var_Blend_Func) cff_get_var_blend, /* get_var_blend */
- (FT_Done_Blend_Func) cff_done_blend /* done_blend */
+ NULL, /* FT_Get_MM_Func get_mm */
+ NULL, /* FT_Set_MM_Design_Func set_mm_design */
+ cff_set_mm_blend, /* FT_Set_MM_Blend_Func set_mm_blend */
+ cff_get_mm_blend, /* FT_Get_MM_Blend_Func get_mm_blend */
+ cff_get_mm_var, /* FT_Get_MM_Var_Func get_mm_var */
+ cff_set_var_design, /* FT_Set_Var_Design_Func set_var_design */
+ cff_get_var_design, /* FT_Get_Var_Design_Func get_var_design */
+ cff_set_named_instance,
+ /* FT_Set_Named_Instance_Func set_named_instance */
+ cff_get_default_named_instance,
+ /* FT_Get_Default_Named_Instance_Func get_default_named_instance */
+ cff_set_mm_weightvector,
+ /* FT_Set_MM_WeightVector_Func set_mm_weightvector */
+ cff_get_mm_weightvector,
+ /* FT_Get_MM_WeightVector_Func get_mm_weightvector */
+ cff_construct_ps_name,
+ /* FT_Construct_PS_Name_Func construct_ps_name */
+ cff_load_delta_set_index_mapping,
+ /* FT_Var_Load_Delta_Set_Idx_Map_Func load_delta_set_idx_map */
+ cff_load_item_variation_store,
+ /* FT_Var_Load_Item_Var_Store_Func load_item_variation_store */
+ cff_get_item_delta,
+ /* FT_Var_Get_Item_Delta_Func get_item_delta */
+ cff_done_item_variation_store,
+ /* FT_Var_Done_Item_Var_Store_Func done_item_variation_store */
+ cff_done_delta_set_index_map,
+ /* FT_Var_Done_Delta_Set_Idx_Map_Func done_delta_set_index_map */
+ cff_get_var_blend, /* FT_Get_Var_Blend_Func get_var_blend */
+ cff_done_blend /* FT_Done_Blend_Func done_blend */
)
@@ -961,41 +1081,46 @@
*
*/
- static FT_Error
- cff_hadvance_adjust( CFF_Face face,
+ FT_CALLBACK_DEF( FT_Error )
+ cff_hadvance_adjust( FT_Face face, /* CFF_Face */
FT_UInt gindex,
FT_Int *avalue )
{
- FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MetricsVariations
+ var = (FT_Service_MetricsVariations)cffface->tt_var;
- return var->hadvance_adjust( FT_FACE( face ), gindex, avalue );
+ return var->hadvance_adjust( face, gindex, avalue );
}
- static void
- cff_metrics_adjust( CFF_Face face )
+ FT_CALLBACK_DEF( void )
+ cff_metrics_adjust( FT_Face face ) /* CFF_Face */
{
- FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MetricsVariations
+ var = (FT_Service_MetricsVariations)cffface->tt_var;
- var->metrics_adjust( FT_FACE( face ) );
+ var->metrics_adjust( face );
}
FT_DEFINE_SERVICE_METRICSVARIATIONSREC(
cff_service_metrics_variations,
- (FT_HAdvance_Adjust_Func)cff_hadvance_adjust, /* hadvance_adjust */
- (FT_LSB_Adjust_Func) NULL, /* lsb_adjust */
- (FT_RSB_Adjust_Func) NULL, /* rsb_adjust */
+ cff_hadvance_adjust, /* FT_HAdvance_Adjust_Func hadvance_adjust */
+ NULL, /* FT_LSB_Adjust_Func lsb_adjust */
+ NULL, /* FT_RSB_Adjust_Func rsb_adjust */
- (FT_VAdvance_Adjust_Func)NULL, /* vadvance_adjust */
- (FT_TSB_Adjust_Func) NULL, /* tsb_adjust */
- (FT_BSB_Adjust_Func) NULL, /* bsb_adjust */
- (FT_VOrg_Adjust_Func) NULL, /* vorg_adjust */
+ NULL, /* FT_VAdvance_Adjust_Func vadvance_adjust */
+ NULL, /* FT_TSB_Adjust_Func tsb_adjust */
+ NULL, /* FT_BSB_Adjust_Func bsb_adjust */
+ NULL, /* FT_VOrg_Adjust_Func vorg_adjust */
- (FT_Metrics_Adjust_Func) cff_metrics_adjust /* metrics_adjust */
+ cff_metrics_adjust, /* FT_Metrics_Adjust_Func metrics_adjust */
+ NULL /* FT_Size_Reset_Func size_reset */
)
#endif
@@ -1008,11 +1133,11 @@
FT_DEFINE_SERVICE_CFFLOADREC(
cff_service_cff_load,
- (FT_Get_Standard_Encoding_Func)cff_get_standard_encoding,
- (FT_Load_Private_Dict_Func) cff_load_private_dict,
- (FT_FD_Select_Get_Func) cff_fd_select_get,
- (FT_Blend_Check_Vector_Func) cff_blend_check_vector,
- (FT_Blend_Build_Vector_Func) cff_blend_build_vector
+ cff_get_standard_encoding, /* FT_Get_Standard_Encoding_Func get_standard_encoding */
+ cff_load_private_dict, /* FT_Load_Private_Dict_Func load_private_dict */
+ cff_fd_select_get, /* FT_FD_Select_Get_Func fd_select_get */
+ cff_blend_check_vector, /* FT_Blend_Check_Vector_Func blend_check_vector */
+ cff_blend_build_vector /* FT_Blend_Build_Vector_Func blend_build_vector */
)
@@ -1028,8 +1153,7 @@
/*************************************************************************/
/*************************************************************************/
-#if !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES && \
- defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
+#if defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_DEFINE_SERVICEDESCREC10(
cff_services,
@@ -1044,7 +1168,7 @@
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
-#elif !defined FT_CONFIG_OPTION_NO_GLYPH_NAMES
+#else
FT_DEFINE_SERVICEDESCREC8(
cff_services,
@@ -1057,32 +1181,6 @@
FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
)
-#elif defined TT_CONFIG_OPTION_GX_VAR_SUPPORT
- FT_DEFINE_SERVICEDESCREC9(
- cff_services,
-
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
- FT_SERVICE_ID_MULTI_MASTERS, &cff_service_multi_masters,
- FT_SERVICE_ID_METRICS_VARIATIONS, &cff_service_metrics_var,
- FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
- FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info,
- FT_SERVICE_ID_CID, &cff_service_cid_info,
- FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
- FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
- )
-#else
- FT_DEFINE_SERVICEDESCREC7(
- cff_services,
-
- FT_SERVICE_ID_FONT_FORMAT, FT_FONT_FORMAT_CFF,
- FT_SERVICE_ID_POSTSCRIPT_INFO, &cff_service_ps_info,
- FT_SERVICE_ID_POSTSCRIPT_FONT_NAME, &cff_service_ps_name,
- FT_SERVICE_ID_TT_CMAP, &cff_service_get_cmap_info,
- FT_SERVICE_ID_CID, &cff_service_cid_info,
- FT_SERVICE_ID_PROPERTIES, &cff_service_properties,
- FT_SERVICE_ID_CFF_LOAD, &cff_service_cff_load
- )
#endif
diff --git a/src/3rdparty/freetype/src/cff/cffdrivr.h b/src/3rdparty/freetype/src/cff/cffdrivr.h
index f2bbcfe4f1..ab1f147bb2 100644
--- a/src/3rdparty/freetype/src/cff/cffdrivr.h
+++ b/src/3rdparty/freetype/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
*
* High-level OpenType driver interface (specification).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,8 +20,7 @@
#define CFFDRIVER_H_
-#include <ft2build.h>
-#include FT_INTERNAL_DRIVER_H
+#include <freetype/internal/ftdrv.h>
FT_BEGIN_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cfferrs.h b/src/3rdparty/freetype/src/cff/cfferrs.h
index 78d47a156d..bc9a3043fc 100644
--- a/src/3rdparty/freetype/src/cff/cfferrs.h
+++ b/src/3rdparty/freetype/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
*
* CFF error codes (specification only).
*
- * Copyright (C) 2001-2019 by
+ * Copyright (C) 2001-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -25,7 +25,7 @@
#ifndef CFFERRS_H_
#define CFFERRS_H_
-#include FT_MODULE_ERRORS_H
+#include <freetype/ftmoderr.h>
#undef FTERRORS_H_
@@ -34,7 +34,7 @@
#define FT_ERR_BASE FT_Mod_Err_CFF
-#include FT_ERRORS_H
+#include <freetype/fterrors.h>
#endif /* CFFERRS_H_ */
diff --git a/src/3rdparty/freetype/src/cff/cffgload.c b/src/3rdparty/freetype/src/cff/cffgload.c
index 36aa7d1b9c..c483d1d1a5 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.c
+++ b/src/3rdparty/freetype/src/cff/cffgload.c
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (body).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -16,20 +16,27 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_SFNT_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_OUTLINE_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftoutln.h>
+#include <freetype/ftdriver.h>
#include "cffload.h"
#include "cffgload.h"
#include "cfferrs.h"
+#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
+#define IS_DEFAULT_INSTANCE( _face ) \
+ ( !( FT_IS_NAMED_INSTANCE( _face ) || \
+ FT_IS_VARIATION( _face ) ) )
+#else
+#define IS_DEFAULT_INSTANCE( _face ) 1
+#endif
+
/**************************************************************************
*
@@ -60,7 +67,7 @@
*pointer = (FT_Byte*)data.pointer;
- *length = (FT_ULong)data.length;
+ *length = data.length;
return error;
}
@@ -68,7 +75,7 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
- CFF_Font cff = (CFF_Font)(face->extra.data);
+ CFF_Font cff = (CFF_Font)( face->extra.data );
return cff_index_access_element( &cff->charstrings_index, glyph_index,
@@ -95,7 +102,7 @@
data.pointer = *pointer;
- data.length = (FT_Int)length;
+ data.length = (FT_UInt)length;
face->root.internal->incremental_interface->funcs->free_glyph_data(
face->root.internal->incremental_interface->object, &data );
@@ -104,7 +111,7 @@
#endif /* FT_CONFIG_OPTION_INCREMENTAL */
{
- CFF_Font cff = (CFF_Font)(face->extra.data);
+ CFF_Font cff = (CFF_Font)( face->extra.data );
cff_index_forget_element( &cff->charstrings_index, pointer );
@@ -207,8 +214,8 @@
PSAux_Service psaux = (PSAux_Service)face->psaux;
const CFF_Decoder_Funcs decoder_funcs = psaux->cff_decoder_funcs;
- FT_Matrix font_matrix;
- FT_Vector font_offset;
+ FT_Matrix font_matrix;
+ FT_Vector font_offset;
force_scaling = FALSE;
@@ -256,8 +263,8 @@
if ( size->strike_index != 0xFFFFFFFFUL &&
- sfnt->load_eblc &&
- ( load_flags & FT_LOAD_NO_BITMAP ) == 0 )
+ ( load_flags & FT_LOAD_NO_BITMAP ) == 0 &&
+ IS_DEFAULT_INSTANCE( size->root.face ) )
{
TT_SBit_MetricsRec metrics;
@@ -347,6 +354,75 @@
if ( load_flags & FT_LOAD_SBITS_ONLY )
return FT_THROW( Invalid_Argument );
+#ifdef FT_CONFIG_OPTION_SVG
+ /* check for OT-SVG */
+ if ( ( load_flags & FT_LOAD_NO_SVG ) == 0 &&
+ ( load_flags & FT_LOAD_COLOR ) &&
+ face->svg )
+ {
+ /*
+ * We load the SVG document and try to grab the advances from the
+ * table. For the bearings we rely on the presetting hook to do that.
+ */
+
+ SFNT_Service sfnt = (SFNT_Service)face->sfnt;
+
+
+ if ( size && (size->root.metrics.x_ppem < 1 ||
+ size->root.metrics.y_ppem < 1 ) )
+ {
+ error = FT_THROW( Invalid_Size_Handle );
+ return error;
+ }
+
+ FT_TRACE3(( "Trying to load SVG glyph\n" ));
+
+ error = sfnt->load_svg_doc( (FT_GlyphSlot)glyph, glyph_index );
+ if ( !error )
+ {
+ FT_Fixed x_scale = size->root.metrics.x_scale;
+ FT_Fixed y_scale = size->root.metrics.y_scale;
+
+ FT_Short dummy;
+ FT_UShort advanceX;
+ FT_UShort advanceY;
+
+
+ FT_TRACE3(( "Successfully loaded SVG glyph\n" ));
+
+ glyph->root.format = FT_GLYPH_FORMAT_SVG;
+
+ /*
+ * If horizontal or vertical advances are not present in the table,
+ * this is a problem with the font since the standard requires them.
+ * However, we are graceful and calculate the values by ourselves
+ * for the vertical case.
+ */
+ sfnt->get_metrics( face,
+ FALSE,
+ glyph_index,
+ &dummy,
+ &advanceX );
+ sfnt->get_metrics( face,
+ TRUE,
+ glyph_index,
+ &dummy,
+ &advanceY );
+
+ glyph->root.linearHoriAdvance = advanceX;
+ glyph->root.linearVertAdvance = advanceY;
+
+ glyph->root.metrics.horiAdvance = FT_MulFix( advanceX, x_scale );
+ glyph->root.metrics.vertAdvance = FT_MulFix( advanceY, y_scale );
+
+ return error;
+ }
+
+ FT_TRACE3(( "Failed to load SVG glyph\n" ));
+ }
+
+#endif /* FT_CONFIG_OPTION_SVG */
+
/* if we have a CID subfont, use its matrix (which has already */
/* been multiplied with the root matrix) */
@@ -364,7 +440,6 @@
top_upm = (FT_Long)cff->top_font.font_dict.units_per_em;
sub_upm = (FT_Long)cff->subfonts[fd_index]->font_dict.units_per_em;
-
font_matrix = cff->subfonts[fd_index]->font_dict.font_matrix;
font_offset = cff->subfonts[fd_index]->font_dict.font_offset;
@@ -399,7 +474,6 @@
PS_Driver driver = (PS_Driver)FT_FACE_DRIVER( face );
#endif
-
FT_Byte* charstring;
FT_ULong charstring_len;
@@ -416,13 +490,14 @@
decoder.builder.no_recurse =
FT_BOOL( load_flags & FT_LOAD_NO_RECURSE );
- /* now load the unscaled outline */
- error = cff_get_glyph_data( face, glyph_index,
- &charstring, &charstring_len );
+ /* this function also checks for a valid subfont index */
+ error = decoder_funcs->prepare( &decoder, size, glyph_index );
if ( error )
goto Glyph_Build_Finished;
- error = decoder_funcs->prepare( &decoder, size, glyph_index );
+ /* now load the unscaled outline */
+ error = cff_get_glyph_data( face, glyph_index,
+ &charstring, &charstring_len );
if ( error )
goto Glyph_Build_Finished;
@@ -665,8 +740,12 @@
metrics->horiBearingY = cbox.yMax;
if ( has_vertical_info )
+ {
metrics->vertBearingX = metrics->horiBearingX -
metrics->horiAdvance / 2;
+ metrics->vertBearingY = FT_MulFix( metrics->vertBearingY,
+ glyph->y_scale );
+ }
else
{
if ( load_flags & FT_LOAD_VERTICAL_LAYOUT )
diff --git a/src/3rdparty/freetype/src/cff/cffgload.h b/src/3rdparty/freetype/src/cff/cffgload.h
index 754c55acf9..3b8cf236dd 100644
--- a/src/3rdparty/freetype/src/cff/cffgload.h
+++ b/src/3rdparty/freetype/src/cff/cffgload.h
@@ -4,7 +4,7 @@
*
* OpenType Glyph Loader (specification).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
#define CFFGLOAD_H_
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/freetype.h>
+#include <freetype/internal/cffotypes.h>
FT_BEGIN_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffload.c b/src/3rdparty/freetype/src/cff/cffload.c
index 12efd18dc4..af79082e98 100644
--- a/src/3rdparty/freetype/src/cff/cffload.c
+++ b/src/3rdparty/freetype/src/cff/cffload.c
@@ -4,7 +4,7 @@
*
* OpenType and CFF data/program tables loader (body).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -16,17 +16,16 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_OBJECTS_H
-#include FT_INTERNAL_STREAM_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftobjs.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/tttags.h>
+#include <freetype/t1tables.h>
+#include <freetype/internal/psaux.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
#endif
#include "cffload.h"
@@ -357,9 +356,9 @@
data_size = (FT_ULong)( idx->count + 1 ) * offsize;
- if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) ||
- FT_STREAM_SEEK( idx->start + idx->hdr_size ) ||
- FT_FRAME_ENTER( data_size ) )
+ if ( FT_QNEW_ARRAY( idx->offsets, idx->count + 1 ) ||
+ FT_STREAM_SEEK( idx->start + idx->hdr_size ) ||
+ FT_FRAME_ENTER( data_size ) )
goto Exit;
poff = idx->offsets;
@@ -401,7 +400,7 @@
/* Allocate a table containing pointers to an index's elements. */
/* The `pool' argument makes this function convert the index */
- /* entries to C-style strings (this is, NULL-terminated). */
+ /* entries to C-style strings (that is, null-terminated). */
static FT_Error
cff_index_get_pointers( CFF_Index idx,
FT_Byte*** table,
@@ -411,7 +410,7 @@
FT_Error error = FT_Err_Ok;
FT_Memory memory = idx->stream->memory;
- FT_Byte** t = NULL;
+ FT_Byte** tbl = NULL;
FT_Byte* new_bytes = NULL;
FT_ULong new_size;
@@ -428,11 +427,11 @@
new_size = idx->data_size + idx->count;
if ( idx->count > 0 &&
- !FT_NEW_ARRAY( t, idx->count + 1 ) &&
+ !FT_QNEW_ARRAY( tbl, idx->count + 1 ) &&
( !pool || !FT_ALLOC( new_bytes, new_size ) ) )
{
FT_ULong n, cur_offset;
- FT_ULong extra = 0;
+ FT_ULong extra = 0;
FT_Byte* org_bytes = idx->bytes;
@@ -443,15 +442,15 @@
if ( cur_offset != 0 )
{
FT_TRACE0(( "cff_index_get_pointers:"
- " invalid first offset value %d set to zero\n",
+ " invalid first offset value %ld set to zero\n",
cur_offset ));
cur_offset = 0;
}
if ( !pool )
- t[0] = org_bytes + cur_offset;
+ tbl[0] = org_bytes + cur_offset;
else
- t[0] = new_bytes + cur_offset;
+ tbl[0] = new_bytes + cur_offset;
for ( n = 1; n <= idx->count; n++ )
{
@@ -465,23 +464,25 @@
next_offset = idx->data_size;
if ( !pool )
- t[n] = org_bytes + next_offset;
+ tbl[n] = org_bytes + next_offset;
else
{
- t[n] = new_bytes + next_offset + extra;
+ tbl[n] = new_bytes + next_offset + extra;
if ( next_offset != cur_offset )
{
- FT_MEM_COPY( t[n - 1], org_bytes + cur_offset, t[n] - t[n - 1] );
- t[n][0] = '\0';
- t[n] += 1;
+ FT_MEM_COPY( tbl[n - 1],
+ org_bytes + cur_offset,
+ tbl[n] - tbl[n - 1] );
+ tbl[n][0] = '\0';
+ tbl[n] += 1;
extra++;
}
}
cur_offset = next_offset;
}
- *table = t;
+ *table = tbl;
if ( pool )
*pool = new_bytes;
@@ -490,6 +491,11 @@
}
Exit:
+ if ( error && new_bytes )
+ FT_FREE( new_bytes );
+ if ( error && tbl )
+ FT_FREE( tbl );
+
return error;
}
@@ -553,8 +559,8 @@
idx->data_offset > stream->size - off2 + 1 )
{
FT_ERROR(( "cff_index_access_element:"
- " offset to next entry (%d)"
- " exceeds the end of stream (%d)\n",
+ " offset to next entry (%ld)"
+ " exceeds the end of stream (%ld)\n",
off2, stream->size - idx->data_offset + 1 ));
off2 = stream->size - idx->data_offset + 1;
}
@@ -616,7 +622,7 @@
FT_Byte* bytes;
FT_ULong byte_len;
FT_Error error;
- FT_String* name = 0;
+ FT_String* name = NULL;
if ( !idx->stream ) /* CFF2 does not include a name index */
@@ -628,10 +634,9 @@
if ( error )
goto Exit;
- if ( !FT_ALLOC( name, byte_len + 1 ) )
+ if ( !FT_QALLOC( name, byte_len + 1 ) )
{
- if ( byte_len )
- FT_MEM_COPY( name, bytes, byte_len );
+ FT_MEM_COPY( name, bytes, byte_len );
name[byte_len] = 0;
}
cff_index_forget_element( idx, &bytes );
@@ -766,8 +771,7 @@
case 3:
/* first, compare to the cache */
- if ( (FT_UInt)( glyph_index - fdselect->cache_first ) <
- fdselect->cache_count )
+ if ( glyph_index - fdselect->cache_first < fdselect->cache_count )
{
fd = fdselect->cache_fd;
break;
@@ -830,7 +834,6 @@
{
FT_Error error = FT_Err_Ok;
FT_UInt i;
- FT_Long j;
FT_UShort max_cid = 0;
@@ -848,9 +851,10 @@
/* When multiple GIDs map to the same CID, we choose the lowest */
/* GID. This is not described in any spec, but it matches the */
- /* behaviour of recent Acroread versions. */
- for ( j = (FT_Long)num_glyphs - 1; j >= 0; j-- )
- charset->cids[charset->sids[j]] = (FT_UShort)j;
+ /* behaviour of recent Acroread versions. The loop stops when */
+ /* the unsigned index wraps around after reaching zero. */
+ for ( i = num_glyphs - 1; i < num_glyphs; i-- )
+ charset->cids[charset->sids[i]] = (FT_UShort)i;
charset->max_cid = max_cid;
charset->num_glyphs = num_glyphs;
@@ -926,7 +930,7 @@
goto Exit;
/* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* assign the .notdef glyph */
@@ -978,7 +982,7 @@
if ( glyph_sid > 0xFFFFL - nleft )
{
FT_ERROR(( "cff_charset_load: invalid SID range trimmed"
- " nleft=%d -> %d\n", nleft, 0xFFFFL - glyph_sid ));
+ " nleft=%d -> %ld\n", nleft, 0xFFFFL - glyph_sid ));
nleft = ( FT_UInt )( 0xFFFFL - glyph_sid );
}
@@ -1012,14 +1016,14 @@
case 0:
if ( num_glyphs > 229 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe ISO-Latin)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
+ FT_ERROR(( "predefined charset (Adobe ISO-Latin)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1030,14 +1034,14 @@
case 1:
if ( num_glyphs > 166 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
+ FT_ERROR(( "predefined charset (Adobe Expert)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1048,14 +1052,14 @@
case 2:
if ( num_glyphs > 87 )
{
- FT_ERROR(( "cff_charset_load: implicit charset larger than\n"
- "predefined charset (Adobe Expert Subset)\n" ));
+ FT_ERROR(( "cff_charset_load: implicit charset larger than\n" ));
+ FT_ERROR(( "predefined charset (Adobe Expert Subset)\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
}
/* Allocate memory for sids. */
- if ( FT_NEW_ARRAY( charset->sids, num_glyphs ) )
+ if ( FT_QNEW_ARRAY( charset->sids, num_glyphs ) )
goto Exit;
/* Copy the predefined charset into the allocated memory. */
@@ -1081,7 +1085,6 @@
FT_FREE( charset->cids );
charset->format = 0;
charset->offset = 0;
- charset->sids = 0;
}
return error;
@@ -1135,6 +1138,8 @@
{
FT_UInt vsOffset;
FT_UInt format;
+ FT_UInt dataCount;
+ FT_UInt regionCount;
FT_ULong regionListOffset;
@@ -1157,16 +1162,16 @@
}
/* read top level fields */
- if ( FT_READ_ULONG( regionListOffset ) ||
- FT_READ_USHORT( vstore->dataCount ) )
+ if ( FT_READ_ULONG( regionListOffset ) ||
+ FT_READ_USHORT( dataCount ) )
goto Exit;
/* make temporary copy of item variation data offsets; */
/* we'll parse region list first, then come back */
- if ( FT_NEW_ARRAY( dataOffsetArray, vstore->dataCount ) )
+ if ( FT_QNEW_ARRAY( dataOffsetArray, dataCount ) )
goto Exit;
- for ( i = 0; i < vstore->dataCount; i++ )
+ for ( i = 0; i < dataCount; i++ )
{
if ( FT_READ_ULONG( dataOffsetArray[i] ) )
goto Exit;
@@ -1175,20 +1180,24 @@
/* parse regionList and axisLists */
if ( FT_STREAM_SEEK( vsOffset + regionListOffset ) ||
FT_READ_USHORT( vstore->axisCount ) ||
- FT_READ_USHORT( vstore->regionCount ) )
+ FT_READ_USHORT( regionCount ) )
goto Exit;
- if ( FT_NEW_ARRAY( vstore->varRegionList, vstore->regionCount ) )
+ vstore->regionCount = 0;
+ if ( FT_QNEW_ARRAY( vstore->varRegionList, regionCount ) )
goto Exit;
- for ( i = 0; i < vstore->regionCount; i++ )
+ for ( i = 0; i < regionCount; i++ )
{
CFF_VarRegion* region = &vstore->varRegionList[i];
- if ( FT_NEW_ARRAY( region->axisList, vstore->axisCount ) )
+ if ( FT_QNEW_ARRAY( region->axisList, vstore->axisCount ) )
goto Exit;
+ /* keep track of how many axisList to deallocate on error */
+ vstore->regionCount++;
+
for ( j = 0; j < vstore->axisCount; j++ )
{
CFF_AxisCoords* axis = &region->axisList[j];
@@ -1208,10 +1217,11 @@
}
/* use dataOffsetArray now to parse varData items */
- if ( FT_NEW_ARRAY( vstore->varData, vstore->dataCount ) )
+ vstore->dataCount = 0;
+ if ( FT_QNEW_ARRAY( vstore->varData, dataCount ) )
goto Exit;
- for ( i = 0; i < vstore->dataCount; i++ )
+ for ( i = 0; i < dataCount; i++ )
{
CFF_VarData* data = &vstore->varData[i];
@@ -1230,9 +1240,12 @@
if ( FT_READ_USHORT( data->regionIdxCount ) )
goto Exit;
- if ( FT_NEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
+ if ( FT_QNEW_ARRAY( data->regionIndices, data->regionIdxCount ) )
goto Exit;
+ /* keep track of how many regionIndices to deallocate on error */
+ vstore->dataCount++;
+
for ( j = 0; j < data->regionIdxCount; j++ )
{
if ( FT_READ_USHORT( data->regionIndices[j] ) )
@@ -1275,7 +1288,7 @@
/* Blended values are written to a different buffer, */
/* using reserved operator 255. */
/* */
- /* Blend calculation is done in 16.16 fixed point. */
+ /* Blend calculation is done in 16.16 fixed-point. */
FT_LOCAL_DEF( FT_Error )
cff_blend_doBlend( CFF_SubFont subFont,
CFF_Parser parser,
@@ -1316,9 +1329,9 @@
/* increase or allocate `blend_stack' and reset `blend_top'; */
/* prepare to append `numBlends' values to the buffer */
- if ( FT_REALLOC( subFont->blend_stack,
- subFont->blend_alloc,
- subFont->blend_alloc + size ) )
+ if ( FT_QREALLOC( subFont->blend_stack,
+ subFont->blend_alloc,
+ subFont->blend_alloc + size ) )
goto Exit;
subFont->blend_top = subFont->blend_stack + subFont->blend_used;
@@ -1348,19 +1361,20 @@
for ( i = 0; i < numBlends; i++ )
{
const FT_Int32* weight = &blend->BV[1];
- FT_UInt32 sum;
+ FT_Fixed sum;
/* convert inputs to 16.16 fixed point */
- sum = cff_parse_num( parser, &parser->stack[i + base] ) * 0x10000;
+ sum = cff_parse_fixed( parser, &parser->stack[i + base] );
for ( j = 1; j < blend->lenBV; j++ )
- sum += cff_parse_num( parser, &parser->stack[delta++] ) * *weight++;
+ sum += FT_MulFix( cff_parse_fixed( parser, &parser->stack[delta++] ),
+ *weight++ );
/* point parser stack to new value on blend_stack */
parser->stack[i + base] = subFont->blend_top;
- /* Push blended result as Type 2 5-byte fixed point number. This */
+ /* Push blended result as Type 2 5-byte fixed-point number. This */
/* will not conflict with actual DICTs because 255 is a reserved */
/* opcode in both CFF and CFF2 DICTs. See `cff_parse_num' for */
/* decode of this, which rounds to an integer. */
@@ -1431,9 +1445,7 @@
/* prepare buffer for the blend vector */
len = varData->regionIdxCount + 1; /* add 1 for default component */
- if ( FT_REALLOC( blend->BV,
- blend->lenBV * sizeof( *blend->BV ),
- len * sizeof( *blend->BV ) ) )
+ if ( FT_QRENEW_ARRAY( blend->BV, blend->lenBV, len ) )
goto Exit;
blend->lenBV = len;
@@ -1450,10 +1462,8 @@
if ( master == 0 )
{
blend->BV[master] = FT_FIXED_ONE;
- FT_TRACE4(( " build blend vector len %d\n"
- " [ %f ",
- len,
- blend->BV[master] / 65536.0 ));
+ FT_TRACE4(( " build blend vector len %d\n", len ));
+ FT_TRACE4(( " [ %f ", blend->BV[master] / 65536.0 ));
continue;
}
@@ -1537,9 +1547,7 @@
if ( lenNDV != 0 )
{
/* user has set a normalized vector */
- if ( FT_REALLOC( blend->lastNDV,
- blend->lenNDV * sizeof ( *NDV ),
- lenNDV * sizeof ( *NDV ) ) )
+ if ( FT_QRENEW_ARRAY( blend->lastNDV, blend->lenNDV, lenNDV ) )
goto Exit;
FT_MEM_COPY( blend->lastNDV,
@@ -1582,16 +1590,17 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_LOCAL_DEF( FT_Error )
- cff_get_var_blend( CFF_Face face,
+ cff_get_var_blend( FT_Face face, /* CFF_Face */
FT_UInt *num_coords,
FT_Fixed* *coords,
FT_Fixed* *normalizedcoords,
FT_MM_Var* *mm_var )
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- return mm->get_var_blend( FT_FACE( face ),
+ return mm->get_var_blend( face,
num_coords,
coords,
normalizedcoords,
@@ -1600,13 +1609,14 @@
FT_LOCAL_DEF( void )
- cff_done_blend( CFF_Face face )
+ cff_done_blend( FT_Face face ) /* CFF_Face */
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
+ CFF_Face cffface = (CFF_Face)face;
+ FT_Service_MultiMasters mm = (FT_Service_MultiMasters)cffface->mm;
- if (mm)
- mm->done_blend( FT_FACE( face ) );
+ if ( mm )
+ mm->done_blend( face );
}
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
@@ -1643,13 +1653,6 @@
goto Exit;
}
- /* Zero out the code to gid/sid mappings. */
- for ( j = 0; j < 256; j++ )
- {
- encoding->sids [j] = 0;
- encoding->codes[j] = 0;
- }
-
/* Note: The encoding table in a CFF font is indexed by glyph index; */
/* the first encoded glyph index is 1. Hence, we read the character */
/* code (`glyph_code') at index j and make the assignment: */
@@ -1664,6 +1667,10 @@
if ( offset > 1 )
{
+ /* Zero out the code to gid/sid mappings. */
+ FT_ARRAY_ZERO( encoding->sids, 256 );
+ FT_ARRAY_ZERO( encoding->codes, 256 );
+
encoding->offset = base_offset + offset;
/* we need to parse the table to determine its size */
@@ -1821,7 +1828,8 @@
/* Construct code to GID mapping from code to SID mapping */
/* and charset. */
- encoding->count = 0;
+ encoding->offset = offset; /* used in cff_face_init */
+ encoding->count = 0;
error = cff_charset_compute_cids( charset, num_glyphs,
stream->memory );
@@ -1945,7 +1953,7 @@
if ( priv->blue_shift > 1000 || priv->blue_shift < 0 )
{
FT_TRACE2(( "cff_load_private_dict:"
- " setting unlikely BlueShift value %d to default (7)\n",
+ " setting unlikely BlueShift value %ld to default (7)\n",
priv->blue_shift ));
priv->blue_shift = 7;
}
@@ -1953,7 +1961,7 @@
if ( priv->blue_fuzz > 1000 || priv->blue_fuzz < 0 )
{
FT_TRACE2(( "cff_load_private_dict:"
- " setting unlikely BlueFuzz value %d to default (1)\n",
+ " setting unlikely BlueFuzz value %ld to default (1)\n",
priv->blue_fuzz ));
priv->blue_fuzz = 1;
}
@@ -2004,7 +2012,7 @@
/* Top and Font DICTs are not allowed to have blend operators. */
error = cff_parser_init( &parser,
code,
- &subfont->font_dict,
+ top,
font->library,
stackSize,
0,
@@ -2057,7 +2065,7 @@
if ( !error )
{
FT_TRACE4(( " top dictionary:\n" ));
- error = cff_parser_run( &parser, dict, dict + dict_len );
+ error = cff_parser_run( &parser, dict, FT_OFFSET( dict, dict_len ) );
}
/* clean up regardless of error */
@@ -2357,8 +2365,8 @@
if ( font->name_index.count > 1 )
{
FT_ERROR(( "cff_font_load:"
- " invalid CFF font with multiple subfonts\n"
- " "
+ " invalid CFF font with multiple subfonts\n" ));
+ FT_ERROR(( " "
" in SFNT wrapper\n" ));
error = FT_THROW( Invalid_File_Format );
goto Exit;
diff --git a/src/3rdparty/freetype/src/cff/cffload.h b/src/3rdparty/freetype/src/cff/cffload.h
index 42d2696f33..b5286b0c8c 100644
--- a/src/3rdparty/freetype/src/cff/cffload.h
+++ b/src/3rdparty/freetype/src/cff/cffload.h
@@ -4,7 +4,7 @@
*
* OpenType & CFF data/program tables loader (specification).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,10 +20,9 @@
#define CFFLOAD_H_
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
+#include <freetype/internal/cfftypes.h>
#include "cffparse.h"
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H /* for CFF_Face */
+#include <freetype/internal/cffotypes.h> /* for CFF_Face */
FT_BEGIN_HEADER
@@ -106,14 +105,14 @@ FT_BEGIN_HEADER
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_LOCAL( FT_Error )
- cff_get_var_blend( CFF_Face face,
+ cff_get_var_blend( FT_Face face,
FT_UInt *num_coords,
FT_Fixed* *coords,
FT_Fixed* *normalizedcoords,
FT_MM_Var* *mm_var );
FT_LOCAL( void )
- cff_done_blend( CFF_Face face );
+ cff_done_blend( FT_Face face );
#endif
diff --git a/src/3rdparty/freetype/src/cff/cffobjs.c b/src/3rdparty/freetype/src/cff/cffobjs.c
index f76245f30b..6d08620c48 100644
--- a/src/3rdparty/freetype/src/cff/cffobjs.c
+++ b/src/3rdparty/freetype/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
*
* OpenType objects manager (body).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -16,32 +16,31 @@
*/
-#include <ft2build.h>
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_STREAM_H
-#include FT_ERRORS_H
-#include FT_TRUETYPE_IDS_H
-#include FT_TRUETYPE_TAGS_H
-#include FT_INTERNAL_SFNT_H
-#include FT_DRIVER_H
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/ftstream.h>
+#include <freetype/fterrors.h>
+#include <freetype/ttnameid.h>
+#include <freetype/tttags.h>
+#include <freetype/internal/sfnt.h>
+#include <freetype/ftdriver.h>
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
-#include FT_MULTIPLE_MASTERS_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
+#include <freetype/ftmm.h>
+#include <freetype/internal/services/svmm.h>
+#include <freetype/internal/services/svmetric.h>
#endif
-#include FT_INTERNAL_CFF_OBJECTS_TYPES_H
+#include <freetype/internal/cffotypes.h>
#include "cffobjs.h"
#include "cffload.h"
#include "cffcmap.h"
#include "cfferrs.h"
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_SERVICE_CFF_TABLE_LOAD_H
+#include <freetype/internal/psaux.h>
+#include <freetype/internal/services/svcfftl.h>
/**************************************************************************
@@ -70,8 +69,8 @@
FT_Module module;
- module = FT_Get_Module( size->root.face->driver->root.library,
- "pshinter" );
+ module = FT_Get_Module( font->library, "pshinter" );
+
return ( module && pshinter && pshinter->get_globals_funcs )
? pshinter->get_globals_funcs( module )
: 0;
@@ -167,46 +166,54 @@
FT_Error error = FT_Err_Ok;
PSH_Globals_Funcs funcs = cff_size_get_globals_funcs( size );
+ FT_Memory memory = cffsize->face->memory;
+ CFF_Internal internal = NULL;
+ CFF_Face face = (CFF_Face)cffsize->face;
+ CFF_Font font = (CFF_Font)face->extra.data;
- if ( funcs )
- {
- CFF_Face face = (CFF_Face)cffsize->face;
- CFF_Font font = (CFF_Font)face->extra.data;
- CFF_Internal internal = NULL;
+ PS_PrivateRec priv;
- PS_PrivateRec priv;
- FT_Memory memory = cffsize->face->memory;
+ FT_UInt i;
- FT_UInt i;
+ if ( !funcs )
+ goto Exit;
+ if ( FT_NEW( internal ) )
+ goto Exit;
- if ( FT_NEW( internal ) )
- goto Exit;
+ cff_make_private_dict( &font->top_font, &priv );
+ error = funcs->create( memory, &priv, &internal->topfont );
+ if ( error )
+ goto Exit;
+
+ for ( i = font->num_subfonts; i > 0; i-- )
+ {
+ CFF_SubFont sub = font->subfonts[i - 1];
- cff_make_private_dict( &font->top_font, &priv );
- error = funcs->create( cffsize->face->memory, &priv,
- &internal->topfont );
+
+ cff_make_private_dict( sub, &priv );
+ error = funcs->create( memory, &priv, &internal->subfonts[i - 1] );
if ( error )
goto Exit;
+ }
- for ( i = font->num_subfonts; i > 0; i-- )
- {
- CFF_SubFont sub = font->subfonts[i - 1];
+ cffsize->internal->module_data = internal;
+ size->strike_index = 0xFFFFFFFFUL;
- cff_make_private_dict( sub, &priv );
- error = funcs->create( cffsize->face->memory, &priv,
- &internal->subfonts[i - 1] );
- if ( error )
- goto Exit;
+ Exit:
+ if ( error )
+ {
+ if ( internal )
+ {
+ for ( i = font->num_subfonts; i > 0; i-- )
+ FT_FREE( internal->subfonts[i - 1] );
+ FT_FREE( internal->topfont );
}
- cffsize->internal->module_data = internal;
+ FT_FREE( internal );
}
- size->strike_index = 0xFFFFFFFFUL;
-
- Exit:
return error;
}
@@ -274,6 +281,8 @@
cff_size_request( FT_Size size,
FT_Size_Request req )
{
+ FT_Error error;
+
CFF_Size cffsize = (CFF_Size)size;
PSH_Globals_Funcs funcs;
@@ -295,7 +304,9 @@
#endif /* TT_CONFIG_OPTION_EMBEDDED_BITMAPS */
- FT_Request_Metrics( size->face, req );
+ error = FT_Request_Metrics( size->face, req );
+ if ( error )
+ goto Exit;
funcs = cff_size_get_globals_funcs( cffsize );
@@ -336,7 +347,8 @@
}
}
- return FT_Err_Ok;
+ Exit:
+ return error;
}
@@ -349,7 +361,8 @@
FT_LOCAL_DEF( void )
cff_slot_done( FT_GlyphSlot slot )
{
- slot->internal->glyph_hints = NULL;
+ if ( slot->internal )
+ slot->internal->glyph_hints = NULL;
}
@@ -366,8 +379,7 @@
FT_Module module;
- module = FT_Get_Module( slot->face->driver->root.library,
- "pshinter" );
+ module = FT_Get_Module( slot->library, "pshinter" );
if ( module )
{
T2_Hints_Funcs funcs;
@@ -396,9 +408,7 @@
FT_String* result;
- (void)FT_STRDUP( result, source );
-
- FT_UNUSED( error );
+ FT_MEM_STRDUP( result, source );
return result;
}
@@ -649,8 +659,8 @@
if ( dict->cid_registry == 0xFFFFU && !psnames )
{
FT_ERROR(( "cff_face_init:"
- " cannot open CFF & CEF fonts\n"
- " "
+ " cannot open CFF & CEF fonts\n" ));
+ FT_ERROR(( " "
" without the `psnames' module\n" ));
error = FT_THROW( Missing_Module );
goto Exit;
@@ -674,13 +684,13 @@
/* In Multiple Master CFFs, two SIDs hold the Normalize Design */
/* Vector (NDV) and Convert Design Vector (CDV) charstrings, */
- /* which may contain NULL bytes in the middle of the data, too. */
+ /* which may contain null bytes in the middle of the data, too. */
/* We thus access `cff->strings' directly. */
for ( idx = 1; idx < cff->num_strings; idx++ )
{
FT_Byte* s1 = cff->strings[idx - 1];
FT_Byte* s2 = cff->strings[idx];
- FT_PtrDist s1len = s2 - s1 - 1; /* without the final NULL byte */
+ FT_PtrDist s1len = s2 - s1 - 1; /* without the final null byte */
FT_PtrDist l;
@@ -709,22 +719,15 @@
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
{
- FT_Service_MultiMasters mm = (FT_Service_MultiMasters)face->mm;
- FT_Service_MetricsVariations var = (FT_Service_MetricsVariations)face->var;
-
FT_UInt instance_index = (FT_UInt)face_index >> 16;
if ( FT_HAS_MULTIPLE_MASTERS( cffface ) &&
- mm &&
instance_index > 0 )
{
- error = mm->set_instance( cffface, instance_index );
+ error = FT_Set_Named_Instance( cffface, instance_index );
if ( error )
goto Exit;
-
- if ( var )
- var->metrics_adjust( cffface );
}
}
#endif /* TT_CONFIG_OPTION_GX_VAR_SUPPORT */
@@ -940,7 +943,8 @@
style_name = cff_strcpy( memory, fullp );
/* remove the style part from the family name (if present) */
- remove_style( cffface->family_name, style_name );
+ if ( style_name )
+ remove_style( cffface->family_name, style_name );
}
break;
}
@@ -1017,12 +1021,10 @@
cffface->style_flags = flags;
}
-#ifndef FT_CONFIG_OPTION_NO_GLYPH_NAMES
- /* CID-keyed CFF fonts don't have glyph names -- the SFNT loader */
- /* has unset this flag because of the 3.0 `post' table. */
- if ( dict->cid_registry == 0xFFFFU )
+ /* CID-keyed CFF or CFF2 fonts don't have glyph names -- the SFNT */
+ /* loader has unset this flag because of the 3.0 `post' table. */
+ if ( dict->cid_registry == 0xFFFFU && !cff2 )
cffface->face_flags |= FT_FACE_FLAG_GLYPH_NAMES;
-#endif
if ( dict->cid_registry != 0xFFFFU && pure_cff )
cffface->face_flags |= FT_FACE_FLAG_CID_KEYED;
@@ -1038,11 +1040,11 @@
{
FT_CharMapRec cmaprec;
FT_CharMap cmap;
- FT_UInt nn;
+ FT_Int nn;
CFF_Encoding encoding = &cff->encoding;
- for ( nn = 0; nn < (FT_UInt)cffface->num_charmaps; nn++ )
+ for ( nn = 0; nn < cffface->num_charmaps; nn++ )
{
cmap = cffface->charmaps[nn];
@@ -1067,7 +1069,7 @@
cmaprec.encoding_id = TT_MS_ID_UNICODE_CS;
cmaprec.encoding = FT_ENCODING_UNICODE;
- nn = (FT_UInt)cffface->num_charmaps;
+ nn = cffface->num_charmaps;
error = FT_CMap_New( &cff_cmap_unicode_class_rec, NULL,
&cmaprec, NULL );
@@ -1078,7 +1080,7 @@
error = FT_Err_Ok;
/* if no Unicode charmap was previously selected, select this one */
- if ( !cffface->charmap && nn != (FT_UInt)cffface->num_charmaps )
+ if ( !cffface->charmap && nn != cffface->num_charmaps )
cffface->charmap = cffface->charmaps[nn];
Skip_Unicode:
@@ -1148,7 +1150,7 @@
}
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
- cff_done_blend( face );
+ cff_done_blend( cffface );
face->blend = NULL;
#endif
}
@@ -1163,11 +1165,7 @@
/* set default property values, cf. `ftcffdrv.h' */
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- driver->hinting_engine = FT_HINTING_FREETYPE;
-#else
driver->hinting_engine = FT_HINTING_ADOBE;
-#endif
driver->no_stem_darkening = TRUE;
diff --git a/src/3rdparty/freetype/src/cff/cffobjs.h b/src/3rdparty/freetype/src/cff/cffobjs.h
index 03bc78a67f..8f05f6132b 100644
--- a/src/3rdparty/freetype/src/cff/cffobjs.h
+++ b/src/3rdparty/freetype/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
*
* OpenType objects manager (specification).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,7 +20,6 @@
#define CFFOBJS_H_
-#include <ft2build.h>
FT_BEGIN_HEADER
diff --git a/src/3rdparty/freetype/src/cff/cffparse.c b/src/3rdparty/freetype/src/cff/cffparse.c
index 008752c3ae..3b076704cf 100644
--- a/src/3rdparty/freetype/src/cff/cffparse.c
+++ b/src/3rdparty/freetype/src/cff/cffparse.c
@@ -4,7 +4,7 @@
*
* CFF token stream parser (body)
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -16,13 +16,12 @@
*/
-#include <ft2build.h>
#include "cffparse.h"
-#include FT_INTERNAL_STREAM_H
-#include FT_INTERNAL_DEBUG_H
-#include FT_INTERNAL_CALC_H
-#include FT_INTERNAL_POSTSCRIPT_AUX_H
-#include FT_LIST_H
+#include <freetype/internal/ftstream.h>
+#include <freetype/internal/ftdebug.h>
+#include <freetype/internal/ftcalc.h>
+#include <freetype/internal/psaux.h>
+#include <freetype/ftlist.h>
#include "cfferrs.h"
#include "cffload.h"
@@ -63,11 +62,8 @@
parser->num_axes = num_axes;
/* allocate the stack buffer */
- if ( FT_NEW_ARRAY( parser->stack, stackSize ) )
- {
- FT_FREE( parser->stack );
+ if ( FT_QNEW_ARRAY( parser->stack, stackSize ) )
goto Exit;
- }
parser->stackSize = stackSize;
parser->top = parser->stack; /* empty stack */
@@ -77,23 +73,6 @@
}
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- static void
- finalize_t2_strings( FT_Memory memory,
- void* data,
- void* user )
- {
- CFF_T2_String t2 = (CFF_T2_String)data;
-
-
- FT_UNUSED( user );
-
- memory->free( memory, t2->start );
- memory->free( memory, data );
- }
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
-
FT_LOCAL_DEF( void )
cff_parser_done( CFF_Parser parser )
{
@@ -103,63 +82,19 @@
FT_FREE( parser->stack );
#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- FT_List_Finalize( &parser->t2_strings,
- finalize_t2_strings,
- memory,
- NULL );
+ FT_List_Finalize( &parser->t2_strings, NULL, memory, NULL );
#endif
}
- /* Assuming `first >= last'. */
-
- static FT_Error
- cff_parser_within_limits( CFF_Parser parser,
- FT_Byte* first,
- FT_Byte* last )
- {
-#ifndef CFF_CONFIG_OPTION_OLD_ENGINE
-
- /* Fast path for regular FreeType builds with the "new" engine; */
- /* `first >= parser->start' can be assumed. */
-
- FT_UNUSED( first );
-
- return last < parser->limit ? FT_Err_Ok : FT_THROW( Invalid_Argument );
-
-#else /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
- FT_ListNode node;
-
-
- if ( first >= parser->start &&
- last < parser->limit )
- return FT_Err_Ok;
-
- node = parser->t2_strings.head;
-
- while ( node )
- {
- CFF_T2_String t2 = (CFF_T2_String)node->data;
-
-
- if ( first >= t2->start &&
- last < t2->limit )
- return FT_Err_Ok;
-
- node = node->next;
- }
-
- return FT_THROW( Invalid_Argument );
-
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
- }
-
+ /* The parser limit checks in the next two functions are supposed */
+ /* to detect the immediate crossing of the stream boundary. They */
+ /* shall not be triggered from the distant t2_strings buffers. */
/* read an integer */
static FT_Long
- cff_parse_integer( CFF_Parser parser,
- FT_Byte* start )
+ cff_parse_integer( FT_Byte* start,
+ FT_Byte* limit )
{
FT_Byte* p = start;
FT_Int v = *p++;
@@ -168,14 +103,14 @@
if ( v == 28 )
{
- if ( cff_parser_within_limits( parser, p, p + 1 ) )
+ if ( p + 2 > limit && limit >= p )
goto Bad;
val = (FT_Short)( ( (FT_UShort)p[0] << 8 ) | p[1] );
}
else if ( v == 29 )
{
- if ( cff_parser_within_limits( parser, p, p + 3 ) )
+ if ( p + 4 > limit && limit >= p )
goto Bad;
val = (FT_Long)( ( (FT_ULong)p[0] << 24 ) |
@@ -189,14 +124,14 @@
}
else if ( v < 251 )
{
- if ( cff_parser_within_limits( parser, p, p ) )
+ if ( p + 1 > limit && limit >= p )
goto Bad;
val = ( v - 247 ) * 256 + p[0] + 108;
}
else
{
- if ( cff_parser_within_limits( parser, p, p ) )
+ if ( p + 1 > limit && limit >= p )
goto Bad;
val = -( v - 251 ) * 256 - p[0] - 108;
@@ -245,10 +180,10 @@
/* read a real */
static FT_Fixed
- cff_parse_real( CFF_Parser parser,
- FT_Byte* start,
- FT_Long power_ten,
- FT_Long* scaling )
+ cff_parse_real( FT_Byte* start,
+ FT_Byte* limit,
+ FT_Long power_ten,
+ FT_Long* scaling )
{
FT_Byte* p = start;
FT_Int nib;
@@ -283,7 +218,7 @@
p++;
/* Make sure we don't read past the end. */
- if ( cff_parser_within_limits( parser, p, p ) )
+ if ( p + 1 > limit && limit >= p )
goto Bad;
}
@@ -320,7 +255,7 @@
p++;
/* Make sure we don't read past the end. */
- if ( cff_parser_within_limits( parser, p, p ) )
+ if ( p + 1 > limit && limit >= p )
goto Bad;
}
@@ -359,7 +294,7 @@
p++;
/* Make sure we don't read past the end. */
- if ( cff_parser_within_limits( parser, p, p ) )
+ if ( p + 1 > limit && limit >= p )
goto Bad;
}
@@ -526,12 +461,12 @@
if ( **d == 30 )
{
/* binary-coded decimal is truncated to integer */
- return cff_parse_real( parser, *d, 0, NULL ) >> 16;
+ return cff_parse_real( *d, parser->limit, 0, NULL ) >> 16;
}
else if ( **d == 255 )
{
- /* 16.16 fixed point is used internally for CFF2 blend results. */
+ /* 16.16 fixed-point is used internally for CFF2 blend results. */
/* Since these are trusted values, a limit check is not needed. */
/* After the 255, 4 bytes give the number. */
@@ -552,7 +487,7 @@
}
else
- return cff_parse_integer( parser, *d );
+ return cff_parse_integer( *d, parser->limit );
}
@@ -563,15 +498,33 @@
FT_Long scaling )
{
if ( **d == 30 )
- return cff_parse_real( parser, *d, scaling, NULL );
+ return cff_parse_real( *d, parser->limit, scaling, NULL );
+ else if ( **d == 255 )
+ {
+ FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
+ ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
+ ( (FT_UInt32)*( d[0] + 3 ) << 8 ) |
+ (FT_UInt32)*( d[0] + 4 ) ) );
+
+ if ( scaling )
+ {
+ if ( FT_ABS( val ) > power_ten_limits[scaling] )
+ {
+ FT_TRACE4(( "!!!OVERFLOW:!!!" ));
+ return val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
+ }
+ val *= power_tens[scaling];
+ }
+ return val;
+ }
else
{
- FT_Long val = cff_parse_integer( parser, *d );
+ FT_Long val = cff_parse_integer( *d, parser->limit );
if ( scaling )
{
- if ( FT_ABS( val ) > power_ten_limits[scaling] )
+ if ( ( FT_ABS( val ) << 16 ) > power_ten_limits[scaling] )
{
val = val > 0 ? 0x7FFFFFFFL : -0x7FFFFFFFL;
goto Overflow;
@@ -601,7 +554,7 @@
/* read a floating point number, either integer or real */
- static FT_Fixed
+ FT_LOCAL_DEF( FT_Fixed )
cff_parse_fixed( CFF_Parser parser,
FT_Byte** d )
{
@@ -631,14 +584,14 @@
FT_ASSERT( scaling );
if ( **d == 30 )
- return cff_parse_real( parser, *d, 0, scaling );
+ return cff_parse_real( *d, parser->limit, 0, scaling );
else
{
FT_Long number;
FT_Int integer_length;
- number = cff_parse_integer( parser, d[0] );
+ number = cff_parse_integer( *d, parser->limit );
if ( number > 0x7FFFL )
{
@@ -687,7 +640,7 @@
dict->has_font_matrix = TRUE;
- /* We expect a well-formed font matrix, this is, the matrix elements */
+ /* We expect a well-formed font matrix, that is, the matrix elements */
/* `xx' and `yy' are of approximately the same magnitude. To avoid */
/* loss of precision, we use the magnitude of the largest matrix */
/* element to scale all other elements. The scaling factor is then */
@@ -714,9 +667,10 @@
( max_scaling - min_scaling ) > 9 )
{
FT_TRACE1(( "cff_parse_font_matrix:"
- " strange scaling values (minimum %d, maximum %d),\n"
- " "
- " using default matrix\n", min_scaling, max_scaling ));
+ " strange scaling values (minimum %ld, maximum %ld),\n",
+ min_scaling, max_scaling ));
+ FT_TRACE1(( " "
+ " using default matrix\n" ));
goto Unlikely;
}
@@ -758,12 +712,12 @@
*upm = (FT_ULong)power_tens[-max_scaling];
FT_TRACE4(( " [%f %f %f %f %f %f]\n",
- (double)matrix->xx / *upm / 65536,
- (double)matrix->xy / *upm / 65536,
- (double)matrix->yx / *upm / 65536,
- (double)matrix->yy / *upm / 65536,
- (double)offset->x / *upm / 65536,
- (double)offset->y / *upm / 65536 ));
+ (double)matrix->xx / (double)*upm / 65536,
+ (double)matrix->xy / (double)*upm / 65536,
+ (double)matrix->yx / (double)*upm / 65536,
+ (double)matrix->yy / (double)*upm / 65536,
+ (double)offset->x / (double)*upm / 65536,
+ (double)offset->y / (double)*upm / 65536 ));
if ( !FT_Matrix_Check( matrix ) )
{
@@ -811,7 +765,7 @@
bbox->yMax = FT_RoundFix( cff_parse_fixed( parser, data ) );
error = FT_Err_Ok;
- FT_TRACE4(( " [%d %d %d %d]\n",
+ FT_TRACE4(( " [%ld %ld %ld %ld]\n",
bbox->xMin / 65536,
bbox->yMin / 65536,
bbox->xMax / 65536,
@@ -934,11 +888,11 @@
FT_TRACE1(( "cff_parse_cid_ros: real supplement is rounded\n" ));
dict->cid_supplement = cff_parse_num( parser, data );
if ( dict->cid_supplement < 0 )
- FT_TRACE1(( "cff_parse_cid_ros: negative supplement %d is found\n",
+ FT_TRACE1(( "cff_parse_cid_ros: negative supplement %ld is found\n",
dict->cid_supplement ));
error = FT_Err_Ok;
- FT_TRACE4(( " %d %d %d\n",
+ FT_TRACE4(( " %d %d %ld\n",
dict->cid_registry,
dict->cid_ordering,
dict->cid_supplement ));
@@ -1264,11 +1218,8 @@
FT_Byte* charstring_base;
FT_ULong charstring_len;
- FT_Fixed* stack;
- FT_ListNode node;
- CFF_T2_String t2;
- size_t t2_size;
- FT_Byte* q;
+ FT_Fixed* stack;
+ FT_Byte* q = NULL;
charstring_base = ++p;
@@ -1309,39 +1260,18 @@
/* Now copy the stack data in the temporary decoder object, */
/* converting it back to charstring number representations */
/* (this is ugly, I know). */
+ /* The maximum required size is 5 bytes per stack element. */
+ if ( FT_QALLOC( q, (FT_Long)( 2 * sizeof ( FT_ListNode ) ) +
+ 5 * ( decoder.top - decoder.stack ) ) )
+ goto Exit;
- node = (FT_ListNode)memory->alloc( memory,
- sizeof ( FT_ListNodeRec ) );
- if ( !node )
- goto Out_Of_Memory_Error;
-
- FT_List_Add( &parser->t2_strings, node );
-
- t2 = (CFF_T2_String)memory->alloc( memory,
- sizeof ( CFF_T2_StringRec ) );
- if ( !t2 )
- goto Out_Of_Memory_Error;
-
- node->data = t2;
-
- /* `5' is the conservative upper bound of required bytes per stack */
- /* element. */
-
- t2_size = 5 * ( decoder.top - decoder.stack );
-
- q = (FT_Byte*)memory->alloc( memory, t2_size );
- if ( !q )
- goto Out_Of_Memory_Error;
-
- t2->start = q;
- t2->limit = q + t2_size;
+ FT_List_Add( &parser->t2_strings, (FT_ListNode)q );
- stack = decoder.stack;
+ q += 2 * sizeof ( FT_ListNode );
- while ( stack < decoder.top )
+ for ( stack = decoder.stack; stack < decoder.top; stack++ )
{
- FT_ULong num;
- FT_Bool neg;
+ FT_Long num = *stack;
if ( (FT_UInt)( parser->top - parser->stack ) >= parser->stackSize )
@@ -1349,69 +1279,37 @@
*parser->top++ = q;
- if ( *stack < 0 )
- {
- num = (FT_ULong)NEG_LONG( *stack );
- neg = 1;
- }
- else
- {
- num = (FT_ULong)*stack;
- neg = 0;
- }
-
if ( num & 0xFFFFU )
{
- if ( neg )
- num = (FT_ULong)-num;
-
*q++ = 255;
- *q++ = ( num & 0xFF000000U ) >> 24;
- *q++ = ( num & 0x00FF0000U ) >> 16;
- *q++ = ( num & 0x0000FF00U ) >> 8;
- *q++ = num & 0x000000FFU;
+ *q++ = (FT_Byte)( ( num >> 24 ) & 0xFF );
+ *q++ = (FT_Byte)( ( num >> 16 ) & 0xFF );
+ *q++ = (FT_Byte)( ( num >> 8 ) & 0xFF );
+ *q++ = (FT_Byte)( ( num ) & 0xFF );
}
else
{
num >>= 16;
- if ( neg )
+ if ( -107 <= num && num <= 107 )
+ *q++ = (FT_Byte)( num + 139 );
+ else if ( 108 <= num && num <= 1131 )
{
- if ( num <= 107 )
- *q++ = (FT_Byte)( 139 - num );
- else if ( num <= 1131 )
- {
- *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 251 );
- *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
- }
- else
- {
- num = (FT_ULong)-num;
-
- *q++ = 28;
- *q++ = (FT_Byte)( num >> 8 );
- *q++ = (FT_Byte)( num & 0xFF );
- }
+ *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 );
+ *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
+ }
+ else if ( -1131 <= num && num <= -108 )
+ {
+ *q++ = (FT_Byte)( ( ( -num - 108 ) >> 8 ) + 251 );
+ *q++ = (FT_Byte)( ( -num - 108) & 0xFF );
}
else
{
- if ( num <= 107 )
- *q++ = (FT_Byte)( num + 139 );
- else if ( num <= 1131 )
- {
- *q++ = (FT_Byte)( ( ( num - 108 ) >> 8 ) + 247 );
- *q++ = (FT_Byte)( ( num - 108 ) & 0xFF );
- }
- else
- {
- *q++ = 28;
- *q++ = (FT_Byte)( num >> 8 );
- *q++ = (FT_Byte)( num & 0xFF );
- }
+ *q++ = 28;
+ *q++ = (FT_Byte)( num >> 8 );
+ *q++ = (FT_Byte)( num & 0xFF );
}
}
-
- stack++;
}
}
#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
@@ -1516,6 +1414,7 @@
case cff_kind_fixed_thousand:
FT_TRACE4(( " %f\n", (double)val / 65536 / 1000 ));
+ break;
default:
; /* never reached */
@@ -1597,12 +1496,6 @@
Exit:
return error;
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- Out_Of_Memory_Error:
- error = FT_THROW( Out_Of_Memory );
- goto Exit;
-#endif
-
Stack_Overflow:
error = FT_THROW( Invalid_Argument );
goto Exit;
diff --git a/src/3rdparty/freetype/src/cff/cffparse.h b/src/3rdparty/freetype/src/cff/cffparse.h
index 4e74709a2d..418caacc68 100644
--- a/src/3rdparty/freetype/src/cff/cffparse.h
+++ b/src/3rdparty/freetype/src/cff/cffparse.h
@@ -4,7 +4,7 @@
*
* CFF token stream parser (specification)
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
@@ -20,9 +20,8 @@
#define CFFPARSE_H_
-#include <ft2build.h>
-#include FT_INTERNAL_CFF_TYPES_H
-#include FT_INTERNAL_OBJECTS_H
+#include <freetype/internal/cfftypes.h>
+#include <freetype/internal/ftobjs.h>
FT_BEGIN_HEADER
@@ -77,6 +76,10 @@ FT_BEGIN_HEADER
cff_parse_num( CFF_Parser parser,
FT_Byte** d );
+ FT_LOCAL( FT_Fixed )
+ cff_parse_fixed( CFF_Parser parser,
+ FT_Byte** d );
+
FT_LOCAL( FT_Error )
cff_parser_init( CFF_Parser parser,
FT_UInt code,
@@ -134,15 +137,6 @@ FT_BEGIN_HEADER
FT_END_HEADER
-#ifdef CFF_CONFIG_OPTION_OLD_ENGINE
- typedef struct CFF_T2_String_
- {
- FT_Byte* start;
- FT_Byte* limit;
-
- } CFF_T2_StringRec, *CFF_T2_String;
-#endif /* CFF_CONFIG_OPTION_OLD_ENGINE */
-
#endif /* CFFPARSE_H_ */
diff --git a/src/3rdparty/freetype/src/cff/cffpic.c b/src/3rdparty/freetype/src/cff/cffpic.c
deleted file mode 100644
index 08b74c7cf2..0000000000
--- a/src/3rdparty/freetype/src/cff/cffpic.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffpic.c */
-/* */
-/* The FreeType position independent code services for cff module. */
-/* */
-/* Copyright 2009-2018 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* 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_FREETYPE_H
-#include FT_INTERNAL_OBJECTS_H
-#include "cffcmap.h"
-#include "cffpic.h"
-#include "cfferrs.h"
-
-
-#ifdef FT_CONFIG_OPTION_PIC
-
- /* forward declaration of PIC init functions from cffdrivr.c */
- FT_Error
- FT_Create_Class_cff_services( FT_Library library,
- FT_ServiceDescRec** output_class );
- void
- FT_Destroy_Class_cff_services( FT_Library library,
- FT_ServiceDescRec* clazz );
- void
- FT_Init_Class_cff_service_ps_info( FT_Library library,
- FT_Service_PsInfoRec* clazz );
- void
- FT_Init_Class_cff_service_glyph_dict( FT_Library library,
- FT_Service_GlyphDictRec* clazz );
- void
- FT_Init_Class_cff_service_ps_name( FT_Library library,
- FT_Service_PsFontNameRec* clazz );
- void
- FT_Init_Class_cff_service_get_cmap_info( FT_Library library,
- FT_Service_TTCMapsRec* clazz );
- void
- FT_Init_Class_cff_service_cid_info( FT_Library library,
- FT_Service_CIDRec* clazz );
-
- /* forward declaration of PIC init functions from cffparse.c */
- FT_Error
- FT_Create_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler** output_class );
- void
- FT_Destroy_Class_cff_field_handlers( FT_Library library,
- CFF_Field_Handler* clazz );
-
-
- void
- cff_driver_class_pic_free( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Memory memory = library->memory;
-
-
- if ( pic_container->cff )
- {
- CffModulePIC* container = (CffModulePIC*)pic_container->cff;
-
-
- if ( container->cff_services )
- FT_Destroy_Class_cff_services( library,
- container->cff_services );
- container->cff_services = NULL;
- if ( container->cff_field_handlers )
- FT_Destroy_Class_cff_field_handlers(
- library, container->cff_field_handlers );
- container->cff_field_handlers = NULL;
- FT_FREE( container );
- pic_container->cff = NULL;
- }
- }
-
-
- FT_Error
- cff_driver_class_pic_init( FT_Library library )
- {
- FT_PIC_Container* pic_container = &library->pic_container;
- FT_Error error = FT_Err_Ok;
- CffModulePIC* container = NULL;
- FT_Memory memory = library->memory;
-
-
- /* allocate pointer, clear and set global container pointer */
- if ( FT_ALLOC ( container, sizeof ( *container ) ) )
- return error;
- FT_MEM_SET( container, 0, sizeof ( *container ) );
- pic_container->cff = container;
-
- /* initialize pointer table - */
- /* this is how the module usually expects this data */
- error = FT_Create_Class_cff_services( library,
- &container->cff_services );
- if ( error )
- goto Exit;
-
- error = FT_Create_Class_cff_field_handlers(
- library, &container->cff_field_handlers );
- if ( error )
- goto Exit;
-
- FT_Init_Class_cff_service_ps_info(
- library, &container->cff_service_ps_info );
- FT_Init_Class_cff_service_glyph_dict(
- library, &container->cff_service_glyph_dict );
- FT_Init_Class_cff_service_ps_name(
- library, &container->cff_service_ps_name );
- FT_Init_Class_cff_service_get_cmap_info(
- library, &container->cff_service_get_cmap_info );
- FT_Init_Class_cff_service_cid_info(
- library, &container->cff_service_cid_info );
- FT_Init_Class_cff_cmap_encoding_class_rec(
- library, &container->cff_cmap_encoding_class_rec );
- FT_Init_Class_cff_cmap_unicode_class_rec(
- library, &container->cff_cmap_unicode_class_rec );
-
- Exit:
- if ( error )
- cff_driver_class_pic_free( library );
- return error;
- }
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cffpic.h b/src/3rdparty/freetype/src/cff/cffpic.h
deleted file mode 100644
index 8ba4203a8d..0000000000
--- a/src/3rdparty/freetype/src/cff/cffpic.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/***************************************************************************/
-/* */
-/* cffpic.h */
-/* */
-/* The FreeType position independent code services for cff module. */
-/* */
-/* Copyright 2009-2018 by */
-/* Oran Agra and Mickey Gabel. */
-/* */
-/* 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 CFFPIC_H_
-#define CFFPIC_H_
-
-
-#include FT_INTERNAL_PIC_H
-
-#ifndef FT_CONFIG_OPTION_PIC
-
-#define CFF_SERVICE_PS_INFO_GET cff_service_ps_info
-#define CFF_SERVICE_GLYPH_DICT_GET cff_service_glyph_dict
-#define CFF_SERVICE_PS_NAME_GET cff_service_ps_name
-#define CFF_SERVICE_GET_CMAP_INFO_GET cff_service_get_cmap_info
-#define CFF_SERVICE_CID_INFO_GET cff_service_cid_info
-#define CFF_SERVICE_PROPERTIES_GET cff_service_properties
-#define CFF_SERVICES_GET cff_services
-#define CFF_SERVICE_MULTI_MASTERS_GET cff_service_multi_masters
-#define CFF_SERVICE_METRICS_VAR_GET cff_service_metrics_variations
-#define CFF_SERVICE_CFF_LOAD_GET cff_service_cff_load
-#define CFF_CMAP_ENCODING_CLASS_REC_GET cff_cmap_encoding_class_rec
-#define CFF_CMAP_UNICODE_CLASS_REC_GET cff_cmap_unicode_class_rec
-#define CFF_FIELD_HANDLERS_GET cff_field_handlers
-
-#else /* FT_CONFIG_OPTION_PIC */
-
-#include FT_SERVICE_GLYPH_DICT_H
-#include "cffparse.h"
-#include FT_SERVICE_POSTSCRIPT_INFO_H
-#include FT_SERVICE_POSTSCRIPT_NAME_H
-#include FT_SERVICE_TT_CMAP_H
-#include FT_SERVICE_CID_H
-#include FT_SERVICE_PROPERTIES_H
-#include FT_SERVICE_MULTIPLE_MASTERS_H
-#include FT_SERVICE_METRICS_VARIATIONS_H
-
-
-FT_BEGIN_HEADER
-
- typedef struct CffModulePIC_
- {
- FT_ServiceDescRec* cff_services;
- CFF_Field_Handler* cff_field_handlers;
- FT_Service_PsInfoRec cff_service_ps_info;
- FT_Service_GlyphDictRec cff_service_glyph_dict;
- FT_Service_PsFontNameRec cff_service_ps_name;
- FT_Service_TTCMapsRec cff_service_get_cmap_info;
- FT_Service_CIDRec cff_service_cid_info;
- FT_Service_PropertiesRec cff_service_properties;
- FT_Service_MultiMastersRec cff_service_multi_masters;
- FT_Service_MetricsVariationsRec cff_service_metrics_variations;
- FT_Service_CFFLoadRec cff_service_cff_load;
- FT_CMap_ClassRec cff_cmap_encoding_class_rec;
- FT_CMap_ClassRec cff_cmap_unicode_class_rec;
-
- } CffModulePIC;
-
-
-#define GET_PIC( lib ) \
- ( (CffModulePIC*)( (lib)->pic_container.cff ) )
-
-#define CFF_SERVICE_PS_INFO_GET \
- ( GET_PIC( library )->cff_service_ps_info )
-#define CFF_SERVICE_GLYPH_DICT_GET \
- ( GET_PIC( library )->cff_service_glyph_dict )
-#define CFF_SERVICE_PS_NAME_GET \
- ( GET_PIC( library )->cff_service_ps_name )
-#define CFF_SERVICE_GET_CMAP_INFO_GET \
- ( GET_PIC( library )->cff_service_get_cmap_info )
-#define CFF_SERVICE_CID_INFO_GET \
- ( GET_PIC( library )->cff_service_cid_info )
-#define CFF_SERVICE_PROPERTIES_GET \
- ( GET_PIC( library )->cff_service_properties )
-#define CFF_SERVICES_GET \
- ( GET_PIC( library )->cff_services )
-#define CFF_SERVICE_MULTI_MASTERS_GET \
- ( GET_PIC( library )->cff_service_multi_masters )
-#define CFF_SERVICE_METRICS_VAR_GET \
- ( GET_PIC( library )->cff_service_metrics_variations )
-#define CFF_SERVICE_CFF_LOAD_GET \
- ( GET_PIC( library )->cff_service_cff_load )
-#define CFF_CMAP_ENCODING_CLASS_REC_GET \
- ( GET_PIC( library )->cff_cmap_encoding_class_rec )
-#define CFF_CMAP_UNICODE_CLASS_REC_GET \
- ( GET_PIC( library )->cff_cmap_unicode_class_rec )
-#define CFF_FIELD_HANDLERS_GET \
- ( GET_PIC( library )->cff_field_handlers )
-
- /* see cffpic.c for the implementation */
- void
- cff_driver_class_pic_free( FT_Library library );
-
- FT_Error
- cff_driver_class_pic_init( FT_Library library );
-
-FT_END_HEADER
-
-#endif /* FT_CONFIG_OPTION_PIC */
-
- /* */
-
-#endif /* CFFPIC_H_ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/cfftoken.h b/src/3rdparty/freetype/src/cff/cfftoken.h
index 063a7b3be0..b61cb0e66e 100644
--- a/src/3rdparty/freetype/src/cff/cfftoken.h
+++ b/src/3rdparty/freetype/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
*
* CFF token definitions (specification only).
*
- * Copyright (C) 1996-2019 by
+ * Copyright (C) 1996-2023 by
* David Turner, Robert Wilhelm, and Werner Lemberg.
*
* This file is part of the FreeType project, and may only be used,
diff --git a/src/3rdparty/freetype/src/cff/cfftypes.h b/src/3rdparty/freetype/src/cff/cfftypes.h
deleted file mode 100644
index de8a5ee9b4..0000000000
--- a/src/3rdparty/freetype/src/cff/cfftypes.h
+++ /dev/null
@@ -1,284 +0,0 @@
-/***************************************************************************/
-/* */
-/* cfftypes.h */
-/* */
-/* Basic OpenType/CFF type definitions and interface (specification */
-/* only). */
-/* */
-/* Copyright 1996-2015 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 __CFFTYPES_H__
-#define __CFFTYPES_H__
-
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include FT_TYPE1_TABLES_H
-#include FT_INTERNAL_SERVICE_H
-#include FT_SERVICE_POSTSCRIPT_CMAPS_H
-#include FT_INTERNAL_POSTSCRIPT_HINTS_H
-
-
-FT_BEGIN_HEADER
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* CFF_IndexRec */
- /* */
- /* <Description> */
- /* A structure used to model a CFF Index table. */
- /* */
- /* <Fields> */
- /* stream :: The source input stream. */
- /* */
- /* start :: The position of the first index byte in the */
- /* input stream. */
- /* */
- /* count :: The number of elements in the index. */
- /* */
- /* off_size :: The size in bytes of object offsets in index. */
- /* */
- /* data_offset :: The position of first data byte in the index's */
- /* bytes. */
- /* */
- /* data_size :: The size of the data table in this index. */
- /* */
- /* offsets :: A table of element offsets in the index. Must be */
- /* loaded explicitly. */
- /* */
- /* bytes :: If the index is loaded in memory, its bytes. */
- /* */
- typedef struct CFF_IndexRec_
- {
- FT_Stream stream;
- FT_ULong start;
- FT_UInt count;
- FT_Byte off_size;
- FT_ULong data_offset;
- FT_ULong data_size;
-
- FT_ULong* offsets;
- FT_Byte* bytes;
-
- } CFF_IndexRec, *CFF_Index;
-
-
- typedef struct CFF_EncodingRec_
- {
- FT_UInt format;
- FT_ULong offset;
-
- FT_UInt count;
- FT_UShort sids [256]; /* avoid dynamic allocations */
- FT_UShort codes[256];
-
- } CFF_EncodingRec, *CFF_Encoding;
-
-
- typedef struct CFF_CharsetRec_
- {
-
- FT_UInt format;
- FT_ULong offset;
-
- FT_UShort* sids;
- FT_UShort* cids; /* the inverse mapping of `sids'; only needed */
- /* for CID-keyed fonts */
- FT_UInt max_cid;
- FT_UInt num_glyphs;
-
- } CFF_CharsetRec, *CFF_Charset;
-
-
- typedef struct CFF_FontRecDictRec_
- {
- FT_UInt version;
- FT_UInt notice;
- FT_UInt copyright;
- FT_UInt full_name;
- FT_UInt family_name;
- FT_UInt weight;
- FT_Bool is_fixed_pitch;
- FT_Fixed italic_angle;
- FT_Fixed underline_position;
- FT_Fixed underline_thickness;
- FT_Int paint_type;
- FT_Int charstring_type;
- FT_Matrix font_matrix;
- FT_Bool has_font_matrix;
- FT_ULong units_per_em; /* temporarily used as scaling value also */
- FT_Vector font_offset;
- FT_ULong unique_id;
- FT_BBox font_bbox;
- FT_Pos stroke_width;
- FT_ULong charset_offset;
- FT_ULong encoding_offset;
- FT_ULong charstrings_offset;
- FT_ULong private_offset;
- FT_ULong private_size;
- FT_Long synthetic_base;
- FT_UInt embedded_postscript;
-
- /* these should only be used for the top-level font dictionary */
- FT_UInt cid_registry;
- FT_UInt cid_ordering;
- FT_Long cid_supplement;
-
- FT_Long cid_font_version;
- FT_Long cid_font_revision;
- FT_Long cid_font_type;
- FT_ULong cid_count;
- FT_ULong cid_uid_base;
- FT_ULong cid_fd_array_offset;
- FT_ULong cid_fd_select_offset;
- FT_UInt cid_font_name;
-
- } CFF_FontRecDictRec, *CFF_FontRecDict;
-
-
- typedef struct CFF_PrivateRec_
- {
- FT_Byte num_blue_values;
- FT_Byte num_other_blues;
- FT_Byte num_family_blues;
- FT_Byte num_family_other_blues;
-
- FT_Pos blue_values[14];
- FT_Pos other_blues[10];
- FT_Pos family_blues[14];
- FT_Pos family_other_blues[10];
-
- FT_Fixed blue_scale;
- FT_Pos blue_shift;
- FT_Pos blue_fuzz;
- FT_Pos standard_width;
- FT_Pos standard_height;
-
- FT_Byte num_snap_widths;
- FT_Byte num_snap_heights;
- FT_Pos snap_widths[13];
- FT_Pos snap_heights[13];
- FT_Bool force_bold;
- FT_Fixed force_bold_threshold;
- FT_Int lenIV;
- FT_Int language_group;
- FT_Fixed expansion_factor;
- FT_Long initial_random_seed;
- FT_ULong local_subrs_offset;
- FT_Pos default_width;
- FT_Pos nominal_width;
-
- } CFF_PrivateRec, *CFF_Private;
-
-
- typedef struct CFF_FDSelectRec_
- {
- FT_Byte format;
- FT_UInt range_count;
-
- /* that's the table, taken from the file `as is' */
- FT_Byte* data;
- FT_UInt data_size;
-
- /* small cache for format 3 only */
- FT_UInt cache_first;
- FT_UInt cache_count;
- FT_Byte cache_fd;
-
- } CFF_FDSelectRec, *CFF_FDSelect;
-
-
- /* A SubFont packs a font dict and a private dict together. They are */
- /* needed to support CID-keyed CFF fonts. */
- typedef struct CFF_SubFontRec_
- {
- CFF_FontRecDictRec font_dict;
- CFF_PrivateRec private_dict;
-
- CFF_IndexRec local_subrs_index;
- FT_Byte** local_subrs; /* array of pointers into Local Subrs INDEX data */
-
- } CFF_SubFontRec, *CFF_SubFont;
-
-
-#define CFF_MAX_CID_FONTS 256
-
-
- typedef struct CFF_FontRec_
- {
- FT_Stream stream;
- FT_Memory memory;
- FT_UInt num_faces;
- FT_UInt num_glyphs;
-
- FT_Byte version_major;
- FT_Byte version_minor;
- FT_Byte header_size;
- FT_Byte absolute_offsize;
-
-
- CFF_IndexRec name_index;
- CFF_IndexRec top_dict_index;
- CFF_IndexRec global_subrs_index;
-
- CFF_EncodingRec encoding;
- CFF_CharsetRec charset;
-
- CFF_IndexRec charstrings_index;
- CFF_IndexRec font_dict_index;
- CFF_IndexRec private_index;
- CFF_IndexRec local_subrs_index;
-
- FT_String* font_name;
-
- /* array of pointers into Global Subrs INDEX data */
- FT_Byte** global_subrs;
-
- /* array of pointers into String INDEX data stored at string_pool */
- FT_UInt num_strings;
- FT_Byte** strings;
- FT_Byte* string_pool;
-
- CFF_SubFontRec top_font;
- FT_UInt num_subfonts;
- CFF_SubFont subfonts[CFF_MAX_CID_FONTS];
-
- CFF_FDSelectRec fd_select;
-
- /* interface to PostScript hinter */
- PSHinter_Service pshinter;
-
- /* interface to Postscript Names service */
- FT_Service_PsCMaps psnames;
-
- /* since version 2.3.0 */
- PS_FontInfoRec* font_info; /* font info dictionary */
-
- /* since version 2.3.6 */
- FT_String* registry;
- FT_String* ordering;
-
- /* since version 2.4.12 */
- FT_Generic cf2_instance;
-
- } CFF_FontRec, *CFF_Font;
-
-
-FT_END_HEADER
-
-#endif /* __CFFTYPES_H__ */
-
-
-/* END */
diff --git a/src/3rdparty/freetype/src/cff/module.mk b/src/3rdparty/freetype/src/cff/module.mk
index 8c610959d3..b881d049f3 100644
--- a/src/3rdparty/freetype/src/cff/module.mk
+++ b/src/3rdparty/freetype/src/cff/module.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2023 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,
diff --git a/src/3rdparty/freetype/src/cff/rules.mk b/src/3rdparty/freetype/src/cff/rules.mk
index 6e2dc476ef..629424adf7 100644
--- a/src/3rdparty/freetype/src/cff/rules.mk
+++ b/src/3rdparty/freetype/src/cff/rules.mk
@@ -3,7 +3,7 @@
#
-# Copyright (C) 1996-2019 by
+# Copyright (C) 1996-2023 by
# David Turner, Robert Wilhelm, and Werner Lemberg.
#
# This file is part of the FreeType project, and may only be used, modified,