[truetype] Remove Infinality for good.

Remove everything ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY,
which was undefined for a while now.

* include/freetype/internal/tttypes.h: Ditto.
* src/truetype/truetype.c: Ditto.
* src/truetype/ttdriver.c: Ditto.
* src/truetype/ttgload.c: Ditto.
* src/truetype/ttinterp.c: Ditto.
* src/truetype/ttinterp.h: Ditto.
* src/truetype/ttobjs.c: Ditto.
* src/truetype/ttsubpix.[ch]: Remove files.
* src/truetype/rules.mk: Don't reference "ttsubpix.c".
This commit is contained in:
Alexei Podtelezhnikov 2023-07-26 22:33:44 -04:00
parent 9e3c5d7e18
commit 84332214be
10 changed files with 25 additions and 2245 deletions

View File

@ -1597,13 +1597,6 @@ FT_BEGIN_HEADER
FT_ULong horz_metrics_offset;
FT_ULong vert_metrics_offset;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* since 2.4.12 */
FT_ULong sph_found_func_flags; /* special functions found */
/* for this face */
FT_Bool sph_compatibility_mode;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_CONFIG_OPTION_EMBEDDED_BITMAPS
/* since 2.7 */
FT_ULong ebdt_start; /* either `CBDT', `EBDT', or `bdat' */

View File

@ -33,8 +33,7 @@ TT_DRV_SRC := $(TT_DIR)/ttdriver.c \
$(TT_DIR)/ttgxvar.c \
$(TT_DIR)/ttinterp.c \
$(TT_DIR)/ttobjs.c \
$(TT_DIR)/ttpload.c \
$(TT_DIR)/ttsubpix.c
$(TT_DIR)/ttpload.c
# TrueType driver headers
#

View File

@ -24,7 +24,6 @@
#include "ttinterp.c"
#include "ttobjs.c" /* object manager */
#include "ttpload.c" /* tables loader */
#include "ttsubpix.c"
/* END */

View File

@ -100,11 +100,6 @@
break;
case TT_INTERPRETER_VERSION_38:
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
break;
#endif
case TT_INTERPRETER_VERSION_40:
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
driver->interpreter_version = TT_INTERPRETER_VERSION_40;

View File

