From 637967042958b260fd903bfb6bad9c94c3fa40a4 Mon Sep 17 00:00:00 2001 From: UnknownShadow200 Date: Thu, 14 Mar 2019 18:39:20 +1100 Subject: [PATCH] remove more unused bits --- src/ClassiCube.vcxproj | 2 - src/ClassiCube.vcxproj.filters | 6 - src/EntityComponents.c | 4 - src/EntityComponents.h | 1 - src/Platform.c | 4 +- src/Program.c | 10 +- src/String.c | 5 - src/String.h | 3 +- src/Utils.c | 2 +- src/_ftbbox.c | 508 --------------------------------- src/_ftgasp.c | 61 ---- src/freetype/ftbbox.h | 95 ------ src/freetype/ftgasp.h | 136 --------- src/freetype/ftheader.h | 46 --- src/freetype/ftlist.h | 83 ------ src/freetype/ftmodapi.h | 3 - src/freetype/ftobjs.c | 81 ------ src/freetype/ftrender.h | 65 ----- src/freetype/ftutil.c | 91 ------ src/freetype/ftvalid.h | 5 - 20 files changed, 8 insertions(+), 1203 deletions(-) delete mode 100644 src/_ftbbox.c delete mode 100644 src/_ftgasp.c delete mode 100644 src/freetype/ftbbox.h delete mode 100644 src/freetype/ftgasp.h diff --git a/src/ClassiCube.vcxproj b/src/ClassiCube.vcxproj index 3079b7669..03176bdfc 100644 --- a/src/ClassiCube.vcxproj +++ b/src/ClassiCube.vcxproj @@ -314,10 +314,8 @@ - - diff --git a/src/ClassiCube.vcxproj.filters b/src/ClassiCube.vcxproj.filters index e19df5680..02f93edc0 100644 --- a/src/ClassiCube.vcxproj.filters +++ b/src/ClassiCube.vcxproj.filters @@ -467,18 +467,12 @@ Source Files\Freetype - - Source Files\Freetype - Source Files\Freetype Source Files\Freetype - - Source Files\Freetype - Source Files\Freetype diff --git a/src/EntityComponents.c b/src/EntityComponents.c index 22ecee458..7c4e7570b 100644 --- a/src/EntityComponents.c +++ b/src/EntityComponents.c @@ -171,10 +171,6 @@ bool HacksComp_CanJumpHigher(struct HacksComp* hacks) { return hacks->Enabled && hacks->CanAnyHacks && hacks->CanSpeed; } -bool HacksComp_Floating(struct HacksComp* hacks) { - return hacks->Noclip || hacks->Flying; -} - static String HacksComp_UNSAFE_FlagValue(const char* flagRaw, struct HacksComp* hacks) { String* joined = &hacks->HacksFlags; String flag = String_FromReadonly(flagRaw); diff --git a/src/EntityComponents.h b/src/EntityComponents.h index c3eb5a3c4..0d59e52e5 100644 --- a/src/EntityComponents.h +++ b/src/EntityComponents.h @@ -67,7 +67,6 @@ struct HacksComp { void HacksComp_Init(struct HacksComp* hacks); bool HacksComp_CanJumpHigher(struct HacksComp* hacks); -bool HacksComp_Floating(struct HacksComp* hacks); void HacksComp_SetUserType(struct HacksComp* hacks, uint8_t value, bool setBlockPerms); void HacksComp_CheckConsistency(struct HacksComp* hacks); void HacksComp_UpdateState(struct HacksComp* hacks); diff --git a/src/Platform.c b/src/Platform.c index ad74195bb..23c0c2ddc 100644 --- a/src/Platform.c +++ b/src/Platform.c @@ -4,9 +4,9 @@ #include "ExtMath.h" #include "Drawer2D.h" #include "Funcs.h" -#include "Http.h" #include "Bitmap.h" #include "Window.h" +#include "Utils.h" #include "freetype/ft2build.h" #include "freetype/freetype.h" @@ -39,9 +39,7 @@ #include #include -#define HTTP_QUERY_ETAG 54 /* Missing from some old MingW32 headers */ #define Socket__Error() WSAGetLastError() - static HANDLE heap; const char* Platform_NewLine = "\r\n"; diff --git a/src/Program.c b/src/Program.c index 27c1f8aac..3f2c5cfa7 100644 --- a/src/Program.c +++ b/src/Program.c @@ -84,7 +84,7 @@ static void Program_SetCurrentDirectory(void) { } /* Terminates the program due to an invalid command line argument */ -CC_NOINLINE static void Exit_InvalidArg(const char* name, const String* arg) { +CC_NOINLINE static void ExitInvalidArg(const char* name, const String* arg) { String tmp; char tmpBuffer[256]; String_InitArray(tmp, tmpBuffer); String_Format2(&tmp, "%c '%s'", name, arg); @@ -95,7 +95,7 @@ CC_NOINLINE static void Exit_InvalidArg(const char* name, const String* arg) { } /* Terminates the program due to insufficient command line arguments */ -CC_NOINLINE static void Exit_MissingArgs(int argsCount, const String* args) { +CC_NOINLINE static void ExitMissingArgs(int argsCount, const String* args) { String tmp; char tmpBuffer[256]; int i; String_InitArray(tmp, tmpBuffer); @@ -149,7 +149,7 @@ int main(int argc, char** argv) { String_Copy(&Game_Username, &args[0]); Program_RunGame(); } else if (argsCount < 4) { - Exit_MissingArgs(argsCount, args); + ExitMissingArgs(argsCount, args); return 1; } else { String_Copy(&Game_Username, &args[0]); @@ -157,11 +157,11 @@ int main(int argc, char** argv) { String_Copy(&Game_IPAddress, &args[2]); if (!Utils_ParseIP(&args[2], ip)) { - Exit_InvalidArg("Invalid IP", &args[2]); + ExitInvalidArg("Invalid IP", &args[2]); return 1; } if (!Convert_ParseUInt16(&args[3], &port)) { - Exit_InvalidArg("Invalid port", &args[3]); + ExitInvalidArg("Invalid port", &args[3]); return 1; } Game_Port = port; diff --git a/src/String.c b/src/String.c index c3349e4b4..0d5a6c2a5 100644 --- a/src/String.c +++ b/src/String.c @@ -778,11 +778,6 @@ void StringsBuffer_Clear(StringsBuffer* buffer) { StringsBuffer_Init(buffer); } -void StringsBuffer_Get(StringsBuffer* buffer, int i, String* str) { - String entry = StringsBuffer_UNSAFE_Get(buffer, i); - String_Copy(str, &entry); -} - String StringsBuffer_UNSAFE_Get(StringsBuffer* buffer, int i) { uint32_t flags, offset, len; if (i < 0 || i >= buffer->Count) Logger_Abort("Tried to get String past StringsBuffer end"); diff --git a/src/String.h b/src/String.h index 68c6d6f41..412f65a30 100644 --- a/src/String.h +++ b/src/String.h @@ -212,9 +212,8 @@ typedef struct StringsBuffer_ { /* Resets counts to 0, and frees any allocated memory. */ CC_API void StringsBuffer_Clear(StringsBuffer* buffer); -/* Copies the characters from the i'th string in the given buffer into the given string. */ -CC_API void StringsBuffer_Get(StringsBuffer* buffer, int i, String* str); /* UNSAFE: Returns a direct pointer to the i'th string in the given buffer. */ +/* You MUST NOT change the characters of this string. Copy to another string if necessary.*/ CC_API STRING_REF String StringsBuffer_UNSAFE_Get(StringsBuffer* buffer, int i); /* Adds a given string to the end of the given buffer. */ CC_API void StringsBuffer_Add(StringsBuffer* buffer, const String* str); diff --git a/src/Utils.c b/src/Utils.c index 0b327fd74..c326ac522 100644 --- a/src/Utils.c +++ b/src/Utils.c @@ -132,7 +132,7 @@ void Utils_UNSAFE_GetFilename(STRING_REF String* path) { int Utils_AccumulateWheelDelta(float* accumulator, float delta) { int steps; - /* Some mice may use deltas of say (0.2, 0.2, 0.2, 0.2, 0.2) */ + /* Some mice may use deltas of say (0.2, 0.3, 0.4, 0.1) */ /* We must use rounding at final step, not at every intermediate step. */ *accumulator += delta; steps = (int)(*accumulator); diff --git a/src/_ftbbox.c b/src/_ftbbox.c deleted file mode 100644 index 2f4379d43..000000000 --- a/src/_ftbbox.c +++ /dev/null @@ -1,508 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbbox.c */ -/* */ -/* FreeType bbox computation (body). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used */ -/* modified and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This component has a _single_ role: to compute exact outline bounding */ - /* boxes. */ - /* */ - /*************************************************************************/ - - -#include "freetype/ft2build.h" -#include FT_INTERNAL_DEBUG_H_FT - -#include FT_BBOX_H_FT -#include FT_IMAGE_H_FT -#include FT_OUTLINE_H_FT -#include FT_INTERNAL_CALC_H_FT -#include FT_INTERNAL_OBJECTS_H_FT - - - typedef struct TBBox_Rec_ - { - FT_Vector last; - FT_BBox bbox; - - } TBBox_Rec; - - -#define FT_UPDATE_BBOX( p, bbox ) \ - FT_BEGIN_STMNT \ - if ( p->x < bbox.xMin ) \ - bbox.xMin = p->x; \ - if ( p->x > bbox.xMax ) \ - bbox.xMax = p->x; \ - if ( p->y < bbox.yMin ) \ - bbox.yMin = p->y; \ - if ( p->y > bbox.yMax ) \ - bbox.yMax = p->y; \ - FT_END_STMNT - -#define CHECK_X( p, bbox ) \ - ( p->x < bbox.xMin || p->x > bbox.xMax ) - -#define CHECK_Y( p, bbox ) \ - ( p->y < bbox.yMin || p->y > bbox.yMax ) - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Move_To */ - /* */ - /* */ - /* This function is used as a `move_to' emitter during */ - /* FT_Outline_Decompose(). It simply records the destination point */ - /* in `user->last'. We also update bbox in case contour starts with */ - /* an implicit `on' point. */ - /* */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: A pointer to the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - static int - BBox_Move_To( FT_Vector* to, - TBBox_Rec* user ) - { - FT_UPDATE_BBOX( to, user->bbox ); - - user->last = *to; - - return 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Line_To */ - /* */ - /* */ - /* This function is used as a `line_to' emitter during */ - /* FT_Outline_Decompose(). It simply records the destination point */ - /* in `user->last'; no further computations are necessary because */ - /* bbox already contains both explicit ends of the line segment. */ - /* */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: A pointer to the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - static int - BBox_Line_To( FT_Vector* to, - TBBox_Rec* user ) - { - user->last = *to; - - return 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Conic_Check */ - /* */ - /* */ - /* Find the extrema of a 1-dimensional conic Bezier curve and update */ - /* a bounding range. This version uses direct computation, as it */ - /* doesn't need square roots. */ - /* */ - /* */ - /* y1 :: The start coordinate. */ - /* */ - /* y2 :: The coordinate of the control point. */ - /* */ - /* y3 :: The end coordinate. */ - /* */ - /* */ - /* min :: The address of the current minimum. */ - /* */ - /* max :: The address of the current maximum. */ - /* */ - static void - BBox_Conic_Check( FT_Pos y1, - FT_Pos y2, - FT_Pos y3, - FT_Pos* min, - FT_Pos* max ) - { - /* This function is only called when a control off-point is outside */ - /* the bbox that contains all on-points. It finds a local extremum */ - /* within the segment, equal to (y1*y3 - y2*y2)/(y1 - 2*y2 + y3). */ - /* Or, offsetting from y2, we get */ - - y1 -= y2; - y3 -= y2; - y2 += FT_MulDiv( y1, y3, y1 + y3 ); - - if ( y2 < *min ) - *min = y2; - if ( y2 > *max ) - *max = y2; - } - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Conic_To */ - /* */ - /* */ - /* This function is used as a `conic_to' emitter during */ - /* FT_Outline_Decompose(). It checks a conic Bezier curve with the */ - /* current bounding box, and computes its extrema if necessary to */ - /* update it. */ - /* */ - /* */ - /* control :: A pointer to a control point. */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: The address of the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - /* */ - /* In the case of a non-monotonous arc, we compute directly the */ - /* extremum coordinates, as it is sufficiently fast. */ - /* */ - static int - BBox_Conic_To( FT_Vector* control, - FT_Vector* to, - TBBox_Rec* user ) - { - /* in case `to' is implicit and not included in bbox yet */ - FT_UPDATE_BBOX( to, user->bbox ); - - if ( CHECK_X( control, user->bbox ) ) - BBox_Conic_Check( user->last.x, - control->x, - to->x, - &user->bbox.xMin, - &user->bbox.xMax ); - - if ( CHECK_Y( control, user->bbox ) ) - BBox_Conic_Check( user->last.y, - control->y, - to->y, - &user->bbox.yMin, - &user->bbox.yMax ); - - user->last = *to; - - return 0; - } - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Cubic_Check */ - /* */ - /* */ - /* Find the extrema of a 1-dimensional cubic Bezier curve and */ - /* update a bounding range. This version uses iterative splitting */ - /* because it is faster than the exact solution with square roots. */ - /* */ - /* */ - /* p1 :: The start coordinate. */ - /* */ - /* p2 :: The coordinate of the first control point. */ - /* */ - /* p3 :: The coordinate of the second control point. */ - /* */ - /* p4 :: The end coordinate. */ - /* */ - /* */ - /* min :: The address of the current minimum. */ - /* */ - /* max :: The address of the current maximum. */ - /* */ - static FT_Pos - cubic_peak( FT_Pos q1, - FT_Pos q2, - FT_Pos q3, - FT_Pos q4 ) - { - FT_Pos peak = 0; - FT_Int shift; - - - /* This function finds a peak of a cubic segment if it is above 0 */ - /* using iterative bisection of the segment, or returns 0. */ - /* The fixed-point arithmetic of bisection is inherently stable */ - /* but may loose accuracy in the two lowest bits. To compensate, */ - /* we upscale the segment if there is room. Large values may need */ - /* to be downscaled to avoid overflows during bisection. */ - /* It is called with either q2 or q3 positive, which is necessary */ - /* for the peak to exist and avoids undefined FT_MSB. */ - - shift = 27 - FT_MSB( (FT_UInt32)( FT_ABS( q1 ) | - FT_ABS( q2 ) | - FT_ABS( q3 ) | - FT_ABS( q4 ) ) ); - - if ( shift > 0 ) - { - /* upscaling too much just wastes time */ - if ( shift > 2 ) - shift = 2; - - q1 <<= shift; - q2 <<= shift; - q3 <<= shift; - q4 <<= shift; - } - else - { - q1 >>= -shift; - q2 >>= -shift; - q3 >>= -shift; - q4 >>= -shift; - } - - /* for a peak to exist above 0, the cubic segment must have */ - /* at least one of its control off-points above 0. */ - while ( q2 > 0 || q3 > 0 ) - { - /* determine which half contains the maximum and split */ - if ( q1 + q2 > q3 + q4 ) /* first half */ - { - q4 = q4 + q3; - q3 = q3 + q2; - q2 = q2 + q1; - q4 = q4 + q3; - q3 = q3 + q2; - q4 = ( q4 + q3 ) / 8; - q3 = q3 / 4; - q2 = q2 / 2; - } - else /* second half */ - { - q1 = q1 + q2; - q2 = q2 + q3; - q3 = q3 + q4; - q1 = q1 + q2; - q2 = q2 + q3; - q1 = ( q1 + q2 ) / 8; - q2 = q2 / 4; - q3 = q3 / 2; - } - - /* check whether either end reached the maximum */ - if ( q1 == q2 && q1 >= q3 ) - { - peak = q1; - break; - } - if ( q3 == q4 && q2 <= q4 ) - { - peak = q4; - break; - } - } - - if ( shift > 0 ) - peak >>= shift; - else - peak <<= -shift; - - return peak; - } - - - static void - BBox_Cubic_Check( FT_Pos p1, - FT_Pos p2, - FT_Pos p3, - FT_Pos p4, - FT_Pos* min, - FT_Pos* max ) - { - /* This function is only called when a control off-point is outside */ - /* the bbox that contains all on-points. So at least one of the */ - /* conditions below holds and cubic_peak is called with at least one */ - /* non-zero argument. */ - - if ( p2 > *max || p3 > *max ) - *max += cubic_peak( p1 - *max, p2 - *max, p3 - *max, p4 - *max ); - - /* now flip the signs to update the minimum */ - if ( p2 < *min || p3 < *min ) - *min -= cubic_peak( *min - p1, *min - p2, *min - p3, *min - p4 ); - } - - - /*************************************************************************/ - /* */ - /* */ - /* BBox_Cubic_To */ - /* */ - /* */ - /* This function is used as a `cubic_to' emitter during */ - /* FT_Outline_Decompose(). It checks a cubic Bezier curve with the */ - /* current bounding box, and computes its extrema if necessary to */ - /* update it. */ - /* */ - /* */ - /* control1 :: A pointer to the first control point. */ - /* */ - /* control2 :: A pointer to the second control point. */ - /* */ - /* to :: A pointer to the destination vector. */ - /* */ - /* */ - /* user :: The address of the current walk context. */ - /* */ - /* */ - /* Always 0. Needed for the interface only. */ - /* */ - /* */ - /* In the case of a non-monotonous arc, we don't compute directly */ - /* extremum coordinates, we subdivide instead. */ - /* */ - static int - BBox_Cubic_To( FT_Vector* control1, - FT_Vector* control2, - FT_Vector* to, - TBBox_Rec* user ) - { - /* We don't need to check `to' since it is always an on-point, */ - /* thus within the bbox. Only segments with an off-point outside */ - /* the bbox can possibly reach new extreme values. */ - - if ( CHECK_X( control1, user->bbox ) || - CHECK_X( control2, user->bbox ) ) - BBox_Cubic_Check( user->last.x, - control1->x, - control2->x, - to->x, - &user->bbox.xMin, - &user->bbox.xMax ); - - if ( CHECK_Y( control1, user->bbox ) || - CHECK_Y( control2, user->bbox ) ) - BBox_Cubic_Check( user->last.y, - control1->y, - control2->y, - to->y, - &user->bbox.yMin, - &user->bbox.yMax ); - - user->last = *to; - - return 0; - } - - - FT_DEFINE_OUTLINE_FUNCS( - bbox_interface, - - (FT_Outline_MoveTo_Func) BBox_Move_To, /* move_to */ - (FT_Outline_LineTo_Func) BBox_Line_To, /* line_to */ - (FT_Outline_ConicTo_Func)BBox_Conic_To, /* conic_to */ - (FT_Outline_CubicTo_Func)BBox_Cubic_To, /* cubic_to */ - 0, /* shift */ - 0 /* delta */ - ) - - - /* documentation is in ftbbox.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Outline_Get_BBox( FT_Outline* outline, - FT_BBox *abbox ) - { - FT_BBox cbox = { 0x7FFFFFFFL, 0x7FFFFFFFL, - -0x7FFFFFFFL, -0x7FFFFFFFL }; - FT_BBox bbox = { 0x7FFFFFFFL, 0x7FFFFFFFL, - -0x7FFFFFFFL, -0x7FFFFFFFL }; - FT_Vector* vec; - FT_UShort n; - - - if ( !abbox ) - return FT_THROW( Invalid_Argument ); - - if ( !outline ) - return FT_THROW( Invalid_Outline ); - - /* if outline is empty, return (0,0,0,0) */ - if ( outline->n_points == 0 || outline->n_contours <= 0 ) - { - abbox->xMin = abbox->xMax = 0; - abbox->yMin = abbox->yMax = 0; - - return 0; - } - - /* We compute the control box as well as the bounding box of */ - /* all `on' points in the outline. Then, if the two boxes */ - /* coincide, we exit immediately. */ - - vec = outline->points; - - for ( n = 0; n < outline->n_points; n++ ) - { - FT_UPDATE_BBOX( vec, cbox ); - - if ( FT_CURVE_TAG( outline->tags[n] ) == FT_CURVE_TAG_ON ) - FT_UPDATE_BBOX( vec, bbox ); - - vec++; - } - - /* test two boxes for equality */ - if ( cbox.xMin < bbox.xMin || cbox.xMax > bbox.xMax || - cbox.yMin < bbox.yMin || cbox.yMax > bbox.yMax ) - { - /* the two boxes are different, now walk over the outline to */ - /* get the Bezier arc extrema. */ - - FT_Error error; - TBBox_Rec user; - - user.bbox = bbox; - - error = FT_Outline_Decompose( outline, &bbox_interface, &user ); - if ( error ) - return error; - - *abbox = user.bbox; - } - else - *abbox = bbox; - - return FT_Err_Ok; - } - - -/* END */ diff --git a/src/_ftgasp.c b/src/_ftgasp.c deleted file mode 100644 index 1ce5f5fc7..000000000 --- a/src/_ftgasp.c +++ /dev/null @@ -1,61 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgasp.c */ -/* */ -/* Access of TrueType's `gasp' table (body). */ -/* */ -/* Copyright 2007-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - -#include "freetype/ft2build.h" -#include FT_GASP_H_FT -#include FT_INTERNAL_TRUETYPE_TYPES_H_FT - - - FT_EXPORT_DEF( FT_Int ) - FT_Get_Gasp( FT_Face face, - FT_UInt ppem ) - { - FT_Int result = FT_GASP_NO_TABLE; - - - if ( face && FT_IS_SFNT( face ) ) - { - TT_Face ttface = (TT_Face)face; - - - if ( ttface->gasp.numRanges > 0 ) - { - TT_GaspRange range = ttface->gasp.gaspRanges; - TT_GaspRange range_end = range + ttface->gasp.numRanges; - - - while ( ppem > range->maxPPEM ) - { - range++; - if ( range >= range_end ) - goto Exit; - } - - result = range->gaspFlag; - - /* ensure that we don't have spurious bits */ - if ( ttface->gasp.version == 0 ) - result &= 3; - } - } - Exit: - return result; - } - - -/* END */ diff --git a/src/freetype/ftbbox.h b/src/freetype/ftbbox.h deleted file mode 100644 index 610c3a8dc..000000000 --- a/src/freetype/ftbbox.h +++ /dev/null @@ -1,95 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftbbox.h */ -/* */ -/* FreeType exact bbox computation (specification). */ -/* */ -/* Copyright 1996-2018 by */ -/* David Turner, Robert Wilhelm, and Werner Lemberg. */ -/* */ -/* This file is part of the FreeType project, and may only be used, */ -/* modified, and distributed under the terms of the FreeType project */ -/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ -/* this file you indicate that you have read the license and */ -/* understand and accept it fully. */ -/* */ -/***************************************************************************/ - - - /*************************************************************************/ - /* */ - /* This component has a _single_ role: to compute exact outline bounding */ - /* boxes. */ - /* */ - /* It is separated from the rest of the engine for various technical */ - /* reasons. It may well be integrated in `ftoutln' later. */ - /* */ - /*************************************************************************/ - - -#ifndef FTBBOX_H_ -#define FTBBOX_H_ - - -#include "ft2build.h" -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /*************************************************************************/ - /* */ - /*
*/ - /* outline_processing */ - /* */ - /*************************************************************************/ - - - /*************************************************************************/ - /* */ - /* */ - /* FT_Outline_Get_BBox */ - /* */ - /* */ - /* Compute the exact bounding box of an outline. This is slower */ - /* than computing the control box. However, it uses an advanced */ - /* algorithm that returns _very_ quickly when the two boxes */ - /* coincide. Otherwise, the outline Bezier arcs are traversed to */ - /* extract their extrema. */ - /* */ - /* */ - /* outline :: A pointer to the source outline. */ - /* */ - /* */ - /* abbox :: The outline's exact bounding box. */ - /* */ - /* */ - /* FreeType error code. 0~means success. */ - /* */ - /* */ - /* If the font is tricky and the glyph has been loaded with */ - /* @FT_LOAD_NO_SCALE, the resulting BBox is meaningless. To get */ - /* reasonable values for the BBox it is necessary to load the glyph */ - /* at a large ppem value (so that the hinting instructions can */ - /* properly shift and scale the subglyphs), then extracting the BBox, */ - /* which can be eventually converted back to font units. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Outline_Get_BBox( FT_Outline* outline, - FT_BBox *abbox ); - - /* */ - - -FT_END_HEADER - -#endif /* FTBBOX_H_ */ - - -/* END */ - - -/* Local Variables: */ -/* coding: utf-8 */ -/* End: */ diff --git a/src/freetype/ftgasp.h b/src/freetype/ftgasp.h deleted file mode 100644 index 7562986f6..000000000 --- a/src/freetype/ftgasp.h +++ /dev/null @@ -1,136 +0,0 @@ -/***************************************************************************/ -/* */ -/* ftgasp.h */ -/* */ -/* Access of TrueType's `gasp' table (specification). */ -/* */ -/* Copyright 2007-2018 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 FTGASP_H_ -#define FTGASP_H_ - -#include "ft2build.h" -#include FT_FREETYPE_H - - -FT_BEGIN_HEADER - - - /*************************************************************************** - * - * @section: - * gasp_table - * - * @title: - * Gasp Table - * - * @abstract: - * Retrieving TrueType `gasp' table entries. - * - * @description: - * The function @FT_Get_Gasp can be used to query a TrueType or OpenType - * font for specific entries in its `gasp' table, if any. This is - * mainly useful when implementing native TrueType hinting with the - * bytecode interpreter to duplicate the Windows text rendering results. - */ - - /************************************************************************* - * - * @enum: - * FT_GASP_XXX - * - * @description: - * A list of values and/or bit-flags returned by the @FT_Get_Gasp - * function. - * - * @values: - * FT_GASP_NO_TABLE :: - * This special value means that there is no GASP table in this face. - * It is up to the client to decide what to do. - * - * FT_GASP_DO_GRIDFIT :: - * Grid-fitting and hinting should be performed at the specified ppem. - * This *really* means TrueType bytecode interpretation. If this bit - * is not set, no hinting gets applied. - * - * FT_GASP_DO_GRAY :: - * Anti-aliased rendering should be performed at the specified ppem. - * If not set, do monochrome rendering. - * - * FT_GASP_SYMMETRIC_SMOOTHING :: - * If set, smoothing along multiple axes must be used with ClearType. - * - * FT_GASP_SYMMETRIC_GRIDFIT :: - * Grid-fitting must be used with ClearType's symmetric smoothing. - * - * @note: - * The bit-flags `FT_GASP_DO_GRIDFIT' and `FT_GASP_DO_GRAY' are to be - * used for standard font rasterization only. Independently of that, - * `FT_GASP_SYMMETRIC_SMOOTHING' and `FT_GASP_SYMMETRIC_GRIDFIT' are to - * be used if ClearType is enabled (and `FT_GASP_DO_GRIDFIT' and - * `FT_GASP_DO_GRAY' are consequently ignored). - * - * `ClearType' is Microsoft's implementation of LCD rendering, partly - * protected by patents. - * - * @since: - * 2.3.0 - */ -#define FT_GASP_NO_TABLE -1 -#define FT_GASP_DO_GRIDFIT 0x01 -#define FT_GASP_DO_GRAY 0x02 -#define FT_GASP_SYMMETRIC_GRIDFIT 0x04 -#define FT_GASP_SYMMETRIC_SMOOTHING 0x08 - - - /************************************************************************* - * - * @func: - * FT_Get_Gasp - * - * @description: - * For a TrueType or OpenType font file, return the rasterizer behaviour - * flags from the font's `gasp' table corresponding to a given - * character pixel size. - * - * @input: - * face :: The source face handle. - * - * ppem :: The vertical character pixel size. - * - * @return: - * Bit flags (see @FT_GASP_XXX), or @FT_GASP_NO_TABLE if there is no - * `gasp' table in the face. - * - * @note: - * If you want to use the MM functionality of OpenType variation fonts - * (i.e., using @FT_Set_Var_Design_Coordinates and friends), call this - * function *after* setting an instance since the return values can - * change. - * - * @since: - * 2.3.0 - */ - FT_EXPORT( FT_Int ) - FT_Get_Gasp( FT_Face face, - FT_UInt ppem ); - - /* */ - - -FT_END_HEADER - -#endif /* FTGASP_H_ */ - - -/* END */ diff --git a/src/freetype/ftheader.h b/src/freetype/ftheader.h index c89ce2c3b..e1ce4e1d7 100644 --- a/src/freetype/ftheader.h +++ b/src/freetype/ftheader.h @@ -630,31 +630,6 @@ #define FT_LCD_FILTER_H "ftlcdfil.h" - /************************************************************************* - * - * @macro: - * FT_INCREMENTAL_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which performs incremental glyph loading. - */ -#define FT_INCREMENTAL_H "ftincrem.h" - - - /************************************************************************* - * - * @macro: - * FT_GASP_H - * - * @description: - * A macro used in #include statements to name the file containing the - * FreeType~2 API which returns entries from the TrueType GASP table. - */ -#define FT_GASP_H "ftgasp.h" -#define FT_GASP_H_FT "freetype/ftgasp.h" - - /************************************************************************* * * @macro: @@ -673,27 +648,6 @@ #define FT_ERROR_DEFINITIONS_H "fterrdef.h" #define FT_PARAMETER_TAGS_H "ftparams.h" - /* Deprecated macros. */ -#define FT_UNPATENTED_HINTING_H "ftparams.h" -#define FT_TRUETYPE_UNPATENTED_H "ftparams.h" - - /* FT_CACHE_H is the only header file needed for the cache subsystem. */ -#define FT_CACHE_IMAGE_H FT_CACHE_H -#define FT_CACHE_SMALL_BITMAPS_H FT_CACHE_H -#define FT_CACHE_CHARMAP_H FT_CACHE_H - - /* The internals of the cache sub-system are no longer exposed. We */ - /* default to FT_CACHE_H at the moment just in case, but we know of */ - /* no rogue client that uses them. */ - /* */ -#define FT_CACHE_MANAGER_H FT_CACHE_H -#define FT_CACHE_INTERNAL_MRU_H FT_CACHE_H -#define FT_CACHE_INTERNAL_MANAGER_H FT_CACHE_H -#define FT_CACHE_INTERNAL_CACHE_H FT_CACHE_H -#define FT_CACHE_INTERNAL_GLYPH_H FT_CACHE_H -#define FT_CACHE_INTERNAL_IMAGE_H FT_CACHE_H -#define FT_CACHE_INTERNAL_SBITS_H FT_CACHE_H - /* * Include internal headers definitions from diff --git a/src/freetype/ftlist.h b/src/freetype/ftlist.h index 4197f03a2..8c04d9972 100644 --- a/src/freetype/ftlist.h +++ b/src/freetype/ftlist.h @@ -57,11 +57,8 @@ FT_BEGIN_HEADER /* FT_ListNodeRec */ /* */ /* FT_List_Add */ - /* FT_List_Insert */ /* FT_List_Find */ /* FT_List_Remove */ - /* FT_List_Up */ - /* FT_List_Iterate */ /* FT_List_Iterator */ /* FT_List_Finalize */ /* FT_List_Destructor */ @@ -106,23 +103,6 @@ FT_BEGIN_HEADER FT_ListNode node ); - /*************************************************************************/ - /* */ - /* */ - /* FT_List_Insert */ - /* */ - /* */ - /* Insert an element at the head of a list. */ - /* */ - /* */ - /* list :: A pointer to parent list. */ - /* node :: The node to insert. */ - /* */ - FT_EXPORT( void ) - FT_List_Insert( FT_List list, - FT_ListNode node ); - - /*************************************************************************/ /* */ /* */ @@ -143,69 +123,6 @@ FT_BEGIN_HEADER FT_ListNode node ); - /*************************************************************************/ - /* */ - /* */ - /* FT_List_Up */ - /* */ - /* */ - /* Move a node to the head/top of a list. Used to maintain LRU */ - /* lists. */ - /* */ - /* */ - /* list :: A pointer to the parent list. */ - /* node :: The node to move. */ - /* */ - FT_EXPORT( void ) - FT_List_Up( FT_List list, - FT_ListNode node ); - - - /*************************************************************************/ - /* */ - /* */ - /* FT_List_Iterator */ - /* */ - /* */ - /* An FT_List iterator function that is called during a list parse */ - /* by @FT_List_Iterate. */ - /* */ - /* */ - /* node :: The current iteration list node. */ - /* */ - /* user :: A typeless pointer passed to @FT_List_Iterate. */ - /* Can be used to point to the iteration's state. */ - /* */ - typedef FT_Error - (*FT_List_Iterator)( FT_ListNode node, - void* user ); - - - /*************************************************************************/ - /* */ - /* */ - /* FT_List_Iterate */ - /* */ - /* */ - /* Parse a list and calls a given iterator function on each element. */ - /* Note that parsing is stopped as soon as one of the iterator calls */ - /* returns a non-zero value. */ - /* */ - /* */ - /* list :: A handle to the list. */ - /* iterator :: An iterator function, called on each node of the list. */ - /* user :: A user-supplied field that is passed as the second */ - /* argument to the iterator. */ - /* */ - /* */ - /* The result (a FreeType error code) of the last iterator call. */ - /* */ - FT_EXPORT( FT_Error ) - FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ); - - /*************************************************************************/ /* */ /* */ diff --git a/src/freetype/ftmodapi.h b/src/freetype/ftmodapi.h index b88822ac4..6e54f6fb7 100644 --- a/src/freetype/ftmodapi.h +++ b/src/freetype/ftmodapi.h @@ -88,9 +88,6 @@ FT_BEGIN_HEADER /* FT_Renderer */ /* FT_Renderer_Class */ /* */ - /* FT_Get_Renderer */ - /* FT_Set_Renderer */ - /* */ /* FT_Set_Debug_Hook */ /* */ /*************************************************************************/ diff --git a/src/freetype/ftobjs.c b/src/freetype/ftobjs.c index 2ab03011b..6155d5b35 100644 --- a/src/freetype/ftobjs.c +++ b/src/freetype/ftobjs.c @@ -90,16 +90,6 @@ } - FT_BASE_DEF( FT_Int ) - ft_validator_run( FT_Validator valid ) - { - /* This function doesn't work! None should call it. */ - FT_UNUSED( valid ); - - return -1; - } - - FT_BASE_DEF( void ) ft_validator_error( FT_Validator valid, FT_Error error ) @@ -3515,77 +3505,6 @@ } - /* documentation is in ftrender.h */ - - FT_EXPORT_DEF( FT_Renderer ) - FT_Get_Renderer( FT_Library library, - FT_Glyph_Format format ) - { - /* test for valid `library' delayed to `FT_Lookup_Renderer' */ - - return FT_Lookup_Renderer( library, format, 0 ); - } - - - /* documentation is in ftrender.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_Set_Renderer( FT_Library library, - FT_Renderer renderer, - FT_UInt num_params, - FT_Parameter* parameters ) - { - FT_ListNode node; - FT_Error error = FT_Err_Ok; - - FT_Renderer_SetModeFunc set_mode; - - - if ( !library ) - { - error = FT_THROW( Invalid_Library_Handle ); - goto Exit; - } - - if ( !renderer ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - if ( num_params > 0 && !parameters ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - node = FT_List_Find( &library->renderers, renderer ); - if ( !node ) - { - error = FT_THROW( Invalid_Argument ); - goto Exit; - } - - FT_List_Up( &library->renderers, node ); - - if ( renderer->glyph_format == FT_GLYPH_FORMAT_OUTLINE ) - library->cur_renderer = renderer; - - set_mode = renderer->clazz->set_mode; - - for ( ; num_params > 0; num_params-- ) - { - error = set_mode( renderer, parameters->tag, parameters->data ); - if ( error ) - break; - parameters++; - } - - Exit: - return error; - } - - FT_BASE_DEF( FT_Error ) FT_Render_Glyph_Internal( FT_Library library, FT_GlyphSlot slot, diff --git a/src/freetype/ftrender.h b/src/freetype/ftrender.h index 8b47ceb18..e84236a00 100644 --- a/src/freetype/ftrender.h +++ b/src/freetype/ftrender.h @@ -157,71 +157,6 @@ FT_BEGIN_HEADER } FT_Renderer_Class; - - /*************************************************************************/ - /* */ - /* */ - /* FT_Get_Renderer */ - /* */ - /* */ - /* Retrieve the current renderer for a given glyph format. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* format :: The glyph format. */ - /* */ - /* */ - /* A renderer handle. 0~if none found. */ - /* */ - /* */ - /* An error will be returned if a module already exists by that name, */ - /* or if the module requires a version of FreeType that is too great. */ - /* */ - /* To add a new renderer, simply use @FT_Add_Module. To retrieve a */ - /* renderer by its name, use @FT_Get_Module. */ - /* */ - FT_EXPORT( FT_Renderer ) - FT_Get_Renderer( FT_Library library, - FT_Glyph_Format format ); - - - /*************************************************************************/ - /* */ - /* */ - /* FT_Set_Renderer */ - /* */ - /* */ - /* Set the current renderer to use, and set additional mode. */ - /* */ - /* */ - /* library :: A handle to the library object. */ - /* */ - /* */ - /* renderer :: A handle to the renderer object. */ - /* */ - /* num_params :: The number of additional parameters. */ - /* */ - /* parameters :: Additional parameters. */ - /* */ - /* */ - /* FreeType error code. 0~means success. */ - /* */ - /* */ - /* In case of success, the renderer will be used to convert glyph */ - /* images in the renderer's known format into bitmaps. */ - /* */ - /* This doesn't change the current renderer for other formats. */ - /* */ - /* Currently, no FreeType renderer module uses `parameters'; you */ - /* should thus always pass NULL as the value. */ - /* */ - FT_EXPORT( FT_Error ) - FT_Set_Renderer( FT_Library library, - FT_Renderer renderer, - FT_UInt num_params, - FT_Parameter* parameters ); - /* */ diff --git a/src/freetype/ftutil.c b/src/freetype/ftutil.c index ec1ba9ba4..d774408ec 100644 --- a/src/freetype/ftutil.c +++ b/src/freetype/ftutil.c @@ -289,32 +289,6 @@ } - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Insert( FT_List list, - FT_ListNode node ) - { - FT_ListNode after; - - - if ( !list || !node ) - return; - - after = list->head; - - node->next = after; - node->prev = NULL; - - if ( !after ) - list->tail = node; - else - after->prev = node; - - list->head = node; - } - - /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) @@ -342,71 +316,6 @@ } - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( void ) - FT_List_Up( FT_List list, - FT_ListNode node ) - { - FT_ListNode before, after; - - - if ( !list || !node ) - return; - - before = node->prev; - after = node->next; - - /* check whether we are already on top of the list */ - if ( !before ) - return; - - before->next = after; - - if ( after ) - after->prev = before; - else - list->tail = before; - - node->prev = NULL; - node->next = list->head; - list->head->prev = node; - list->head = node; - } - - - /* documentation is in ftlist.h */ - - FT_EXPORT_DEF( FT_Error ) - FT_List_Iterate( FT_List list, - FT_List_Iterator iterator, - void* user ) - { - FT_ListNode cur; - FT_Error error = FT_Err_Ok; - - - if ( !list || !iterator ) - return FT_THROW( Invalid_Argument ); - - cur = list->head; - - while ( cur ) - { - FT_ListNode next = cur->next; - - - error = iterator( cur, user ); - if ( error ) - break; - - cur = next; - } - - return error; - } - - /* documentation is in ftlist.h */ FT_EXPORT_DEF( void ) diff --git a/src/freetype/ftvalid.h b/src/freetype/ftvalid.h index 190b679f6..8febee959 100644 --- a/src/freetype/ftvalid.h +++ b/src/freetype/ftvalid.h @@ -109,11 +109,6 @@ FT_BEGIN_HEADER const FT_Byte* limit, FT_ValidationLevel level ); - /* Do not use this. It's broken and will cause your validator to crash */ - /* if you run it on an invalid font. */ - FT_BASE( FT_Int ) - ft_validator_run( FT_Validator valid ); - /* Sets the error field in a validator, then calls `longjmp' to return */ /* to high-level caller. Using `setjmp/longjmp' avoids many stupid */ /* error checks within the validation routines. */