mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 12:05:14 -04:00
remove more unused bits
This commit is contained in:
parent
c1afbb76ab
commit
6379670429
@ -314,10 +314,8 @@
|
|||||||
<ClCompile Include="_autofit.c" />
|
<ClCompile Include="_autofit.c" />
|
||||||
<ClCompile Include="_cff.c" />
|
<ClCompile Include="_cff.c" />
|
||||||
<ClCompile Include="_ftbase.c" />
|
<ClCompile Include="_ftbase.c" />
|
||||||
<ClCompile Include="_ftbbox.c" />
|
|
||||||
<ClCompile Include="_ftbitmap.c" />
|
<ClCompile Include="_ftbitmap.c" />
|
||||||
<ClCompile Include="_ftcid.c" />
|
<ClCompile Include="_ftcid.c" />
|
||||||
<ClCompile Include="_ftgasp.c" />
|
|
||||||
<ClCompile Include="_ftglyph.c" />
|
<ClCompile Include="_ftglyph.c" />
|
||||||
<ClCompile Include="_ftinit.c" />
|
<ClCompile Include="_ftinit.c" />
|
||||||
<ClCompile Include="_ftsynth.c" />
|
<ClCompile Include="_ftsynth.c" />
|
||||||
|
@ -467,18 +467,12 @@
|
|||||||
<ClCompile Include="_ftbase.c">
|
<ClCompile Include="_ftbase.c">
|
||||||
<Filter>Source Files\Freetype</Filter>
|
<Filter>Source Files\Freetype</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="_ftbbox.c">
|
|
||||||
<Filter>Source Files\Freetype</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="_ftbitmap.c">
|
<ClCompile Include="_ftbitmap.c">
|
||||||
<Filter>Source Files\Freetype</Filter>
|
<Filter>Source Files\Freetype</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="_ftcid.c">
|
<ClCompile Include="_ftcid.c">
|
||||||
<Filter>Source Files\Freetype</Filter>
|
<Filter>Source Files\Freetype</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="_ftgasp.c">
|
|
||||||
<Filter>Source Files\Freetype</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="_ftglyph.c">
|
<ClCompile Include="_ftglyph.c">
|
||||||
<Filter>Source Files\Freetype</Filter>
|
<Filter>Source Files\Freetype</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -171,10 +171,6 @@ bool HacksComp_CanJumpHigher(struct HacksComp* hacks) {
|
|||||||
return hacks->Enabled && hacks->CanAnyHacks && hacks->CanSpeed;
|
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) {
|
static String HacksComp_UNSAFE_FlagValue(const char* flagRaw, struct HacksComp* hacks) {
|
||||||
String* joined = &hacks->HacksFlags;
|
String* joined = &hacks->HacksFlags;
|
||||||
String flag = String_FromReadonly(flagRaw);
|
String flag = String_FromReadonly(flagRaw);
|
||||||
|
@ -67,7 +67,6 @@ struct HacksComp {
|
|||||||
|
|
||||||
void HacksComp_Init(struct HacksComp* hacks);
|
void HacksComp_Init(struct HacksComp* hacks);
|
||||||
bool HacksComp_CanJumpHigher(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_SetUserType(struct HacksComp* hacks, uint8_t value, bool setBlockPerms);
|
||||||
void HacksComp_CheckConsistency(struct HacksComp* hacks);
|
void HacksComp_CheckConsistency(struct HacksComp* hacks);
|
||||||
void HacksComp_UpdateState(struct HacksComp* hacks);
|
void HacksComp_UpdateState(struct HacksComp* hacks);
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
#include "ExtMath.h"
|
#include "ExtMath.h"
|
||||||
#include "Drawer2D.h"
|
#include "Drawer2D.h"
|
||||||
#include "Funcs.h"
|
#include "Funcs.h"
|
||||||
#include "Http.h"
|
|
||||||
#include "Bitmap.h"
|
#include "Bitmap.h"
|
||||||
#include "Window.h"
|
#include "Window.h"
|
||||||
|
#include "Utils.h"
|
||||||
|
|
||||||
#include "freetype/ft2build.h"
|
#include "freetype/ft2build.h"
|
||||||
#include "freetype/freetype.h"
|
#include "freetype/freetype.h"
|
||||||
@ -39,9 +39,7 @@
|
|||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <wincrypt.h>
|
#include <wincrypt.h>
|
||||||
|
|
||||||
#define HTTP_QUERY_ETAG 54 /* Missing from some old MingW32 headers */
|
|
||||||
#define Socket__Error() WSAGetLastError()
|
#define Socket__Error() WSAGetLastError()
|
||||||
|
|
||||||
static HANDLE heap;
|
static HANDLE heap;
|
||||||
const char* Platform_NewLine = "\r\n";
|
const char* Platform_NewLine = "\r\n";
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ static void Program_SetCurrentDirectory(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Terminates the program due to an invalid command line argument */
|
/* 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 tmp; char tmpBuffer[256];
|
||||||
String_InitArray(tmp, tmpBuffer);
|
String_InitArray(tmp, tmpBuffer);
|
||||||
String_Format2(&tmp, "%c '%s'", name, arg);
|
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 */
|
/* 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];
|
String tmp; char tmpBuffer[256];
|
||||||
int i;
|
int i;
|
||||||
String_InitArray(tmp, tmpBuffer);
|
String_InitArray(tmp, tmpBuffer);
|
||||||
@ -149,7 +149,7 @@ int main(int argc, char** argv) {
|
|||||||
String_Copy(&Game_Username, &args[0]);
|
String_Copy(&Game_Username, &args[0]);
|
||||||
Program_RunGame();
|
Program_RunGame();
|
||||||
} else if (argsCount < 4) {
|
} else if (argsCount < 4) {
|
||||||
Exit_MissingArgs(argsCount, args);
|
ExitMissingArgs(argsCount, args);
|
||||||
return 1;
|
return 1;
|
||||||
} else {
|
} else {
|
||||||
String_Copy(&Game_Username, &args[0]);
|
String_Copy(&Game_Username, &args[0]);
|
||||||
@ -157,11 +157,11 @@ int main(int argc, char** argv) {
|
|||||||
String_Copy(&Game_IPAddress, &args[2]);
|
String_Copy(&Game_IPAddress, &args[2]);
|
||||||
|
|
||||||
if (!Utils_ParseIP(&args[2], ip)) {
|
if (!Utils_ParseIP(&args[2], ip)) {
|
||||||
Exit_InvalidArg("Invalid IP", &args[2]);
|
ExitInvalidArg("Invalid IP", &args[2]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!Convert_ParseUInt16(&args[3], &port)) {
|
if (!Convert_ParseUInt16(&args[3], &port)) {
|
||||||
Exit_InvalidArg("Invalid port", &args[3]);
|
ExitInvalidArg("Invalid port", &args[3]);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
Game_Port = port;
|
Game_Port = port;
|
||||||
|
@ -778,11 +778,6 @@ void StringsBuffer_Clear(StringsBuffer* buffer) {
|
|||||||
StringsBuffer_Init(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) {
|
String StringsBuffer_UNSAFE_Get(StringsBuffer* buffer, int i) {
|
||||||
uint32_t flags, offset, len;
|
uint32_t flags, offset, len;
|
||||||
if (i < 0 || i >= buffer->Count) Logger_Abort("Tried to get String past StringsBuffer end");
|
if (i < 0 || i >= buffer->Count) Logger_Abort("Tried to get String past StringsBuffer end");
|
||||||
|
@ -212,9 +212,8 @@ typedef struct StringsBuffer_ {
|
|||||||
|
|
||||||
/* Resets counts to 0, and frees any allocated memory. */
|
/* Resets counts to 0, and frees any allocated memory. */
|
||||||
CC_API void StringsBuffer_Clear(StringsBuffer* buffer);
|
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. */
|
/* 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);
|
CC_API STRING_REF String StringsBuffer_UNSAFE_Get(StringsBuffer* buffer, int i);
|
||||||
/* Adds a given string to the end of the given buffer. */
|
/* Adds a given string to the end of the given buffer. */
|
||||||
CC_API void StringsBuffer_Add(StringsBuffer* buffer, const String* str);
|
CC_API void StringsBuffer_Add(StringsBuffer* buffer, const String* str);
|
||||||
|
@ -132,7 +132,7 @@ void Utils_UNSAFE_GetFilename(STRING_REF String* path) {
|
|||||||
|
|
||||||
int Utils_AccumulateWheelDelta(float* accumulator, float delta) {
|
int Utils_AccumulateWheelDelta(float* accumulator, float delta) {
|
||||||
int steps;
|
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. */
|
/* We must use rounding at final step, not at every intermediate step. */
|
||||||
*accumulator += delta;
|
*accumulator += delta;
|
||||||
steps = (int)(*accumulator);
|
steps = (int)(*accumulator);
|
||||||
|
508
src/_ftbbox.c
508
src/_ftbbox.c
@ -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 )
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Move_To */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* to :: A pointer to the destination vector. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* user :: A pointer to the current walk context. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Line_To */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* to :: A pointer to the destination vector. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* user :: A pointer to the current walk context. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* Always 0. Needed for the interface only. */
|
|
||||||
/* */
|
|
||||||
static int
|
|
||||||
BBox_Line_To( FT_Vector* to,
|
|
||||||
TBBox_Rec* user )
|
|
||||||
{
|
|
||||||
user->last = *to;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Conic_Check */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* y1 :: The start coordinate. */
|
|
||||||
/* */
|
|
||||||
/* y2 :: The coordinate of the control point. */
|
|
||||||
/* */
|
|
||||||
/* y3 :: The end coordinate. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Conic_To */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* control :: A pointer to a control point. */
|
|
||||||
/* */
|
|
||||||
/* to :: A pointer to the destination vector. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* user :: The address of the current walk context. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* Always 0. Needed for the interface only. */
|
|
||||||
/* */
|
|
||||||
/* <Note> */
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Cubic_Check */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* p1 :: The start coordinate. */
|
|
||||||
/* */
|
|
||||||
/* p2 :: The coordinate of the first control point. */
|
|
||||||
/* */
|
|
||||||
/* p3 :: The coordinate of the second control point. */
|
|
||||||
/* */
|
|
||||||
/* p4 :: The end coordinate. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* 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 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* BBox_Cubic_To */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* control1 :: A pointer to the first control point. */
|
|
||||||
/* */
|
|
||||||
/* control2 :: A pointer to the second control point. */
|
|
||||||
/* */
|
|
||||||
/* to :: A pointer to the destination vector. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* user :: The address of the current walk context. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* Always 0. Needed for the interface only. */
|
|
||||||
/* */
|
|
||||||
/* <Note> */
|
|
||||||
/* 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 */
|
|
@ -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 */
|
|
@ -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
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Section> */
|
|
||||||
/* outline_processing */
|
|
||||||
/* */
|
|
||||||
/*************************************************************************/
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_Outline_Get_BBox */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* outline :: A pointer to the source outline. */
|
|
||||||
/* */
|
|
||||||
/* <Output> */
|
|
||||||
/* abbox :: The outline's exact bounding box. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* FreeType error code. 0~means success. */
|
|
||||||
/* */
|
|
||||||
/* <Note> */
|
|
||||||
/* 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: */
|
|
@ -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 */
|
|
@ -630,31 +630,6 @@
|
|||||||
#define FT_LCD_FILTER_H "ftlcdfil.h"
|
#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:
|
* @macro:
|
||||||
@ -673,27 +648,6 @@
|
|||||||
#define FT_ERROR_DEFINITIONS_H "fterrdef.h"
|
#define FT_ERROR_DEFINITIONS_H "fterrdef.h"
|
||||||
#define FT_PARAMETER_TAGS_H "ftparams.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 <internal/...>
|
* Include internal headers definitions from <internal/...>
|
||||||
|
@ -57,11 +57,8 @@ FT_BEGIN_HEADER
|
|||||||
/* FT_ListNodeRec */
|
/* FT_ListNodeRec */
|
||||||
/* */
|
/* */
|
||||||
/* FT_List_Add */
|
/* FT_List_Add */
|
||||||
/* FT_List_Insert */
|
|
||||||
/* FT_List_Find */
|
/* FT_List_Find */
|
||||||
/* FT_List_Remove */
|
/* FT_List_Remove */
|
||||||
/* FT_List_Up */
|
|
||||||
/* FT_List_Iterate */
|
|
||||||
/* FT_List_Iterator */
|
/* FT_List_Iterator */
|
||||||
/* FT_List_Finalize */
|
/* FT_List_Finalize */
|
||||||
/* FT_List_Destructor */
|
/* FT_List_Destructor */
|
||||||
@ -106,23 +103,6 @@ FT_BEGIN_HEADER
|
|||||||
FT_ListNode node );
|
FT_ListNode node );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_List_Insert */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Insert an element at the head of a list. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* list :: A pointer to parent list. */
|
|
||||||
/* node :: The node to insert. */
|
|
||||||
/* */
|
|
||||||
FT_EXPORT( void )
|
|
||||||
FT_List_Insert( FT_List list,
|
|
||||||
FT_ListNode node );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <Function> */
|
/* <Function> */
|
||||||
@ -143,69 +123,6 @@ FT_BEGIN_HEADER
|
|||||||
FT_ListNode node );
|
FT_ListNode node );
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_List_Up */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Move a node to the head/top of a list. Used to maintain LRU */
|
|
||||||
/* lists. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* list :: A pointer to the parent list. */
|
|
||||||
/* node :: The node to move. */
|
|
||||||
/* */
|
|
||||||
FT_EXPORT( void )
|
|
||||||
FT_List_Up( FT_List list,
|
|
||||||
FT_ListNode node );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <FuncType> */
|
|
||||||
/* FT_List_Iterator */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* An FT_List iterator function that is called during a list parse */
|
|
||||||
/* by @FT_List_Iterate. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* 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 );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_List_Iterate */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* 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. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* 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 );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* <FuncType> */
|
/* <FuncType> */
|
||||||
|
@ -88,9 +88,6 @@ FT_BEGIN_HEADER
|
|||||||
/* FT_Renderer */
|
/* FT_Renderer */
|
||||||
/* FT_Renderer_Class */
|
/* FT_Renderer_Class */
|
||||||
/* */
|
/* */
|
||||||
/* FT_Get_Renderer */
|
|
||||||
/* FT_Set_Renderer */
|
|
||||||
/* */
|
|
||||||
/* FT_Set_Debug_Hook */
|
/* FT_Set_Debug_Hook */
|
||||||
/* */
|
/* */
|
||||||
/*************************************************************************/
|
/*************************************************************************/
|
||||||
|
@ -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_BASE_DEF( void )
|
||||||
ft_validator_error( FT_Validator valid,
|
ft_validator_error( FT_Validator valid,
|
||||||
FT_Error error )
|
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_BASE_DEF( FT_Error )
|
||||||
FT_Render_Glyph_Internal( FT_Library library,
|
FT_Render_Glyph_Internal( FT_Library library,
|
||||||
FT_GlyphSlot slot,
|
FT_GlyphSlot slot,
|
||||||
|
@ -157,71 +157,6 @@ FT_BEGIN_HEADER
|
|||||||
|
|
||||||
} FT_Renderer_Class;
|
} FT_Renderer_Class;
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_Get_Renderer */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Retrieve the current renderer for a given glyph format. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* library :: A handle to the library object. */
|
|
||||||
/* */
|
|
||||||
/* format :: The glyph format. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* A renderer handle. 0~if none found. */
|
|
||||||
/* */
|
|
||||||
/* <Note> */
|
|
||||||
/* 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 );
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* <Function> */
|
|
||||||
/* FT_Set_Renderer */
|
|
||||||
/* */
|
|
||||||
/* <Description> */
|
|
||||||
/* Set the current renderer to use, and set additional mode. */
|
|
||||||
/* */
|
|
||||||
/* <InOut> */
|
|
||||||
/* library :: A handle to the library object. */
|
|
||||||
/* */
|
|
||||||
/* <Input> */
|
|
||||||
/* renderer :: A handle to the renderer object. */
|
|
||||||
/* */
|
|
||||||
/* num_params :: The number of additional parameters. */
|
|
||||||
/* */
|
|
||||||
/* parameters :: Additional parameters. */
|
|
||||||
/* */
|
|
||||||
/* <Return> */
|
|
||||||
/* FreeType error code. 0~means success. */
|
|
||||||
/* */
|
|
||||||
/* <Note> */
|
|
||||||
/* 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 );
|
|
||||||
|
|
||||||
/* */
|
/* */
|
||||||
|
|
||||||
|
|
||||||
|
@ -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 */
|
/* documentation is in ftlist.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF( void )
|
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 */
|
/* documentation is in ftlist.h */
|
||||||
|
|
||||||
FT_EXPORT_DEF( void )
|
FT_EXPORT_DEF( void )
|
||||||
|
@ -109,11 +109,6 @@ FT_BEGIN_HEADER
|
|||||||
const FT_Byte* limit,
|
const FT_Byte* limit,
|
||||||
FT_ValidationLevel level );
|
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 */
|
/* Sets the error field in a validator, then calls `longjmp' to return */
|
||||||
/* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
|
/* to high-level caller. Using `setjmp/longjmp' avoids many stupid */
|
||||||
/* error checks within the validation routines. */
|
/* error checks within the validation routines. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user