@ -35,7 +35,6 @@
#endif
#include "tterrors.h"
#include "ttsubpix.h"
/**************************************************************************
@ -152,9 +151,6 @@
FT_UInt glyph_index )
{
TT_Face face = loader->face;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
#endif
FT_Error error;
FT_Stream stream = loader->stream;
@ -183,20 +179,6 @@
loader->top_bearing = top_bearing;
loader->vadvance = advance_height;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
loader->exec )
{
loader->exec->sph_tweak_flags = 0;
/* This may not be the right place for this, but it works... */
/* Note that we have to unconditionally load the tweaks since */
/* it is possible that glyphs individually switch ClearType's */
/* backward compatibility mode on and off. */
sph_set_tweaks( loader, glyph_index );
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef FT_CONFIG_OPTION_INCREMENTAL
/* With the incremental interface, these values are set by */
/* a call to `tt_get_metrics_incremental'. */
@ -798,8 +780,7 @@
TT_Hint_Glyph( TT_Loader loader,
FT_Bool is_composite )
{
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
TT_Face face = loader->face;
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
#endif
@ -887,17 +868,6 @@
}
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
if ( exec->sph_tweak_flags & SPH_TWEAK_DEEMBOLDEN )
FT_Outline_EmboldenXY( &loader->gloader->current.outline, -24, 0 );
else if ( exec->sph_tweak_flags & SPH_TWEAK_EMBOLDEN )
FT_Outline_EmboldenXY( &loader->gloader->current.outline, 24, 0 );
}
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
return FT_Err_Ok;
}
@ -960,16 +930,6 @@
}
{
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
TT_Face face = loader->face;
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( face );
FT_String* family = face->root.family_name;
FT_UInt ppem = loader->size->metrics->x_ppem;
FT_String* style = face->root.style_name;
FT_UInt x_scale_factor = 1000;
#endif
FT_Vector* vec = outline->points;
FT_Vector* limit = outline->points + n_points;
@ -979,52 +939,6 @@
FT_Bool do_scale = FALSE;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
/* scale, but only if enabled and only if TT hinting is being used */
if ( IS_HINTED( loader->load_flags ) )
x_scale_factor = sph_test_tweak_x_scaling( face,
family,
ppem,
style,
loader->glyph_index );
/* scale the glyph */
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 ||
x_scale_factor != 1000 )
{
x_scale = FT_MulDiv( loader->size->metrics->x_scale,
(FT_Long)x_scale_factor, 1000 );
y_scale = loader->size->metrics->y_scale;
/* compensate for any scaling by de/emboldening; */
/* the amount was determined via experimentation */
if ( x_scale_factor != 1000 && ppem > 11 )
{
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
FT_Vector* orig_points = outline->points;
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
outline->points = unrounded;
#endif
FT_Outline_EmboldenXY( outline,
FT_MulFix( 1280 * ppem,
1000 - x_scale_factor ),
0 );
#ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
if ( !IS_DEFAULT_INSTANCE( FT_FACE( loader->face ) ) )
outline->points = orig_points;
#endif
}
do_scale = TRUE;
}
}
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
/* scale the glyph */
if ( ( loader->load_flags & FT_LOAD_NO_SCALE ) == 0 )
@ -1460,15 +1374,6 @@
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
subpixel_hinting = loader->exec ? loader->exec->subpixel_hinting
: 0;
grayscale = loader->exec ? loader->exec->grayscale
: 0;
}
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
{
@ -2277,8 +2182,7 @@
#ifdef TT_USE_BYTECODE_INTERPRETER
FT_Error error;
FT_Bool pedantic = FT_BOOL( load_flags & FT_LOAD_PEDANTIC );
#if defined TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY || \
defined TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
TT_Driver driver = (TT_Driver)FT_FACE_DRIVER( glyph->face );
#endif
#endif
@ -2298,20 +2202,6 @@
FT_Bool grayscale_cleartype;
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
FT_Bool subpixel_hinting = FALSE;
#if 0
/* not used yet */
FT_Bool compatible_widths;
FT_Bool symmetrical_smoothing;
FT_Bool bgr;
FT_Bool vertical_lcd;
FT_Bool subpixel_positioned;
FT_Bool gray_cleartype;
#endif
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
FT_Bool reexecute = FALSE;
@ -2356,65 +2246,6 @@
}
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
subpixel_hinting = FT_BOOL( ( FT_LOAD_TARGET_MODE( load_flags ) !=
FT_RENDER_MODE_MONO ) &&
SPH_OPTION_SET_SUBPIXEL );
if ( subpixel_hinting )
grayscale = FALSE;
else if ( SPH_OPTION_SET_GRAYSCALE )
{
grayscale = TRUE;
subpixel_hinting = FALSE;
}
else
grayscale = FALSE;
if ( FT_IS_TRICKY( glyph->face ) )
subpixel_hinting = FALSE;
exec->ignore_x_mode = subpixel_hinting || grayscale;
exec->rasterizer_version = SPH_OPTION_SET_RASTERIZER_VERSION;
if ( exec->sph_tweak_flags & SPH_TWEAK_RASTERIZER_35 )
exec->rasterizer_version = TT_INTERPRETER_VERSION_35;
#if 1
exec->compatible_widths = SPH_OPTION_SET_COMPATIBLE_WIDTHS;
exec->symmetrical_smoothing = TRUE;
exec->bgr = FALSE;
exec->vertical_lcd = FALSE;
exec->subpixel_positioned = TRUE;
exec->gray_cleartype = FALSE;
#else /* 0 */
exec->compatible_widths =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_COMPATIBLE_WIDTHS );
exec->symmetrical_smoothing =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_SYMMETRICAL_SMOOTHING );
exec->bgr =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_BGR );
exec->vertical_lcd =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_VERTICAL_LCD );
exec->subpixel_positioned =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_SUBPIXEL_POSITIONED );
exec->gray_cleartype =
FT_BOOL( FT_LOAD_TARGET_MODE( load_flags ) !=
TT_LOAD_GRAY_CLEARTYPE );
#endif /* 0 */
}
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_40 )
grayscale = FT_BOOL( !subpixel_hinting_lean &&
@ -2429,36 +2260,6 @@
if ( error )
return error;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 )
{
/* a change from mono to subpixel rendering (and vice versa) */
/* requires a re-execution of the CVT program */
if ( subpixel_hinting != exec->subpixel_hinting )
{
FT_TRACE4(( "tt_loader_init: subpixel hinting change,"
" re-executing `prep' table\n" ));
exec->subpixel_hinting = subpixel_hinting;
reexecute = TRUE;
}
/* a change from mono to grayscale rendering (and vice versa) */
/* requires a re-execution of the CVT program */
if ( grayscale != exec->grayscale )
{
FT_TRACE4(( "tt_loader_init: grayscale hinting change,"
" re-executing `prep' table\n" ));
exec->grayscale = grayscale;
reexecute = TRUE;
}
}
else
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
{
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
@ -2518,14 +2319,6 @@
if ( exec->GS.instruct_control & 2 )
exec->GS = tt_default_graphics_state;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/* check whether we have a font hinted for ClearType -- */
/* note that this flag can also be modified in a glyph's bytecode */
if ( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
exec->GS.instruct_control & 4 )
exec->ignore_x_mode = FALSE;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
/*
* Toggle backward compatibility according to what font wants, except
@ -2561,13 +2354,6 @@
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
!( driver->interpreter_version == TT_INTERPRETER_VERSION_40 &&
exec->backward_compatibility ) &&
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
!( driver->interpreter_version == TT_INTERPRETER_VERSION_38 &&
!SPH_OPTION_BITMAP_WIDTHS &&
FT_LOAD_TARGET_MODE( loader->load_flags ) !=
FT_RENDER_MODE_MONO &&
exec->compatible_widths ) &&
#endif
!face->postscript.isFixedPitch )
{

File diff suppressed because it is too large Load Diff

View File

@ -98,48 +98,6 @@ FT_BEGIN_HEADER
} TT_CallRec, *TT_CallStack;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/**************************************************************************
*
* These structures define rules used to tweak subpixel hinting for
* various fonts. "", 0, "", NULL value indicates to match any value.
*/
#define SPH_MAX_NAME_SIZE 32
#define SPH_MAX_CLASS_MEMBERS 100
typedef struct SPH_TweakRule_
{
const char family[SPH_MAX_NAME_SIZE];
const FT_UInt ppem;
const char style[SPH_MAX_NAME_SIZE];
const FT_ULong glyph;
} SPH_TweakRule;
typedef struct SPH_ScaleRule_
{
const char family[SPH_MAX_NAME_SIZE];
const FT_UInt ppem;
const char style[SPH_MAX_NAME_SIZE];
const FT_ULong glyph;
const FT_ULong scale;
} SPH_ScaleRule;
typedef struct SPH_Font_Class_
{
const char name[SPH_MAX_NAME_SIZE];
const char member[SPH_MAX_CLASS_MEMBERS][SPH_MAX_NAME_SIZE];
} SPH_Font_Class;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
/**************************************************************************
*
* The main structure for the interpreter which collects all necessary
@ -399,38 +357,6 @@ FT_BEGIN_HEADER
FT_Bool grayscale_cleartype;
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL */
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
TT_Round_Func func_round_sphn; /* subpixel rounding function */
FT_Bool subpixel_hinting; /* Using subpixel hinting? */
FT_Bool ignore_x_mode; /* Standard rendering mode for */
/* subpixel hinting. On if gray */
/* or subpixel hinting is on. */
/* The following 6 aren't fully implemented but here for MS rasterizer */
/* compatibility. */
FT_Bool compatible_widths; /* compatible widths? */
FT_Bool symmetrical_smoothing; /* symmetrical_smoothing? */
FT_Bool bgr; /* bgr instead of rgb? */
FT_Bool vertical_lcd; /* long side of LCD subpixel */
/* rectangles is horizontal */
FT_Bool subpixel_positioned; /* subpixel positioned */
/* (DirectWrite ClearType)? */
FT_Bool gray_cleartype; /* ClearType hinting but */
/* grayscale rendering */
FT_Int rasterizer_version; /* MS rasterizer version */
FT_Bool iup_called; /* IUP called for glyph? */
FT_ULong sph_tweak_flags; /* flags to control */
/* hint tweaks */
FT_ULong sph_in_func_flags; /* flags to indicate if in */
/* special functions */
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
/* We maintain two counters (in addition to the instruction counter) */
/* that act as loop detectors for LOOPCALL and jump opcodes with */
/* negative arguments. */

View File

@ -1481,9 +1481,6 @@
TT_Driver driver = (TT_Driver)ttdriver;
driver->interpreter_version = TT_INTERPRETER_VERSION_35;
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
driver->interpreter_version = TT_INTERPRETER_VERSION_38;
#endif
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_MINIMAL
driver->interpreter_version = TT_INTERPRETER_VERSION_40;
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,110 +0,0 @@
/****************************************************************************
*
* ttsubpix.h
*
* TrueType Subpixel Hinting.
*
* Copyright (C) 2010-2023 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 TTSUBPIX_H_
#define TTSUBPIX_H_
#include "ttobjs.h"
#include "ttinterp.h"
FT_BEGIN_HEADER
#ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY
/**************************************************************************
*
* ID flags to identify special functions at FDEF and runtime.
*
*/
#define SPH_FDEF_INLINE_DELTA_1 0x0000001
#define SPH_FDEF_INLINE_DELTA_2 0x0000002
#define SPH_FDEF_DIAGONAL_STROKE 0x0000004
#define SPH_FDEF_VACUFORM_ROUND_1 0x0000008
#define SPH_FDEF_TTFAUTOHINT_1 0x0000010
#define SPH_FDEF_SPACING_1 0x0000020
#define SPH_FDEF_SPACING_2 0x0000040
#define SPH_FDEF_TYPEMAN_STROKES 0x0000080
#define SPH_FDEF_TYPEMAN_DIAGENDCTRL 0x0000100
/**************************************************************************
*
* Tweak flags that are set for each glyph by the below rules.
*
*/
#define SPH_TWEAK_ALLOW_X_DMOVE 0x0000001UL
#define SPH_TWEAK_ALWAYS_DO_DELTAP 0x0000002UL
#define SPH_TWEAK_ALWAYS_SKIP_DELTAP 0x0000004UL
#define SPH_TWEAK_COURIER_NEW_2_HACK 0x0000008UL
#define SPH_TWEAK_DEEMBOLDEN 0x0000010UL
#define SPH_TWEAK_DO_SHPIX 0x0000020UL
#define SPH_TWEAK_EMBOLDEN 0x0000040UL
#define SPH_TWEAK_MIAP_HACK 0x0000080UL
#define SPH_TWEAK_NORMAL_ROUND 0x0000100UL
#define SPH_TWEAK_NO_ALIGNRP_AFTER_IUP 0x0000200UL
#define SPH_TWEAK_NO_CALL_AFTER_IUP 0x0000400UL
#define SPH_TWEAK_NO_DELTAP_AFTER_IUP 0x0000800UL
#define SPH_TWEAK_PIXEL_HINTING 0x0001000UL
#define SPH_TWEAK_RASTERIZER_35 0x0002000UL
#define SPH_TWEAK_ROUND_NONPIXEL_Y_MOVES 0x0004000UL
#define SPH_TWEAK_SKIP_IUP 0x0008000UL
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES 0x0010000UL
#define SPH_TWEAK_SKIP_OFFPIXEL_Y_MOVES 0x0020000UL
#define SPH_TWEAK_TIMES_NEW_ROMAN_HACK 0x0040000UL
#define SPH_TWEAK_SKIP_NONPIXEL_Y_MOVES_DELTAP 0x0080000UL
FT_LOCAL( FT_Bool )
sph_test_tweak( TT_Face face,
const FT_String* family,
FT_UInt ppem,
const FT_String* style,
FT_UInt glyph_index,
const SPH_TweakRule* rule,
FT_UInt num_rules );
FT_LOCAL( FT_UInt )
sph_test_tweak_x_scaling( TT_Face face,
const FT_String* family,
FT_UInt ppem,
const FT_String* style,
FT_UInt glyph_index );
FT_LOCAL( void )
sph_set_tweaks( TT_Loader loader,
FT_UInt glyph_index );
/* These macros are defined absent a method for setting them */
#define SPH_OPTION_BITMAP_WIDTHS FALSE
#define SPH_OPTION_SET_SUBPIXEL TRUE
#define SPH_OPTION_SET_GRAYSCALE FALSE
#define SPH_OPTION_SET_COMPATIBLE_WIDTHS FALSE
#define SPH_OPTION_SET_RASTERIZER_VERSION 38
#endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */
FT_END_HEADER
#endif /* TTSUBPIX_H_ */
/* END */