From 32243c508974e41624da1170b29ad8219e3bc824 Mon Sep 17 00:00:00 2001 From: Khaled Hosny Date: Wed, 1 Aug 2018 14:22:13 +0200 Subject: [PATCH] No need to obfuscate these pointers --- libpsautohint/src/ac.c | 10 +- libpsautohint/src/ac.h | 161 +++++++++++++-------------- libpsautohint/src/auto.c | 184 +++++++++++++++---------------- libpsautohint/src/bbox.c | 36 +++--- libpsautohint/src/bbox.h | 4 +- libpsautohint/src/charpath.c | 52 ++++----- libpsautohint/src/charpath.h | 22 ++-- libpsautohint/src/charpathpriv.c | 16 +-- libpsautohint/src/charprop.c | 16 +-- libpsautohint/src/check.c | 24 ++-- libpsautohint/src/control.c | 50 ++++----- libpsautohint/src/eval.c | 42 +++---- libpsautohint/src/fix.c | 22 ++-- libpsautohint/src/flat.c | 6 +- libpsautohint/src/gen.c | 86 +++++++-------- libpsautohint/src/head.c | 36 +++--- libpsautohint/src/merge.c | 36 +++--- libpsautohint/src/misc.c | 32 +++--- libpsautohint/src/pick.c | 54 ++++----- libpsautohint/src/read.c | 16 +-- libpsautohint/src/report.c | 62 +++++------ libpsautohint/src/shuffle.c | 10 +- libpsautohint/src/write.c | 30 ++--- 23 files changed, 502 insertions(+), 505 deletions(-) diff --git a/libpsautohint/src/ac.c b/libpsautohint/src/ac.c index 83bcb1575..362287475 100644 --- a/libpsautohint/src/ac.c +++ b/libpsautohint/src/ac.c @@ -12,7 +12,7 @@ #define MAXSTEMDIST 150 /* initial maximum stem width allowed for hints */ -PPathElt gPathStart, gPathEnd; +PathElt *gPathStart, *gPathEnd; bool gUseV, gUseH, gAutoVFix, gAutoHFix, gAutoLinearCurveFix, gEditGlyph; bool gHasFlex, gFlexOK, gFlexStrict, gBandError; Fixed gHBigDist, gVBigDist, gInitBigDist, gMinDist, gGhostWidth, gGhostLength, @@ -22,12 +22,12 @@ Fixed gPruneA, gPruneB, gPruneC, gPruneD, gPruneValue, gBonus; float gTheta, gHBigDistR, gVBigDistR, gMaxVal, gMinVal; int32_t gLenTopBands, gLenBotBands, gNumSerifs, gDMin, gDelta, gCPpercent; int32_t gBendTan, gSCurveTan; -PHintVal gVHinting, gHHinting, gVPrimary, gHPrimary, gValList; -PHintSeg gSegLists[4]; +HintVal *gVHinting, *gHHinting, *gVPrimary, *gHPrimary, *gValList; +HintSeg* gSegLists[4]; Fixed gVStems[MAXSTEMS], gHStems[MAXSTEMS]; int32_t gNumVStems, gNumHStems; Fixed gTopBands[MAXBLUES], gBotBands[MAXBLUES], gSerifs[MAXSERIFS]; -PHintPoint gPointList, *gPtLstArray; +HintPoint *gPointList, **gPtLstArray; int32_t gPtLstIndex, gNumPtLsts, gMaxPtLsts; bool gWriteHintedBez = true; Fixed gBlueFuzz; @@ -123,7 +123,7 @@ InitData(const ACFontInfo* fontinfo, int32_t reason) /* ?? Does this cause a leak ?? */ gPointList = NULL; gMaxPtLsts = 5; - gPtLstArray = (PHintPoint*)Alloc(gMaxPtLsts * sizeof(PHintPoint)); + gPtLstArray = (HintPoint**)Alloc(gMaxPtLsts * sizeof(HintPoint*)); gPtLstIndex = 0; gPtLstArray[0] = NULL; gNumPtLsts = 1; diff --git a/libpsautohint/src/ac.h b/libpsautohint/src/ac.h index 8f540d7cd..e633462fe 100644 --- a/libpsautohint/src/ac.h +++ b/libpsautohint/src/ac.h @@ -52,10 +52,9 @@ /* structures */ /* glyph point coordinates */ -typedef struct - { +typedef struct { int32_t x, y; - } Cd, *CdPtr; + } Cd; typedef struct { int16_t limit; @@ -63,7 +62,7 @@ typedef struct { void (*report)(Cd); Cd ll, ur; Fixed llx, lly; - } FltnRec, *PFltnRec; + } FltnRec; typedef struct _hintseg { struct _hintseg *sNxt; @@ -84,24 +83,22 @@ typedef struct _hintseg { /* set by AddSegment in gen.c */ int16_t sType; /* tells what type of segment this is: sLINE sBEND sCURVE or sGHOST */ - } HintSeg, *PHintSeg; + } HintSeg; -typedef struct _seglnk { - PHintSeg seg; - } SegLnk, *PSegLnk; +typedef struct { + HintSeg* seg; + } SegLnk; typedef struct _seglnklst { struct _seglnklst *next; - PSegLnk lnk; + SegLnk* lnk; } SegLnkLst; -typedef SegLnkLst *PSegLnkLst; - #if 0 typedef struct _hintrep { Fixed vVal, vSpc, vLoc1, vLoc2; struct _hintval *vBst; - } HintRep, *PHintRep; + } HintRep; typedef struct _hintval { struct _hintval *vNxt; @@ -110,10 +107,10 @@ typedef struct _hintval { /* vBot=vLoc1, vTop=vLoc2, vLft=vLoc1, vRght=vLoc2 */ int16_t vGhst:8; int16_t pruned:8; - PHintSeg vSeg1, vSeg2; + HintSeg* vSeg1, *vSeg2; struct _hintval *vBst; - PHintRep vRep; - } HintVal, *PHintVal; + HintRep* vRep; + } HintVal; #else typedef struct _hintval { struct _hintval *vNxt; @@ -136,35 +133,35 @@ typedef struct _hintval { unsigned int merge:1; /* flag used by ReplaceVals in merge.c */ unsigned int unused:13; - PHintSeg vSeg1, vSeg2; + HintSeg *vSeg1, *vSeg2; /* vSeg1 points to the left HintSeg in a vertical, bottom in a horizontal */ /* vSeg2 points to the right HintSeg in a vertical, top in a horizontal */ struct _hintval *vBst; /* points to another HintVal if this one has been merged or replaced */ - } HintVal, *PHintVal; + } HintVal; #endif typedef struct _pthelt { struct _pthelt *prev, *next, *conflict; int16_t type; - PSegLnkLst Hs, Vs; + SegLnkLst *Hs, *Vs; bool Hcopy:1, Vcopy:1, isFlex:1, yFlex:1, newCP:1, sol:1, eol:1; int unused:9; int16_t count, newhints; Fixed x, y, x1, y1, x2, y2, x3, y3; - } PathElt, *PPathElt; + } PathElt; typedef struct _hintpnt { struct _hintpnt *next; Fixed x0, y0, x1, y1; /* for vstem, only interested in x0 and x1 */ /* for hstem, only interested in y0 and y1 */ - PPathElt p0, p1; + PathElt *p0, *p1; /* p0 is source of x0,y0; p1 is source of x1,y1 */ char c; /* tells what kind of hinting: 'b' 'y' 'm' or 'v' */ bool done; - } HintPoint, *PHintPoint; + } HintPoint; typedef struct { char *key, *value; @@ -185,7 +182,7 @@ typedef struct { extern ACBuffer* gBezOutput; -extern PPathElt gPathStart, gPathEnd; +extern PathElt* gPathStart, *gPathEnd; extern bool gUseV, gUseH, gAutoVFix, gAutoHFix, gAutoLinearCurveFix; extern bool gEditGlyph; /* whether glyph can be modified when adding hints */ extern bool gBandError; @@ -196,9 +193,9 @@ extern Fixed gHBigDist, gVBigDist, gInitBigDist, gMinDist, gGhostWidth, extern Fixed gPruneA, gPruneB, gPruneC, gPruneD, gPruneValue, gBonus; extern float gTheta, gHBigDistR, gVBigDistR, gMaxVal, gMinVal; extern int32_t gDMin, gDelta, gCPpercent, gBendTan, gSCurveTan; -extern PHintVal gVHinting, gHHinting, gVPrimary, gHPrimary, gValList; -extern PHintSeg gSegLists[4]; /* left, right, top, bot */ -extern PHintPoint gPointList, *gPtLstArray; +extern HintVal *gVHinting, *gHHinting, *gVPrimary, *gHPrimary, *gValList; +extern HintSeg* gSegLists[4]; /* left, right, top, bot */ +extern HintPoint* gPointList, **gPtLstArray; extern int32_t gPtLstIndex, gNumPtLsts, gMaxPtLsts; extern bool gScalingHints; @@ -288,8 +285,8 @@ unsigned char* Alloc(int32_t sz); /* Sub-allocator */ int AddCounterHintGlyphs(char* charlist, char* HintList[]); bool FindNameInList(char* nm, char** lst); void PruneElementHintSegs(void); -int TestHintLst(PSegLnkLst lst, PHintVal hintList, bool flg, bool doLst); -PHintVal CopyHints(PHintVal lst); +int TestHintLst(SegLnkLst* lst, HintVal* hintList, bool flg, bool doLst); +HintVal* CopyHints(HintVal* lst); void AutoExtraHints(bool movetoNewHints, bool soleol, int32_t solWhere); int32_t SpecialGlyphType(void); bool VHintGlyph(void); @@ -300,42 +297,42 @@ bool SpecialSolEol(void); bool MoveToNewHints(void); bool GetInflectionPoint(Fixed, Fixed, Fixed, Fixed, Fixed, Fixed, Fixed, Fixed, Fixed *); void CheckSmooth(void); -void CheckBBoxEdge(PPathElt e, bool vrt, Fixed lc, Fixed* pf, Fixed* pl); +void CheckBBoxEdge(PathElt* e, bool vrt, Fixed lc, Fixed* pf, Fixed* pl); bool CheckSmoothness(Fixed x0, Fixed cy0, Fixed x1, Fixed cy1, Fixed x2, Fixed y2, Fixed* pd); void CheckForDups(void); -void AddHintPoint(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch, PPathElt p0, - PPathElt p1); -void AddHPair(PHintVal v, char ch); -void AddVPair(PHintVal v, char ch); -void XtraHints(PPathElt e); +void AddHintPoint(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch, PathElt* p0, + PathElt* p1); +void AddHPair(HintVal* v, char ch); +void AddVPair(HintVal* v, char ch); +void XtraHints(PathElt* e); bool AutoHintGlyph(const ACFontInfo* fontinfo, const char* srcglyph, bool extrahint); void EvalV(void); void EvalH(void); void GenVPts(int32_t specialGlyphType); -void CheckVal(PHintVal val, bool vert); -void CheckTfmVal(PHintSeg hSegList, Fixed* bandList, int32_t length); -void CheckVals(PHintVal vlst, bool vert); +void CheckVal(HintVal* val, bool vert); +void CheckTfmVal(HintSeg* hSegList, Fixed* bandList, int32_t length); +void CheckVals(HintVal* vlst, bool vert); bool DoFixes(void); -bool FindLineSeg(Fixed loc, PHintSeg sL); -void FltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, PFltnRec pfr); +bool FindLineSeg(Fixed loc, HintSeg* sL); +void FltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, FltnRec* pfr); bool InBlueBand(Fixed loc, int32_t n, Fixed* p); void GenHPts(void); void PreGenPts(void); -PPathElt GetDest(PPathElt cldest); -PPathElt GetClosedBy(PPathElt clsdby); -void GetEndPoint(PPathElt e, Fixed* x1p, Fixed* y1p); -void GetEndPoints(PPathElt p, Fixed* px0, Fixed* py0, Fixed* px1, Fixed* py1); +PathElt* GetDest(PathElt* cldest); +PathElt* GetClosedBy(PathElt* clsdby); +void GetEndPoint(PathElt* e, Fixed* x1p, Fixed* y1p); +void GetEndPoints(PathElt* p, Fixed* px0, Fixed* py0, Fixed* px1, Fixed* py1); Fixed VertQuo(Fixed xk, Fixed yk, Fixed xl, Fixed yl); Fixed HorzQuo(Fixed xk, Fixed yk, Fixed xl, Fixed yl); -bool IsTiny(PPathElt e); -bool IsShort(PPathElt e); -PPathElt NxtForBend(PPathElt p, Fixed* px2, Fixed* py2, Fixed* px3, Fixed* py3); -PPathElt PrvForBend(PPathElt p, Fixed* px2, Fixed* py2); -bool IsLower(PPathElt p); -bool IsUpper(PPathElt p); -bool CloseSegs(PHintSeg s1, PHintSeg s2, bool vert); +bool IsTiny(PathElt* e); +bool IsShort(PathElt* e); +PathElt* NxtForBend(PathElt* p, Fixed* px2, Fixed* py2, Fixed* px3, Fixed* py3); +PathElt* PrvForBend(PathElt* p, Fixed* px2, Fixed* py2); +bool IsLower(PathElt* p); +bool IsUpper(PathElt* p); +bool CloseSegs(HintSeg* s1, HintSeg* s2, bool vert); void DoPrune(void); void PruneVVals(void); @@ -343,7 +340,7 @@ void PruneHVals(void); void MergeVals(bool vert); void MergeFromMainHints(char ch); void RoundPathCoords(void); -void MoveSubpathToEnd(PPathElt e); +void MoveSubpathToEnd(PathElt* e); void AddSolEol(void); void InitAuto(int32_t reason); void InitData(const ACFontInfo* fontinfo, int32_t reason); @@ -354,39 +351,39 @@ void AutoAddFlex(void); bool SameHints(int32_t cn1, int32_t cn2); bool PreCheckForHinting(void); int32_t CountSubPaths(void); -void PickVVals(PHintVal gValList); -void PickHVals(PHintVal gValList); +void PickVVals(HintVal* gValList); +void PickHVals(HintVal* gValList); void FindBestHVals(void); void FindBestVVals(void); void ReportAddFlex(void); -void ReportLinearCurve(PPathElt e, Fixed x0, Fixed y0, Fixed x1, Fixed y1); +void ReportLinearCurve(PathElt* e, Fixed x0, Fixed y0, Fixed x1, Fixed y1); void ReportNonHError(Fixed x0, Fixed y0, Fixed x1, Fixed y1); void ReportNonVError(Fixed x0, Fixed y0, Fixed x1, Fixed y1); -void ExpectedMoveTo(PPathElt e); +void ExpectedMoveTo(PathElt* e); void ReportMissingClosePath(void); void ReportTryFlexNearMiss(Fixed x0, Fixed y0, Fixed x2, Fixed y2); void ReportTryFlexError(bool CPflg, Fixed x, Fixed y); -void AskForSplit(PPathElt e); -void ReportSplit(PPathElt e); -void ReportConflictCheck(PPathElt e, PPathElt conflict, PPathElt cp); -void ReportConflictCnt(PPathElt e, int32_t cnt); -void ReportRemFlare(PPathElt e, PPathElt e2, bool hFlg, int32_t i); -void ReportRemConflict(PPathElt e); -void ReportRotateSubpath(PPathElt e); +void AskForSplit(PathElt* e); +void ReportSplit(PathElt* e); +void ReportConflictCheck(PathElt* e, PathElt* conflict, PathElt* cp); +void ReportConflictCnt(PathElt* e, int32_t cnt); +void ReportRemFlare(PathElt* e, PathElt* e2, bool hFlg, int32_t i); +void ReportRemConflict(PathElt* e); +void ReportRotateSubpath(PathElt* e); void ReportRemShortHints(Fixed ex, Fixed ey); -bool ResolveConflictBySplit(PPathElt e, bool Hflg, PSegLnkLst lnk1, - PSegLnkLst lnk2); -void ReportPossibleLoop(PPathElt e); -void ShowHVal(PHintVal val); -void ShowHVals(PHintVal lst); -void ReportAddHVal(PHintVal val); -void ShowVVal(PHintVal val); -void ShowVVals(PHintVal lst); -void ReportAddVVal(PHintVal val); -void ReportFndBstVal(PHintSeg seg, PHintVal val, bool hFlg); -void ReportCarry(Fixed l0, Fixed l1, Fixed loc, PHintVal hints, bool vert); -void ReportBestCP(PPathElt e, PPathElt cp); -void LogHintInfo(PHintPoint pl); +bool ResolveConflictBySplit(PathElt* e, bool Hflg, SegLnkLst* lnk1, + SegLnkLst* lnk2); +void ReportPossibleLoop(PathElt* e); +void ShowHVal(HintVal* val); +void ShowHVals(HintVal* lst); +void ReportAddHVal(HintVal* val); +void ShowVVal(HintVal* val); +void ShowVVals(HintVal* lst); +void ReportAddVVal(HintVal* val); +void ReportFndBstVal(HintSeg* seg, HintVal* val, bool hFlg); +void ReportCarry(Fixed l0, Fixed l1, Fixed loc, HintVal* hints, bool vert); +void ReportBestCP(PathElt* e, PathElt* cp); +void LogHintInfo(HintPoint* pl); void ReportStemNearMiss(bool vert, Fixed w, Fixed minW, Fixed b, Fixed t, bool curve); void ReportHintConflict(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch); @@ -396,25 +393,25 @@ void ReportMergeHVal(Fixed b0, Fixed t0, Fixed b1, Fixed t1, Fixed v0, Fixed s0, Fixed v1, Fixed s1); void ReportMergeVVal(Fixed l0, Fixed r0, Fixed l1, Fixed r1, Fixed v0, Fixed s0, Fixed v1, Fixed s1); -void ReportPruneHVal(PHintVal val, PHintVal v, int32_t i); -void ReportPruneVVal(PHintVal val, PHintVal v, int32_t i); +void ReportPruneHVal(HintVal* val, HintVal* v, int32_t i); +void ReportPruneVVal(HintVal* val, HintVal* v, int32_t i); Fixed ScaleAbs(const ACFontInfo* fontinfo, Fixed unscaled); Fixed UnScaleAbs(const ACFontInfo* fontinfo, Fixed scaled); void InitShuffleSubpaths(void); -void MarkLinks(PHintVal vL, bool hFlg); +void MarkLinks(HintVal* vL, bool hFlg); void DoShuffleSubpaths(void); void CopyMainH(void); void CopyMainV(void); -void RMovePoint(Fixed dx, Fixed dy, int32_t whichcp, PPathElt e); -void AddVSegment(Fixed from, Fixed to, Fixed loc, PPathElt p1, PPathElt p2, +void RMovePoint(Fixed dx, Fixed dy, int32_t whichcp, PathElt* e); +void AddVSegment(Fixed from, Fixed to, Fixed loc, PathElt* p1, PathElt* p2, int32_t typ, int32_t i); -void AddHSegment(Fixed from, Fixed to, Fixed loc, PPathElt p1, PPathElt p2, +void AddHSegment(Fixed from, Fixed to, Fixed loc, PathElt* p1, PathElt* p2, int32_t typ, int32_t i); -void Delete(PPathElt e); +void Delete(PathElt* e); bool ReadGlyph(const ACFontInfo* fontinfo, const char* srcglyph, bool forBlendData, bool readHints); double FixToDbl(Fixed f); -bool CompareValues(PHintVal val1, PHintVal val2, int32_t factor, +bool CompareValues(HintVal* val1, HintVal* val2, int32_t factor, int32_t ghstshift); void SaveFile(const ACFontInfo* fontinfo); void CheckForMultiMoveTo(void); diff --git a/libpsautohint/src/auto.c b/libpsautohint/src/auto.c index 3bf624f79..1969728cb 100644 --- a/libpsautohint/src/auto.c +++ b/libpsautohint/src/auto.c @@ -23,27 +23,27 @@ InitAuto(int32_t reason) } } -static PPathElt -GetSubPathNxt(PPathElt e) +static PathElt* +GetSubPathNxt(PathElt* e) { if (e->type == CLOSEPATH) return GetDest(e); return e->next; } -static PPathElt -GetSubPathPrv(PPathElt e) +static PathElt* +GetSubPathPrv(PathElt* e) { if (e->type == MOVETO) e = GetClosedBy(e); return e->prev; } -static PHintVal -FindClosestVal(PHintVal sLst, Fixed loc) +static HintVal* +FindClosestVal(HintVal* sLst, Fixed loc) { Fixed dist = FixInt(10000); - PHintVal best = NULL; + HintVal* best = NULL; while (sLst != NULL) { Fixed bot, top, d; bot = sLst->vLoc1; @@ -71,10 +71,10 @@ FindClosestVal(PHintVal sLst, Fixed loc) } static void -CpyHHint(PPathElt e) +CpyHHint(PathElt* e) { Fixed x1, y1; - PHintVal best; + HintVal* best; GetEndPoint(e, &x1, &y1); best = FindClosestVal(gHPrimary, y1); if (best != NULL) @@ -82,10 +82,10 @@ CpyHHint(PPathElt e) } static void -CpyVHint(PPathElt e) +CpyVHint(PathElt* e) { Fixed x1, y1; - PHintVal best; + HintVal* best; GetEndPoint(e, &x1, &y1); best = FindClosestVal(gVPrimary, x1); if (best != NULL) @@ -93,15 +93,15 @@ CpyVHint(PPathElt e) } static void -PruneHintSegs(PPathElt e, bool hFlg) +PruneHintSegs(PathElt* e, bool hFlg) { - PSegLnkLst lst, nxt, prv; - PHintSeg seg; + SegLnkLst *lst, *nxt, *prv; + HintSeg* seg; lst = hFlg ? e->Hs : e->Vs; prv = NULL; while (lst != NULL) { - PHintVal val = NULL; - PSegLnk lnk = lst->lnk; + HintVal* val = NULL; + SegLnk* lnk = lst->lnk; if (lnk != NULL) { seg = lnk->seg; if (seg != NULL) @@ -127,7 +127,7 @@ PruneHintSegs(PPathElt e, bool hFlg) void PruneElementHintSegs(void) { - PPathElt e; + PathElt* e; e = gPathStart; while (e != NULL) { PruneHintSegs(e, true); @@ -139,9 +139,9 @@ PruneElementHintSegs(void) #define ElmntHintSegLst(e, hFlg) (hFlg) ? (e)->Hs : (e)->Vs static void -RemLnk(PPathElt e, bool hFlg, PSegLnkLst rm) +RemLnk(PathElt* e, bool hFlg, SegLnkLst* rm) { - PSegLnkLst lst, prv, nxt; + SegLnkLst *lst, *prv, *nxt; lst = hFlg ? e->Hs : e->Vs; prv = NULL; while (lst != NULL) { @@ -163,7 +163,7 @@ RemLnk(PPathElt e, bool hFlg, PSegLnkLst rm) } static bool -AlreadyOnList(PHintVal v, PHintVal lst) +AlreadyOnList(HintVal* v, HintVal* lst) { while (lst != NULL) { if (v == lst) @@ -174,19 +174,19 @@ AlreadyOnList(PHintVal v, PHintVal lst) } static void -AutoVSeg(PHintVal sLst) +AutoVSeg(HintVal* sLst) { AddVPair(sLst, 'y'); } static void -AutoHSeg(PHintVal sLst) +AutoHSeg(HintVal* sLst) { AddHPair(sLst, 'b'); } static void -AddHHinting(PHintVal h) +AddHHinting(HintVal* h) { if (gUseH || AlreadyOnList(h, gHHinting)) return; @@ -196,7 +196,7 @@ AddHHinting(PHintVal h) } static void -AddVHinting(PHintVal v) +AddVHinting(HintVal* v) { if (gUseV || AlreadyOnList(v, gVHinting)) return; @@ -206,10 +206,10 @@ AddVHinting(PHintVal v) } static int32_t -TestHint(PHintSeg s, PHintVal hintList, bool flg, bool doLst) +TestHint(HintSeg* s, HintVal* hintList, bool flg, bool doLst) { /* -1 means already in hintList; 0 means conflicts; 1 means ok to add */ - PHintVal v, clst; + HintVal *v, *clst; Fixed top, bot, vT, vB, loc; if (s == NULL) return -1; @@ -290,7 +290,7 @@ TestHint(PHintSeg s, PHintVal hintList, bool flg, bool doLst) #define TestVHintLst(v) TestHintLst(v, gVHinting, true, true) int -TestHintLst(PSegLnkLst lst, PHintVal hintList, bool flg, bool doLst) +TestHintLst(SegLnkLst* lst, HintVal* hintList, bool flg, bool doLst) { /* -1 means already in hintList; 0 means conflicts; 1 means ok to add */ int result, cnt; @@ -326,17 +326,17 @@ TestHintLst(PSegLnkLst lst, PHintVal hintList, bool flg, bool doLst) FixedMidPoint(a3, a2, b1); bool -ResolveConflictBySplit(PPathElt e, bool Hflg, PSegLnkLst lnk1, PSegLnkLst lnk2) +ResolveConflictBySplit(PathElt* e, bool Hflg, SegLnkLst* lnk1, SegLnkLst* lnk2) { /* insert new pathelt immediately following e */ /* e gets first half of split; new gets second */ /* e gets lnk1 in Hs or Vs; new gets lnk2 */ - PPathElt new; + PathElt* new; Cd d0, d1, d2, d3, d4, d5, d6, d7; if (e->type != CURVETO || e->isFlex) return false; ReportSplit(e); - new = (PPathElt)Alloc(sizeof(PathElt)); + new = (PathElt*)Alloc(sizeof(PathElt)); new->next = e->next; e->next = new; new->prev = e; @@ -384,9 +384,9 @@ ResolveConflictBySplit(PPathElt e, bool Hflg, PSegLnkLst lnk1, PSegLnkLst lnk2) } static void -RemDupLnks(PPathElt e, bool Hflg) +RemDupLnks(PathElt* e, bool Hflg) { - PSegLnkLst l1, l2, l2nxt; + SegLnkLst *l1, *l2, *l2nxt; l1 = Hflg ? e->Hs : e->Vs; while (l1 != NULL) { l2 = l1->next; @@ -408,12 +408,12 @@ RemDupLnks(PPathElt e, bool Hflg) /* The changes made here were to fix a problem in MinisterLight/E. The top left point was not getting hinted. */ static bool -TryResolveConflict(PPathElt e, bool Hflg) +TryResolveConflict(PathElt* e, bool Hflg) { int32_t typ; - PSegLnkLst lst, lnk1, lnk2; - PHintSeg seg, seg1, seg2; - PHintVal val1, val2; + SegLnkLst *lst, *lnk1, *lnk2; + HintSeg *seg, *seg1, *seg2; + HintVal *val1, *val2; Fixed lc1, lc2, loc0, loc1, loc2, loc3, x0, y0, x1, y1; RemDupLnks(e, Hflg); typ = e->type; @@ -499,12 +499,12 @@ TryResolveConflict(PPathElt e, bool Hflg) } static bool -CheckHintSegs(PPathElt e, bool flg, bool Hflg) +CheckHintSegs(PathElt* e, bool flg, bool Hflg) { - PSegLnkLst lst; - PSegLnkLst lst2; - PHintSeg seg; - PHintVal val; + SegLnkLst* lst; + SegLnkLst* lst2; + HintSeg* seg; + HintVal* val; lst = Hflg ? e->Hs : e->Vs; while (lst != NULL) { lst2 = lst->next; @@ -530,7 +530,7 @@ CheckHintSegs(PPathElt e, bool flg, bool Hflg) static void CheckElmntHintSegs(void) { - PPathElt e; + PathElt* e; e = gPathStart; while (e != NULL) { if (!CheckHintSegs(e, false, true)) @@ -539,13 +539,13 @@ CheckElmntHintSegs(void) } } static bool -HintLstsClash(PSegLnkLst lst1, PSegLnkLst lst2, bool flg) +HintLstsClash(SegLnkLst* lst1, SegLnkLst* lst2, bool flg) { while (lst1 != NULL) { - PHintSeg seg = lst1->lnk->seg; - PHintVal val = seg->sLnk; + HintSeg* seg = lst1->lnk->seg; + HintVal* val = seg->sLnk; if (val != NULL) { - PSegLnkLst lst = lst2; + SegLnkLst* lst = lst2; while (lst != NULL) { if (TestHintLst(lst, val, flg, false) == 0) { return true; @@ -558,17 +558,17 @@ HintLstsClash(PSegLnkLst lst1, PSegLnkLst lst2, bool flg) return false; } -static PSegLnkLst -BestFromLsts(PSegLnkLst lst1, PSegLnkLst lst2) +static SegLnkLst* +BestFromLsts(SegLnkLst* lst1, SegLnkLst* lst2) { - PSegLnkLst bst = NULL; + SegLnkLst* bst = NULL; Fixed bstval = 0; int32_t i; for (i = 0; i < 2; i++) { - PSegLnkLst lst = i ? lst1 : lst2; + SegLnkLst* lst = i ? lst1 : lst2; while (lst != NULL) { - PHintSeg seg = lst->lnk->seg; - PHintVal val = seg->sLnk; + HintSeg* seg = lst->lnk->seg; + HintVal* val = seg->sLnk; if (val != NULL && val->vVal > bstval) { bst = lst; bstval = val->vVal; @@ -580,16 +580,16 @@ BestFromLsts(PSegLnkLst lst1, PSegLnkLst lst2) } static bool -HintsClash(PPathElt e, PPathElt p, PSegLnkLst* hLst, PSegLnkLst* vLst, - PSegLnkLst* phLst, PSegLnkLst* pvLst) +HintsClash(PathElt* e, PathElt* p, SegLnkLst** hLst, SegLnkLst** vLst, + SegLnkLst** phLst, SegLnkLst** pvLst) { bool clash = false; - PSegLnkLst bst, new; + SegLnkLst *bst, *new; if (HintLstsClash(*hLst, *phLst, false)) { clash = true; bst = BestFromLsts(*hLst, *phLst); if (bst) { - new = (PSegLnkLst)Alloc(sizeof(SegLnkLst)); + new = (SegLnkLst*)Alloc(sizeof(SegLnkLst)); new->next = NULL; new->lnk = bst->lnk; } else @@ -600,7 +600,7 @@ HintsClash(PPathElt e, PPathElt p, PSegLnkLst* hLst, PSegLnkLst* vLst, clash = true; bst = BestFromLsts(*vLst, *pvLst); if (bst) { - new = (PSegLnkLst)Alloc(sizeof(SegLnkLst)); + new = (SegLnkLst*)Alloc(sizeof(SegLnkLst)); new->next = NULL; new->lnk = bst->lnk; } else @@ -611,10 +611,10 @@ HintsClash(PPathElt e, PPathElt p, PSegLnkLst* hLst, PSegLnkLst* vLst, } static void -GetHintLsts(PPathElt e, PSegLnkLst* phLst, PSegLnkLst* pvLst, int32_t* ph, +GetHintLsts(PathElt* e, SegLnkLst** phLst, SegLnkLst** pvLst, int32_t* ph, int32_t* pv) { - PSegLnkLst hLst, vLst; + SegLnkLst *hLst, *vLst; int32_t h, v; if (gUseH) { hLst = NULL; @@ -643,7 +643,7 @@ GetHintLsts(PPathElt e, PSegLnkLst* phLst, PSegLnkLst* pvLst, int32_t* ph, } static void -ReHintBounds(PPathElt e) +ReHintBounds(PathElt* e) { if (!gUseH) { if (hintHBounds && gHHinting == NULL && !haveHBnds) @@ -668,11 +668,11 @@ ReHintBounds(PPathElt e) } static void -AddHintLst(PSegLnkLst lst, bool vert) +AddHintLst(SegLnkLst* lst, bool vert) { while (lst != NULL) { - PHintSeg seg = lst->lnk->seg; - PHintVal val = seg->sLnk; + HintSeg* seg = lst->lnk->seg; + HintVal* val = seg->sLnk; if (vert) AddVHinting(val); else @@ -682,7 +682,7 @@ AddHintLst(PSegLnkLst lst, bool vert) } static void -StartNewHinting(PPathElt e, PSegLnkLst hLst, PSegLnkLst vLst) +StartNewHinting(PathElt* e, SegLnkLst* hLst, SegLnkLst* vLst) { ReHintBounds(e); if (e->newhints != 0) { @@ -721,7 +721,7 @@ IsOk(int32_t h, int32_t v) AddHintLst(hLst, false) static void -SetHHints(PHintVal lst) +SetHHints(HintVal* lst) { if (gUseH) return; @@ -733,7 +733,7 @@ SetHHints(PHintVal lst) } static void -SetVHints(PHintVal lst) +SetVHints(HintVal* lst) { if (gUseV) return; @@ -744,15 +744,15 @@ SetVHints(PHintVal lst) } } -PHintVal -CopyHints(PHintVal lst) +HintVal* +CopyHints(HintVal* lst) { - PHintVal vlst; + HintVal* vlst; int cnt; vlst = NULL; cnt = 0; while (lst != NULL) { - PHintVal v = (PHintVal)Alloc(sizeof(HintVal)); + HintVal* v = (HintVal*)Alloc(sizeof(HintVal)); *v = *lst; v->vNxt = vlst; vlst = v; @@ -765,8 +765,8 @@ CopyHints(PHintVal lst) return vlst; } -static PPathElt -_HintBBox(PPathElt e) +static PathElt* +_HintBBox(PathElt* e) { e = FindSubpathBBox(e); HintBBox(); @@ -775,7 +775,7 @@ _HintBBox(PPathElt e) } static bool -IsFlare(Fixed loc, PPathElt e, PPathElt n, bool Hflg) +IsFlare(Fixed loc, PathElt* e, PathElt* n, bool Hflg) { Fixed x, y; while (e != n) { @@ -798,14 +798,14 @@ IsTopSegOfVal(Fixed loc, Fixed top, Fixed bot) } static void -RemFlareLnk(PPathElt e, bool hFlg, PSegLnkLst rm, PPathElt e2, int32_t i) +RemFlareLnk(PathElt* e, bool hFlg, SegLnkLst* rm, PathElt* e2, int32_t i) { RemLnk(e, hFlg, rm); ReportRemFlare(e, e2, hFlg, i); } bool -CompareValues(PHintVal val1, PHintVal val2, int32_t factor, int32_t ghstshift) +CompareValues(HintVal* val1, HintVal* val2, int32_t factor, int32_t ghstshift) { Fixed v1 = val1->vVal, v2 = val2->vVal, mx; mx = v1 > v2 ? v1 : v2; @@ -834,10 +834,10 @@ CompareValues(PHintVal val1, PHintVal val2, int32_t factor, int32_t ghstshift) static void RemFlares(bool Hflg) { - PSegLnkLst lst1, lst2, nxt1, nxt2; - PPathElt e, n; - PHintSeg seg1, seg2; - PHintVal val1, val2; + SegLnkLst *lst1, *lst2, *nxt1, *nxt2; + PathElt *e, *n; + HintSeg *seg1, *seg2; + HintVal *val1, *val2; Fixed diff; bool nxtE; bool Nm1, Nm2; @@ -913,10 +913,10 @@ RemFlares(bool Hflg) } static void -CarryIfNeed(Fixed loc, bool vert, PHintVal hints) +CarryIfNeed(Fixed loc, bool vert, HintVal* hints) { - PHintSeg seg; - PHintVal seglnk; + HintSeg* seg; + HintVal* seglnk; Fixed l0, l1, tmp, halfMargin; if ((vert && gUseV) || (!vert && gUseH)) return; @@ -967,10 +967,10 @@ CarryIfNeed(Fixed loc, bool vert, PHintVal hints) (FixInt(100)) /* DEBUG 8 BIT. Needed to double test from 50 to 100 for \ change in coordinate system */ static void -ProHints(PPathElt e, bool hFlg, Fixed loc) +ProHints(PathElt* e, bool hFlg, Fixed loc) { - PSegLnkLst lst; - PPathElt prv; + SegLnkLst* lst; + PathElt* prv; lst = ElmntHintSegLst(e, hFlg); if (lst == NULL) return; @@ -979,7 +979,7 @@ ProHints(PPathElt e, bool hFlg, Fixed loc) prv = e; while (true) { Fixed cx, cy, dst; - PSegLnkLst plst; + SegLnkLst* plst; prv = GetSubPathPrv(prv); plst = ElmntHintSegLst(prv, hFlg); if (plst != NULL) @@ -1001,7 +1001,7 @@ ProHints(PPathElt e, bool hFlg, Fixed loc) static void PromoteHints(void) { - PPathElt e; + PathElt* e; e = gPathStart; while (e != NULL) { Fixed cx, cy; @@ -1015,7 +1015,7 @@ PromoteHints(void) static void RemPromotedHints(void) { - PPathElt e; + PathElt* e; e = gPathStart; while (e != NULL) { if (e->Hcopy) { @@ -1034,7 +1034,7 @@ static void RemShortHints(void) { /* Must not change hints at a short element. */ - PPathElt e; + PathElt* e; Fixed cx, cy, ex, ey; e = gPathStart; cx = 0; @@ -1057,9 +1057,9 @@ void AutoExtraHints(bool movetoNewHints, bool soleol, int32_t solWhere) { int32_t h, v, ph, pv; - PPathElt e, cp, p; - PSegLnkLst hLst, vLst, phLst, pvLst; - PHintVal mtVhints, mtHhints, prvHhints, prvVhints; + PathElt *e, *cp, *p; + SegLnkLst *hLst, *vLst, *phLst, *pvLst; + HintVal *mtVhints, *mtHhints, *prvHhints, *prvVhints; bool (*Tst)(int32_t, int32_t), newHints = true; bool isSpc; diff --git a/libpsautohint/src/bbox.c b/libpsautohint/src/bbox.c index fb8059947..7aa111fb1 100644 --- a/libpsautohint/src/bbox.c +++ b/libpsautohint/src/bbox.c @@ -11,7 +11,7 @@ #include "ac.h" static Fixed xmin, ymin, xmax, ymax, vMn, vMx, hMn, hMx; -static PPathElt pxmn, pxmx, pymn, pymx, pe, pvMn, pvMx, phMn, phMx; +static PathElt *pxmn, *pxmx, *pymn, *pymx, *pe, *pvMn, *pvMx, *phMn, *phMx; static void FPBBoxPt(Cd c) @@ -38,7 +38,7 @@ static void FindPathBBox(void) { FltnRec fr; - PPathElt e; + PathElt* e; Cd c0, c1, c2, c3; if (gPathStart == NULL) { xmin = ymin = xmax = ymax = 0; @@ -83,8 +83,8 @@ FindPathBBox(void) ymax = FHalfRnd(ymax); } -PPathElt -FindSubpathBBox(PPathElt e) +PathElt* +FindSubpathBBox(PathElt* e) { FltnRec fr; Cd c0, c1, c2, c3; @@ -178,7 +178,7 @@ FindCurveBBox(Fixed x0, Fixed y0, Fixed px1, Fixed py1, Fixed px2, Fixed py2, void HintVBnds(void) { - PPathElt p; + PathElt* p; if (gPathStart == NULL || VHintGlyph()) return; FindPathBBox(); @@ -214,7 +214,7 @@ HintHBnds(void) phMn = pymn; phMx = pymx; if (hMn > hMx) { - PPathElt p; + PathElt* p; Fixed tmp = hMn; hMn = hMx; hMx = tmp; @@ -232,7 +232,7 @@ ReHintHBnds(void) } static bool -CheckValOverlaps(Fixed lft, Fixed rht, PHintVal lst, bool xflg) +CheckValOverlaps(Fixed lft, Fixed rht, HintVal* lst, bool xflg) { Fixed tmp; if (!xflg) { @@ -266,9 +266,9 @@ CheckValOverlaps(Fixed lft, Fixed rht, PHintVal lst, bool xflg) void AddBBoxHV(bool Hflg, bool subs) { - PPathElt e; - PHintVal val; - PHintSeg seg1, seg2; + PathElt* e; + HintVal* val; + HintSeg *seg1, *seg2; e = gPathStart; while (e != NULL) { if (subs) @@ -279,8 +279,8 @@ AddBBoxHV(bool Hflg, bool subs) } if (!Hflg) { if (!CheckValOverlaps(xmin, xmax, gVHinting, true)) { - val = (PHintVal)Alloc(sizeof(HintVal)); - seg1 = (PHintSeg)Alloc(sizeof(HintSeg)); + val = (HintVal*)Alloc(sizeof(HintVal)); + seg1 = (HintSeg*)Alloc(sizeof(HintSeg)); seg1->sLoc = xmin; seg1->sElt = pxmn; seg1->sBonus = 0; @@ -289,7 +289,7 @@ AddBBoxHV(bool Hflg, bool subs) seg1->sMax = ymax; seg1->sNxt = NULL; seg1->sLnk = NULL; - seg2 = (PHintSeg)Alloc(sizeof(HintSeg)); + seg2 = (HintSeg*)Alloc(sizeof(HintSeg)); seg2->sLoc = xmax; seg2->sElt = pxmx; seg2->sBonus = 0; @@ -311,8 +311,8 @@ AddBBoxHV(bool Hflg, bool subs) } } else { if (!CheckValOverlaps(ymin, ymax, gHHinting, false)) { - val = (PHintVal)Alloc(sizeof(HintVal)); - seg1 = (PHintSeg)Alloc(sizeof(HintSeg)); + val = (HintVal*)Alloc(sizeof(HintVal)); + seg1 = (HintSeg*)Alloc(sizeof(HintSeg)); seg1->sLoc = ymax; seg1->sElt = pymx; seg1->sBonus = 0; @@ -321,7 +321,7 @@ AddBBoxHV(bool Hflg, bool subs) seg1->sMax = xmax; seg1->sNxt = NULL; seg1->sLnk = NULL; - seg2 = (PHintSeg)Alloc(sizeof(HintSeg)); + seg2 = (HintSeg*)Alloc(sizeof(HintSeg)); seg2->sLoc = ymin; seg2->sElt = pymn; seg2->sBonus = 0; @@ -349,7 +349,7 @@ void HintBBox(void) { Fixed tmp; - PPathElt p, p0, p1; + PathElt *p, *p0, *p1; if (!gUseV) { Fixed llx = xmin; Fixed urx = xmax; @@ -407,7 +407,7 @@ CheckPathBBox(void) } bool -CheckBBoxes(PPathElt e1, PPathElt e2) +CheckBBoxes(PathElt* e1, PathElt* e2) { /* return true if e1 and e2 in same subpath or i the bbox for one is inside the bbox of the other */ diff --git a/libpsautohint/src/bbox.h b/libpsautohint/src/bbox.h index 7045fa43b..432f9d0c1 100644 --- a/libpsautohint/src/bbox.h +++ b/libpsautohint/src/bbox.h @@ -12,7 +12,7 @@ #include "ac.h" -PPathElt FindSubpathBBox(PPathElt e); +PathElt* FindSubpathBBox(PathElt* e); void FindCurveBBox(Fixed x0, Fixed y0, Fixed px1, Fixed py1, Fixed px2, Fixed py2, Fixed x1, Fixed y1, Fixed* pllx, Fixed* plly, Fixed* purx, Fixed* pury); @@ -23,6 +23,6 @@ void ReHintHBnds(void); void AddBBoxHV(bool Hflg, bool subs); void HintBBox(void); void CheckPathBBox(void); -bool CheckBBoxes(PPathElt e1, PPathElt e2); +bool CheckBBoxes(PathElt* e1, PathElt* e2); #endif /* AC_BBOX_H_ */ diff --git a/libpsautohint/src/charpath.c b/libpsautohint/src/charpath.c index ff23a4b79..6757bab7e 100644 --- a/libpsautohint/src/charpath.c +++ b/libpsautohint/src/charpath.c @@ -41,7 +41,7 @@ static char* outbuff; static int16_t masterCount; static const char** masterNames; static size_t byteCount, buffSize; -static PPathList pathlist = NULL; +static PathList* pathlist = NULL; static indx hintsMasterIx = 0; /* The index of the master we read hints from */ /* Prototypes */ @@ -160,7 +160,7 @@ GetNextMTIx(indx mIx, indx pathIx) static void GetEndPoint1(indx mIx, int32_t pathIx, Fixed* ptX, Fixed* ptY) { - PGlyphPathElt pathElt = &pathlist[mIx].path[pathIx]; + GlyphPathElt* pathElt = &pathlist[mIx].path[pathIx]; retry: switch (pathElt->type) { @@ -249,7 +249,7 @@ FreePathElements(indx startix, indx stopix) indx i, j; for (j = startix; j < stopix; j++) { - PHintElt hintElt, next; + HintElt *hintElt, *next; if (pathlist[j].path != NULL) { /* Before we can free hint elements will need to know gPathEntries value for char in each master because this proc can be @@ -301,7 +301,7 @@ static bool ChangetoCurve(indx mIx, indx pathIx) { Cd start = { 0, 0 }, end = { 0, 0 }, ctl1, ctl2; - PGlyphPathElt pathElt = &pathlist[mIx].path[pathIx]; + GlyphPathElt* pathElt = &pathlist[mIx].path[pathIx]; if (pathElt->type == RCT) return true; @@ -345,7 +345,7 @@ AddLine(indx mIx, indx pathIx) Fixed fixTwo = IntToFix(2); Fixed xoffset = 0, yoffset = 0; Fixed xoffsetr = 0, yoffsetr = 0; - PGlyphPathElt start, end, thisone; + GlyphPathElt *start, *end, *thisone; indx i, n; if (pathlist[mIx].path[pathIx].type != RCT) { @@ -405,7 +405,7 @@ AddLine(indx mIx, indx pathIx) /* Now, fix up the following MT's rx1, ry1 values This fixes a LOOOONG-standing bug. renner Wed Jul 16 09:33:50 1997*/ if ((n = GetNextMTIx(mIx, pathIx)) > 0) { - PGlyphPathElt nxtone = &(pathlist[mIx].path[n]); + GlyphPathElt* nxtone = &(pathlist[mIx].path[n]); nxtone->rx += (-xoffsetr); nxtone->ry += (-yoffsetr); } @@ -413,7 +413,7 @@ AddLine(indx mIx, indx pathIx) #define PI 3.1415926535 static void -BestLine(PGlyphPathElt start, PGlyphPathElt end, Fixed* dx, Fixed* dy) +BestLine(GlyphPathElt* start, GlyphPathElt* end, Fixed* dx, Fixed* dy) { double angle; /* control point differences */ @@ -504,8 +504,8 @@ AddLineCube(indx mIx, indx pathIx) } else if (pathlist[mIx].path[pathIx].type == RCT) { Fixed dx = 0; Fixed dy = 0; - PGlyphPathElt start; - PGlyphPathElt end; + GlyphPathElt* start; + GlyphPathElt* end; indx mt; /* index of the moveto preceding this path */ mt = GetMTIx(mIx, pathIx); @@ -571,7 +571,7 @@ CompareGlyphPaths(const ACFontInfo* fontinfo, const char** glyphs) totalPathElt = minPathLen = MAXINT; if (pathlist == NULL) { - pathlist = (PPathList)AllocateMem(masterCount, sizeof(PathList), + pathlist = (PathList*)AllocateMem(masterCount, sizeof(PathList), "glyph path list"); } @@ -981,11 +981,11 @@ GetRelativePosition(Fixed currEnd, Fixed currStart, Fixed end, Fixed start, be stored. pathIx is the index of the path segment used to calculate this particular hint. */ static void -InsertHint(PHintElt currHintElt, indx pathEltIx, int16_t type1, int16_t type2) +InsertHint(HintElt* currHintElt, indx pathEltIx, int16_t type1, int16_t type2) { indx ix, j; Cd startPt, endPt; - PHintElt *hintElt, newEntry; + HintElt **hintElt, *newEntry; GlyphPathElt pathElt; int32_t pathIx; int16_t pathtype, hinttype = currHintElt->type; @@ -1023,7 +1023,7 @@ InsertHint(PHintElt currHintElt, indx pathEltIx, int16_t type1, int16_t type2) for (ix = 0; ix < masterCount; ix++) { if (ix == hintsMasterIx) continue; - newEntry = (PHintElt)AllocateMem(1, sizeof(HintElt), "hint element"); + newEntry = (HintElt*)AllocateMem(1, sizeof(HintElt), "hint element"); newEntry->type = hinttype; hintElt = (pathEltIx == MAINHINTS ? &pathlist[ix].mainhints @@ -1108,9 +1108,9 @@ InsertHint(PHintElt currHintElt, indx pathEltIx, int16_t type1, int16_t type2) } static void -ReadHints(PHintElt hintElt, indx pathEltIx) +ReadHints(HintElt* hintElt, indx pathEltIx) { - PHintElt currElt = hintElt; + HintElt* currElt = hintElt; int16_t pointtype1, pointtype2; while (currElt != NULL) { @@ -1168,7 +1168,7 @@ CheckFlexOK(indx ix) { indx i; bool flexOK = pathlist[hintsMasterIx].path[ix].isFlex; - PGlyphPathElt end; + GlyphPathElt* end; for (i = 0; i < masterCount; i++) { if (i == hintsMasterIx) @@ -1328,7 +1328,7 @@ ReadHorVStem3Values(indx pathIx, int16_t eltno, int16_t hinttype, bool* errormsg) { indx ix; - PHintElt* hintElt = NULL; + HintElt** hintElt = NULL; int16_t count; bool ok = true; Fixed min, dmin, mid, dmid, max, dmax; @@ -1417,7 +1417,7 @@ ReadHorVStem3Values(indx pathIx, int16_t eltno, int16_t hinttype, /* Go through each hint element and check that all rm's and rv's meet the necessary criteria. */ static void -FindHandVStem3(PHintElt* hintElt, indx pathIx, bool* errormsg) +FindHandVStem3(HintElt** hintElt, indx pathIx, bool* errormsg) { int16_t count = 1; @@ -1674,11 +1674,11 @@ WriteFlex(indx eltix) static void WriteUnmergedHints(indx pathEltIx, indx mIx) { - PHintElt hintList; + HintElt* hintList; /* hintArray contains the pointers to the beginning of the linked list of * hints for each design at pathEltIx. */ - hintList = (PHintElt)AllocateMem(1, sizeof(HintElt*), "hint element array"); + hintList = (HintElt*)AllocateMem(1, sizeof(HintElt*), "hint element array"); /* Initialize hint list. */ if (pathEltIx == MAINHINTS) hintList = pathlist[mIx].mainhints; @@ -1734,13 +1734,13 @@ WriteHints(indx pathEltIx) { indx ix, opix; int16_t opcount, subrIx, length; - PHintElt* hintArray; + HintElt** hintArray; bool writeSubrOnce; /* hintArray contains the pointers to the beginning of the linked list of hints for each design at pathEltIx. */ - hintArray = (PHintElt*)AllocateMem(masterCount, sizeof(HintElt*), + hintArray = (HintElt**)AllocateMem(masterCount, sizeof(HintElt*), "hint element array"); /* Initialize hint array. */ for (ix = 0; ix < masterCount; ix++) @@ -1843,7 +1843,7 @@ WritePathElt(indx mIx, indx eltIx, int16_t pathType, indx startix, int16_t length) { Cd c1, c2, c3; - PGlyphPathElt path, path0; + GlyphPathElt *path, *path0; path = &pathlist[mIx].path[eltIx]; path0 = &pathlist[0].path[eltIx]; @@ -1936,8 +1936,8 @@ OptimizeMtorDt(indx eltix, int16_t* op, bool* xequal, bool* yequal) static bool CoordsEqual(indx master1, indx master2, indx opIx, indx eltIx, int16_t op) { - PGlyphPathElt path1 = &pathlist[master1].path[eltIx], - path2 = &pathlist[master2].path[eltIx]; + GlyphPathElt *path1 = &pathlist[master1].path[eltIx], + *path2 = &pathlist[master2].path[eltIx]; switch (opIx) { case 0: @@ -1986,7 +1986,7 @@ static bool SamePathValues(indx eltIx, int16_t op, indx startIx, int16_t length) { indx ix, mIx; - /* PGlyphPathElt path0 = &pathlist[0].path[eltIx]; */ + /* GlyphPathElt* path0 = &pathlist[0].path[eltIx]; */ bool same = true; for (ix = 0; ix < length; ix++) { diff --git a/libpsautohint/src/charpath.h b/libpsautohint/src/charpath.h index 80ce1471c..210881e5d 100644 --- a/libpsautohint/src/charpath.h +++ b/libpsautohint/src/charpath.h @@ -17,35 +17,35 @@ typedef struct _t_hintelt { int16_t type; /* RB, RY, RM, RV */ Fixed leftorbot, rightortop; int32_t pathix1, pathix2; - } HintElt, *PHintElt; + } HintElt; -typedef struct _t_glyphpathelt { +typedef struct { int16_t type; /* RMT, RDT, RCT, CP */ /* the following fields must be cleared in charpathpriv.c/CheckPath */ bool isFlex:1, sol:1, eol:1, remove:1; int unused:12; - PHintElt hints; + HintElt* hints; Fixed x, y, x1, y1, x2, y2, x3, y3; /* absolute coordinates */ int32_t rx, ry, rx1, ry1, rx2, ry2, rx3, ry3; /* relative coordinates */ - } GlyphPathElt, *PGlyphPathElt; + } GlyphPathElt; -typedef struct _t_pathlist { - PGlyphPathElt path; - PHintElt mainhints; +typedef struct { + GlyphPathElt* path; + HintElt* mainhints; int32_t sb; int16_t width; -} PathList, *PPathList; +} PathList; extern int32_t gPathEntries; /* number of elements in a glyph path */ extern bool gAddHints; /* whether to include hints in the font */ -PGlyphPathElt AppendGlyphPathElement(int); +GlyphPathElt* AppendGlyphPathElement(int); void ResetMaxPathEntries(void); -void SetCurrPathList(PPathList); +void SetCurrPathList(PathList*); -void SetHintsElt(int16_t, CdPtr, int32_t, int32_t, bool); +void SetHintsElt(int16_t, Cd*, int32_t, int32_t, bool); void SetNoHints(void); diff --git a/libpsautohint/src/charpathpriv.c b/libpsautohint/src/charpathpriv.c index 4e09edd61..9660fc3e1 100644 --- a/libpsautohint/src/charpathpriv.c +++ b/libpsautohint/src/charpathpriv.c @@ -20,7 +20,7 @@ bool gAddHints = true; /* whether to include hints in the font */ #define MAXPATHELT 100 /* initial maximum number of path elements */ static int32_t maxPathEntries = 0; -static PPathList currPathList = NULL; +static PathList* currPathList = NULL; static void CheckPath(void); @@ -36,7 +36,7 @@ CheckPath(void) int i; maxPathEntries += MAXPATHELT; - currPathList->path = (PGlyphPathElt)ReallocateMem( + currPathList->path = (GlyphPathElt*)ReallocateMem( (char*)currPathList->path, maxPathEntries * sizeof(GlyphPathElt), "path element array"); /* Initialize certain fields in GlyphPathElt, since realloc'ed memory */ @@ -51,7 +51,7 @@ CheckPath(void) } } -PGlyphPathElt +GlyphPathElt* AppendGlyphPathElement(int pathtype) { @@ -69,17 +69,17 @@ ResetMaxPathEntries(void) } void -SetCurrPathList(PPathList plist) +SetCurrPathList(PathList* plist) { currPathList = plist; } void -SetHintsElt(int16_t hinttype, CdPtr coord, int32_t elt1, int32_t elt2, +SetHintsElt(int16_t hinttype, Cd* coord, int32_t elt1, int32_t elt2, bool mainhints) { - PHintElt* hintEntry; - PHintElt lastHintEntry = NULL; + HintElt** hintEntry; + HintElt* lastHintEntry = NULL; if (!gAddHints) return; @@ -89,7 +89,7 @@ SetHintsElt(int16_t hinttype, CdPtr coord, int32_t elt1, int32_t elt2, CheckPath(); hintEntry = &currPathList->path[gPathEntries].hints; } - lastHintEntry = (PHintElt)AllocateMem(1, sizeof(HintElt), "hint element"); + lastHintEntry = (HintElt*)AllocateMem(1, sizeof(HintElt), "hint element"); lastHintEntry->type = hinttype; lastHintEntry->leftorbot = coord->x; lastHintEntry->rightortop = coord->y; /* absolute coordinates */ diff --git a/libpsautohint/src/charprop.c b/libpsautohint/src/charprop.c index 50bfbe89d..ed2c7a611 100644 --- a/libpsautohint/src/charprop.c +++ b/libpsautohint/src/charprop.c @@ -161,8 +161,8 @@ SpecialSolEol(void) return true; } -static PPathElt -SubpathEnd(PPathElt e) +static PathElt* +SubpathEnd(PathElt* e) { while (true) { e = e->next; @@ -173,8 +173,8 @@ SubpathEnd(PPathElt e) } } -static PPathElt -SubpathStart(PPathElt e) +static PathElt* +SubpathStart(PathElt* e) { while (e != gPathStart) { if (e->type == MOVETO) @@ -184,8 +184,8 @@ SubpathStart(PPathElt e) return e; } -static PPathElt -SolEol(PPathElt e) +static PathElt* +SolEol(PathElt* e) { e = SubpathStart(e); e->sol = true; @@ -197,7 +197,7 @@ SolEol(PPathElt e) static void SolEolAll(void) { - PPathElt e; + PathElt* e; e = gPathStart->next; while (e != NULL) { e = SolEol(e); @@ -208,7 +208,7 @@ SolEolAll(void) static void SolEolUpperOrLower(bool upper) { - PPathElt e, s1, s2; + PathElt *e, *s1, *s2; Fixed x1, y1, s1y, s2y; bool s1Upper; if (gPathStart == NULL) diff --git a/libpsautohint/src/check.c b/libpsautohint/src/check.c index 91e7c5911..d2c5370a3 100644 --- a/libpsautohint/src/check.c +++ b/libpsautohint/src/check.c @@ -19,7 +19,7 @@ static Fixed yflatstartx, yflatstarty, yflatendx, yflatendy; static Fixed xflatstarty, xflatstartx, xflatendx, xflatendy; static bool vert, started, reCheckSmooth; static Fixed loc, frst, lst, fltnvalue; -static PPathElt e; +static PathElt* e; static bool forMultiMaster = false, inflPtFound = false; #define STARTING (0) @@ -250,7 +250,7 @@ CPDirection(Fixed x1, Fixed cy1, Fixed x2, Fixed y2, Fixed x3, Fixed y3) } void -RMovePoint(Fixed dx, Fixed dy, int32_t whichcp, PPathElt e) +RMovePoint(Fixed dx, Fixed dy, int32_t whichcp, PathElt* e) { if (whichcp == cpStart) { e = e->prev; @@ -282,9 +282,9 @@ RMovePoint(Fixed dx, Fixed dy, int32_t whichcp, PPathElt e) } void -Delete(PPathElt e) +Delete(PathElt* e) { - PPathElt nxt, prv; + PathElt *nxt, *prv; nxt = e->next; prv = e->prev; if (nxt != NULL) @@ -331,7 +331,7 @@ GetInflectionPoint(Fixed px, Fixed py, Fixed px1, Fixed pcy1, Fixed px2, } static void -CheckSCurve(PPathElt ee) +CheckSCurve(PathElt* ee) { FltnRec fr; Cd c0, c1, c2, c3; @@ -363,7 +363,7 @@ CheckSCurve(PPathElt ee) static void CheckZeroLength(void) { - PPathElt e, NxtE; + PathElt *e, *NxtE; Fixed x0, cy0, x1, cy1, x2, y2, x3, y3; e = gPathStart; while (e != NULL) { /* delete zero length elements */ @@ -392,7 +392,7 @@ CheckZeroLength(void) void CheckSmooth(void) { - PPathElt e, nxt, NxtE; + PathElt *e, *nxt, *NxtE; bool recheck; Fixed x0, cy0, x1, cy1, x2, y2, x3, y3, smdiff, xx, yy; CheckZeroLength(); @@ -468,7 +468,7 @@ chkBBDT(Cd c) void CheckForMultiMoveTo(void) { - PPathElt e = gPathStart; + PathElt* e = gPathStart; bool moveto; moveto = false; while (e != NULL) { @@ -483,7 +483,7 @@ CheckForMultiMoveTo(void) } void -CheckBBoxEdge(PPathElt e, bool vrt, Fixed lc, Fixed* pf, Fixed* pl) +CheckBBoxEdge(PathElt* e, bool vrt, Fixed lc, Fixed* pf, Fixed* pl) { FltnRec fr; Cd c0, c1, c2, c3; @@ -596,7 +596,7 @@ CheckSmoothness(Fixed x0, Fixed cy0, Fixed x1, Fixed cy1, Fixed x2, Fixed y2, void CheckForDups(void) { - PPathElt ob, nxt; + PathElt *ob, *nxt; Fixed x, y; ob = gPathStart; while (ob != NULL) { @@ -620,9 +620,9 @@ CheckForDups(void) } void -MoveSubpathToEnd(PPathElt e) +MoveSubpathToEnd(PathElt* e) { - PPathElt subEnd, subStart, subNext, subPrev; + PathElt *subEnd, *subStart, *subNext, *subPrev; subEnd = (e->type == CLOSEPATH) ? e : GetClosedBy(e); subStart = GetDest(subEnd); if (subEnd == gPathEnd) diff --git a/libpsautohint/src/control.c b/libpsautohint/src/control.c index 532d31d41..18d1bfb00 100644 --- a/libpsautohint/src/control.c +++ b/libpsautohint/src/control.c @@ -10,8 +10,8 @@ #include "ac.h" #include "bbox.h" -static void DoHStems(const ACFontInfo* fontinfo, PHintVal sLst1); -static void DoVStems(PHintVal sLst); +static void DoHStems(const ACFontInfo* fontinfo, HintVal* sLst1); +static void DoVStems(HintVal* sLst); static bool CounterFailed; @@ -26,7 +26,7 @@ InitAll(const ACFontInfo* fontinfo, int32_t reason) } static int32_t -PtLstLen(PHintPoint lst) +PtLstLen(HintPoint* lst) { int32_t cnt = 0; while (lst != NULL) { @@ -37,7 +37,7 @@ PtLstLen(PHintPoint lst) } static int32_t -PointListCheck(PHintPoint new, PHintPoint lst) +PointListCheck(HintPoint* new, HintPoint* lst) { /* -1 means not a member, 1 means already a member, 0 means conflicts */ Fixed l1 = 0, l2 = 0, n1 = 0, n2 = 0, tmp, halfMargin; @@ -119,7 +119,7 @@ PointListCheck(PHintPoint new, PHintPoint lst) } static bool -SameHintLists(PHintPoint lst1, PHintPoint lst2) +SameHintLists(HintPoint* lst1, HintPoint* lst2) { if (PtLstLen(lst1) != PtLstLen(lst2)) { return false; @@ -145,7 +145,7 @@ SameHints(int32_t cn1, int32_t cn2) void MergeFromMainHints(char ch) { - PHintPoint lst; + HintPoint* lst; for (lst = gPtLstArray[0]; lst != NULL; lst = lst->next) { if (lst->c != ch) { continue; @@ -161,12 +161,12 @@ MergeFromMainHints(char ch) } void -AddHintPoint(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch, PPathElt p0, - PPathElt p1) +AddHintPoint(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch, PathElt* p0, + PathElt* p1) { - PHintPoint pt; + HintPoint* pt; int32_t chk; - pt = (PHintPoint)Alloc(sizeof(HintPoint)); + pt = (HintPoint*)Alloc(sizeof(HintPoint)); pt->x0 = x0; pt->y0 = y0; pt->x1 = x1; @@ -188,7 +188,7 @@ AddHintPoint(Fixed x0, Fixed y0, Fixed x1, Fixed y1, char ch, PPathElt p0, } static void -CopyHintFromLst(char hint, PHintPoint lst) +CopyHintFromLst(char hint, HintPoint* lst) { bool bvflg = (hint == 'b' || hint == 'v'); while (lst != NULL) { @@ -216,10 +216,10 @@ CopyMainH(void) } void -AddHPair(PHintVal v, char ch) +AddHPair(HintVal* v, char ch) { Fixed bot, top; - PPathElt p0, p1, p; + PathElt *p0, *p1, *p; bot = -v->vLoc1; top = -v->vLoc2; p0 = v->vBst->vSeg1->sElt; @@ -249,10 +249,10 @@ AddHPair(PHintVal v, char ch) } void -AddVPair(PHintVal v, char ch) +AddVPair(HintVal* v, char ch) { Fixed lft, rght; - PPathElt p0, p1, p; + PathElt *p0, *p1, *p; lft = v->vLoc1; rght = v->vLoc2; p0 = v->vBst->vSeg1->sElt; @@ -269,12 +269,12 @@ AddVPair(PHintVal v, char ch) } static bool -UseCounter(PHintVal sLst, bool mhint) +UseCounter(HintVal* sLst, bool mhint) { int32_t cnt = 0; Fixed minLoc, midLoc, maxLoc, prevBstVal, bestVal; Fixed minDelta, midDelta, maxDelta, th; - PHintVal lst, newLst; + HintVal *lst, *newLst; minLoc = midLoc = maxLoc = FixInt(20000); minDelta = midDelta = maxDelta = 0; lst = sLst; @@ -344,10 +344,10 @@ static void GetNewPtLst(void) { if (gNumPtLsts >= gMaxPtLsts) { /* increase size */ - PHintPoint* newArray; + HintPoint** newArray; int32_t i; gMaxPtLsts += 5; - newArray = (PHintPoint*)Alloc(gMaxPtLsts * sizeof(PHintPoint)); + newArray = (HintPoint**)Alloc(gMaxPtLsts * sizeof(HintPoint*)); for (i = 0; i < gMaxPtLsts - 5; i++) { newArray[i] = gPtLstArray[i]; } @@ -360,7 +360,7 @@ GetNewPtLst(void) } void -XtraHints(PPathElt e) +XtraHints(PathElt* e) { /* this can be simplified for standalone hinting */ gPtLstArray[gPtLstIndex] = gPointList; @@ -376,7 +376,7 @@ static void Blues(const ACFontInfo* fontinfo) { Fixed pv = 0, pd = 0, pc = 0, pb = 0, pa = 0; - PHintVal sLst; + HintVal* sLst; /* Top alignment zones are in the global 'topBands', bottom in 'botBands'. @@ -607,7 +607,7 @@ Blues(const ACFontInfo* fontinfo) } static void -DoHStems(const ACFontInfo* fontinfo, PHintVal sLst1) +DoHStems(const ACFontInfo* fontinfo, HintVal* sLst1) { Fixed glyphTop = INT32_MIN, glyphBot = INT32_MAX; bool curved; @@ -652,7 +652,7 @@ static void Yellows(void) { Fixed pv = 0, pd = 0, pc = 0, pb = 0, pa = 0; - PHintVal sLst; + HintVal* sLst; LogMsg(LOGDEBUG, OK, "generate yellows"); GenVPts(SpecialGlyphType()); LogMsg(LOGDEBUG, OK, "evaluate"); @@ -715,7 +715,7 @@ Yellows(void) } static void -DoVStems(PHintVal sLst) +DoVStems(HintVal* sLst) { if (!gDoAligns && !gDoStems) { return; @@ -740,7 +740,7 @@ DoVStems(PHintVal sLst) static void RemoveRedundantFirstHints(void) { - PPathElt e; + PathElt* e; if (gNumPtLsts < 2 || !SameHints(0, 1)) { return; } diff --git a/libpsautohint/src/eval.c b/libpsautohint/src/eval.c index 11713fdc7..2c4a91045 100644 --- a/libpsautohint/src/eval.c +++ b/libpsautohint/src/eval.c @@ -94,7 +94,7 @@ CalcOverlapDist(Fixed d, Fixed overlaplen, Fixed minlen) */ static void -EvalHPair(PHintSeg botSeg, PHintSeg topSeg, Fixed* pspc, Fixed* pv) +EvalHPair(HintSeg* botSeg, HintSeg* topSeg, Fixed* pspc, Fixed* pv) { Fixed brght, blft, bloc, tloc, trght, tlft; Fixed mndist, dist, dy; @@ -157,7 +157,7 @@ EvalHPair(PHintSeg botSeg, PHintSeg topSeg, Fixed* pspc, Fixed* pv) } static void -HStemMiss(PHintSeg botSeg, PHintSeg topSeg) +HStemMiss(HintSeg* botSeg, HintSeg* topSeg) { Fixed brght, blft, bloc, tloc, trght, tlft; Fixed mndist, dist, dy; @@ -213,7 +213,7 @@ HStemMiss(PHintSeg botSeg, PHintSeg topSeg) } static void -EvalVPair(PHintSeg leftSeg, PHintSeg rightSeg, Fixed* pspc, Fixed* pv) +EvalVPair(HintSeg* leftSeg, HintSeg* rightSeg, Fixed* pspc, Fixed* pv) { Fixed ltop, lbot, lloc, rloc, rtop, rbot; Fixed mndist, dx, dist; @@ -266,7 +266,7 @@ EvalVPair(PHintSeg leftSeg, PHintSeg rightSeg, Fixed* pspc, Fixed* pv) } static void -VStemMiss(PHintSeg leftSeg, PHintSeg rightSeg) +VStemMiss(HintSeg* leftSeg, HintSeg* rightSeg) { Fixed ltop, lbot, lloc, rloc, rtop, rbot; Fixed mndist, dx, dist; @@ -318,11 +318,11 @@ VStemMiss(PHintSeg leftSeg, PHintSeg rightSeg) } static void -InsertVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, PHintSeg lSeg, - PHintSeg rSeg) +InsertVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, HintSeg* lSeg, + HintSeg* rSeg) { - PHintVal item, vlist, vprev; - item = (PHintVal)Alloc(sizeof(HintVal)); + HintVal *item, *vlist, *vprev; + item = (HintVal*)Alloc(sizeof(HintVal)); item->vVal = val; item->initVal = val; item->vLoc1 = lft; @@ -356,8 +356,8 @@ InsertVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, PHintSeg lSeg, #define LePruneValue(val) ((val) < FixOne && ((val) << 10) <= gPruneValue) static void -AddVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, PHintSeg lSeg, - PHintSeg rSeg) +AddVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, HintSeg* lSeg, + HintSeg* rSeg) { if (val == 0) return; @@ -375,10 +375,10 @@ AddVValue(Fixed lft, Fixed rght, Fixed val, Fixed spc, PHintSeg lSeg, } static void -InsertHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, PHintSeg bSeg, - PHintSeg tSeg, bool ghst) +InsertHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, HintSeg* bSeg, + HintSeg* tSeg, bool ghst) { - PHintVal item, vlist, vprev, vl; + HintVal *item, *vlist, *vprev, *vl; vlist = gValList; vprev = NULL; while (vlist != NULL) { @@ -403,7 +403,7 @@ InsertHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, PHintSeg bSeg, return; vl = vl->vNxt; } - item = (PHintVal)Alloc(sizeof(HintVal)); + item = (HintVal*)Alloc(sizeof(HintVal)); item->vVal = val; item->initVal = val; item->vSpc = spc; @@ -421,8 +421,8 @@ InsertHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, PHintSeg bSeg, } static void -AddHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, PHintSeg bSeg, - PHintSeg tSeg) +AddHValue(Fixed bot, Fixed top, Fixed val, Fixed spc, HintSeg* bSeg, + HintSeg* tSeg) { bool ghst; if (val == 0) @@ -476,9 +476,9 @@ CombVals(Fixed v1, Fixed v2) static void CombineValues(void) { /* works for both H and V */ - PHintVal vlist = gValList; + HintVal* vlist = gValList; while (vlist != NULL) { - PHintVal v1 = vlist->vNxt; + HintVal* v1 = vlist->vNxt; Fixed loc1 = vlist->vLoc1; Fixed loc2 = vlist->vLoc2; Fixed val = vlist->vVal; @@ -505,7 +505,7 @@ CombineValues(void) void EvalV(void) { - PHintSeg lList, rList; + HintSeg *lList, *rList; Fixed lft, rght; Fixed val, spc; gValList = NULL; @@ -530,7 +530,7 @@ EvalV(void) void EvalH(void) { - PHintSeg bList, tList, lst, ghostSeg; + HintSeg *bList, *tList, *lst, *ghostSeg; Fixed lstLoc, tempLoc, cntr; Fixed val, spc; gValList = NULL; @@ -550,7 +550,7 @@ EvalH(void) } bList = bList->sNxt; } - ghostSeg = (PHintSeg)Alloc(sizeof(HintSeg)); + ghostSeg = (HintSeg*)Alloc(sizeof(HintSeg)); ghostSeg->sType = sGHOST; ghostSeg->sElt = NULL; if (gLenBotBands < 2 && gLenTopBands < 2) diff --git a/libpsautohint/src/fix.c b/libpsautohint/src/fix.c index 775636aae..75d9395db 100644 --- a/libpsautohint/src/fix.c +++ b/libpsautohint/src/fix.c @@ -109,7 +109,7 @@ CheckForNearBands(Fixed loc, Fixed* blues, int32_t numblues) } bool -FindLineSeg(Fixed loc, PHintSeg sL) +FindLineSeg(Fixed loc, HintSeg* sL) { while (sL != NULL) { if (sL->sLoc == loc && sL->sType == sLINE) @@ -124,9 +124,9 @@ FindLineSeg(Fixed loc, PHintSeg sL) the horizontal alignment zones. The list contains segments that may or may not have hints added. */ void -CheckTfmVal(PHintSeg hSegList, Fixed* bandList, int32_t length) +CheckTfmVal(HintSeg* hSegList, Fixed* bandList, int32_t length) { - PHintSeg sList = hSegList; + HintSeg* sList = hSegList; while (sList != NULL) { Fixed tfmval = -sList->sLoc; @@ -156,7 +156,7 @@ CheckTfmVal(Fixed b, Fixed t, bool vert) #endif void -CheckVal(PHintVal val, bool vert) +CheckVal(HintVal* val, bool vert) { Fixed* stems; int32_t numstems, i; @@ -204,7 +204,7 @@ CheckVal(PHintVal val, bool vert) } void -CheckVals(PHintVal vlst, bool vert) +CheckVals(HintVal* vlst, bool vert) { while (vlst != NULL) { CheckVal(vlst, vert); @@ -213,9 +213,9 @@ CheckVals(PHintVal vlst, bool vert) } static void -FixH(PPathElt e, Fixed fixy, Fixed fixdy) +FixH(PathElt* e, Fixed fixy, Fixed fixdy) { - PPathElt prev, nxt; + PathElt *prev, *nxt; RMovePoint(0, fixdy, cpStart, e); RMovePoint(0, fixdy, cpEnd, e); prev = e->prev; @@ -231,7 +231,7 @@ FixH(PPathElt e, Fixed fixy, Fixed fixdy) static void FixHs(Fixed fixy, Fixed fixdy) { /* y dy in user space */ - PPathElt e; + PathElt* e; Fixed xlst = 0, ylst = 0, xinit = 0, yinit = 0; fixy = -fixy; fixdy = -fixdy; @@ -266,9 +266,9 @@ FixHs(Fixed fixy, Fixed fixdy) } static void -FixV(PPathElt e, Fixed fixx, Fixed fixdx) +FixV(PathElt* e, Fixed fixx, Fixed fixdx) { - PPathElt prev, nxt; + PathElt *prev, *nxt; RMovePoint(fixdx, 0, cpStart, e); RMovePoint(fixdx, 0, cpEnd, e); prev = e->prev; @@ -284,7 +284,7 @@ FixV(PPathElt e, Fixed fixx, Fixed fixdx) static void FixVs(Fixed fixx, Fixed fixdx) { /* x dx in user space */ - PPathElt e; + PathElt* e; Fixed xlst = 0, ylst = 0, xinit = 0, yinit = 0; e = gPathStart; while (e != NULL) { diff --git a/libpsautohint/src/flat.c b/libpsautohint/src/flat.c index 4747d2e60..5122fecb8 100644 --- a/libpsautohint/src/flat.c +++ b/libpsautohint/src/flat.c @@ -10,7 +10,7 @@ #include "ac.h" static void -FMiniFltn(Cd f0, Cd f1, Cd f2, Cd f3, PFltnRec pfr, bool inside) +FMiniFltn(Cd f0, Cd f1, Cd f2, Cd f3, FltnRec* pfr, bool inside) { /* Like FFltnCurve, but assumes abs(deltas) <= 127 pixels */ /* 8 bits of fraction gives enough precision for splitting curves */ @@ -291,7 +291,7 @@ FMiniFltn(Cd f0, Cd f1, Cd f2, Cd f3, PFltnRec pfr, bool inside) /* abs values of coords must be < 2^14 so will not overflow when find midpoint by add and shift */ static void -FFltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, PFltnRec pfr, bool inrect) +FFltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, FltnRec* pfr, bool inrect) { Cd d0, d1, d2, d3; Fixed llx, lly, urx, ury; @@ -383,7 +383,7 @@ FFltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, PFltnRec pfr, bool inrect) } void -FltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, PFltnRec pfr) +FltnCurve(Cd c0, Cd c1, Cd c2, Cd c3, FltnRec* pfr) { pfr->limit = 6; /* limit on how many times a bez curve can be split in half by recursive calls to FFltnCurve() */ diff --git a/libpsautohint/src/gen.c b/libpsautohint/src/gen.c index 7e8c0a6df..2ee491631 100644 --- a/libpsautohint/src/gen.c +++ b/libpsautohint/src/gen.c @@ -12,7 +12,7 @@ #include "ac.h" #include "bbox.h" -static PSegLnkLst Hlnks, Vlnks; +static SegLnkLst *Hlnks, *Vlnks; static int32_t cpFrom, cpTo; void @@ -29,14 +29,14 @@ InitGen(int32_t reason) } static void -LinkSegment(PPathElt e, bool Hflg, PHintSeg seg) +LinkSegment(PathElt* e, bool Hflg, HintSeg* seg) { - PSegLnk newlnk; - PSegLnkLst newlst, globlst; - newlnk = (PSegLnk)Alloc(sizeof(SegLnk)); + SegLnk* newlnk; + SegLnkLst *newlst, *globlst; + newlnk = (SegLnk*)Alloc(sizeof(SegLnk)); newlnk->seg = seg; - newlst = (PSegLnkLst)Alloc(sizeof(SegLnkLst)); - globlst = (PSegLnkLst)Alloc(sizeof(SegLnkLst)); + newlst = (SegLnkLst*)Alloc(sizeof(SegLnkLst)); + globlst = (SegLnkLst*)Alloc(sizeof(SegLnkLst)); globlst->lnk = newlnk; newlst->lnk = newlnk; if (Hflg) { @@ -53,11 +53,11 @@ LinkSegment(PPathElt e, bool Hflg, PHintSeg seg) } static void -CopySegmentLink(PPathElt e1, PPathElt e2, bool Hflg) +CopySegmentLink(PathElt* e1, PathElt* e2, bool Hflg) { /* copy reference to first link from e1 to e2 */ - PSegLnkLst newlst; - newlst = (PSegLnkLst)Alloc(sizeof(SegLnkLst)); + SegLnkLst* newlst; + newlst = (SegLnkLst*)Alloc(sizeof(SegLnkLst)); if (Hflg) { newlst->lnk = e1->Hs->lnk; newlst->next = e2->Hs; @@ -71,11 +71,11 @@ CopySegmentLink(PPathElt e1, PPathElt e2, bool Hflg) static void AddSegment(Fixed from, Fixed to, Fixed loc, int32_t lftLstNm, int32_t rghtLstNm, - PPathElt e1, PPathElt e2, bool Hflg, int32_t typ) + PathElt* e1, PathElt* e2, bool Hflg, int32_t typ) { - PHintSeg seg, segList, prevSeg; + HintSeg *seg, *segList, *prevSeg; int32_t segNm; - seg = (PHintSeg)Alloc(sizeof(HintSeg)); + seg = (HintSeg*)Alloc(sizeof(HintSeg)); seg->sLoc = loc; if (from > to) { seg->sMax = from; @@ -125,7 +125,7 @@ AddSegment(Fixed from, Fixed to, Fixed loc, int32_t lftLstNm, int32_t rghtLstNm, } void -AddVSegment(Fixed from, Fixed to, Fixed loc, PPathElt p1, PPathElt p2, +AddVSegment(Fixed from, Fixed to, Fixed loc, PathElt* p1, PathElt* p2, int32_t typ, int32_t i) { LogMsg(LOGDEBUG, OK, "add vseg %g %g to %g %g %d", FixToDbl(loc), @@ -135,7 +135,7 @@ AddVSegment(Fixed from, Fixed to, Fixed loc, PPathElt p1, PPathElt p2, } void -AddHSegment(Fixed from, Fixed to, Fixed loc, PPathElt p1, PPathElt p2, +AddHSegment(Fixed from, Fixed to, Fixed loc, PathElt* p1, PathElt* p2, int32_t typ, int32_t i) { LogMsg(LOGDEBUG, OK, "add hseg %g %g to %g %g %d", FixToDbl(from), @@ -200,7 +200,7 @@ IsCCW(Fixed x0, Fixed y0, Fixed x1, Fixed y1, Fixed x2, Fixed y2) } static void -DoHBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +DoHBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2, x3, y3; bool ysame; @@ -235,7 +235,7 @@ DoHBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) } static void -DoHBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +DoHBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2; bool ysame; @@ -269,7 +269,7 @@ DoHBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) } static void -DoVBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +DoVBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2, x3, y3; bool xsame; @@ -304,7 +304,7 @@ DoVBendsNxt(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) } static void -DoVBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +DoVBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2; bool xsame; @@ -338,11 +338,11 @@ DoVBendsPrv(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) } static void -MergeLnkSegs(PHintSeg seg1, PHintSeg seg2, PSegLnkLst lst) +MergeLnkSegs(HintSeg* seg1, HintSeg* seg2, SegLnkLst* lst) { /* replace lnk refs to seg1 by seg2 */ while (lst != NULL) { - PSegLnk lnk = lst->lnk; + SegLnk* lnk = lst->lnk; if (lnk->seg == seg1) lnk->seg = seg2; lst = lst->next; @@ -350,19 +350,19 @@ MergeLnkSegs(PHintSeg seg1, PHintSeg seg2, PSegLnkLst lst) } static void -MergeHSegs(PHintSeg seg1, PHintSeg seg2) +MergeHSegs(HintSeg* seg1, HintSeg* seg2) { MergeLnkSegs(seg1, seg2, Hlnks); } static void -MergeVSegs(PHintSeg seg1, PHintSeg seg2) +MergeVSegs(HintSeg* seg1, HintSeg* seg2) { MergeLnkSegs(seg1, seg2, Vlnks); } static void -ReportRemSeg(int32_t l, PHintSeg lst) +ReportRemSeg(int32_t l, HintSeg* lst) { Fixed from = 0, to = 0, loc = 0; /* this assumes !YgoesUp */ @@ -397,15 +397,15 @@ ReportRemSeg(int32_t l, PHintSeg lst) static void RemExtraBends(int32_t l0, int32_t l1) { - PHintSeg lst0 = gSegLists[l0]; - PHintSeg prv = NULL; + HintSeg* lst0 = gSegLists[l0]; + HintSeg* prv = NULL; while (lst0 != NULL) { - PHintSeg nxt = lst0->sNxt; + HintSeg* nxt = lst0->sNxt; Fixed loc0 = lst0->sLoc; - PHintSeg lst = gSegLists[l1]; - PHintSeg p = NULL; + HintSeg* lst = gSegLists[l1]; + HintSeg* p = NULL; while (lst != NULL) { - PHintSeg n = lst->sNxt; + HintSeg* n = lst->sNxt; Fixed loc = lst->sLoc; if (loc > loc0) break; /* list in increasing order by sLoc */ @@ -444,14 +444,14 @@ RemExtraBends(int32_t l0, int32_t l1) } static void -CompactList(int32_t i, void (*nm)(PHintSeg, PHintSeg)) +CompactList(int32_t i, void (*nm)(HintSeg*, HintSeg*)) { - PHintSeg lst = gSegLists[i]; - PHintSeg prv = NULL; + HintSeg* lst = gSegLists[i]; + HintSeg* prv = NULL; while (lst != NULL) { bool flg; - PHintSeg nxt = lst->sNxt; - PHintSeg nxtprv = lst; + HintSeg* nxt = lst->sNxt; + HintSeg* nxtprv = lst; while (true) { Fixed lstmin, lstmax, nxtmin, nxtmax; if ((nxt == NULL) || (nxt->sLoc > lst->sLoc)) { @@ -554,7 +554,7 @@ TstFlat(Fixed dmn, Fixed dmx) } static bool -NxtHorz(Fixed x, Fixed y, PPathElt p) +NxtHorz(Fixed x, Fixed y, PathElt* p) { Fixed x2, y2, x3, y3; NxtForBend(p, &x2, &y2, &x3, &y3); @@ -562,7 +562,7 @@ NxtHorz(Fixed x, Fixed y, PPathElt p) } static bool -PrvHorz(Fixed x, Fixed y, PPathElt p) +PrvHorz(Fixed x, Fixed y, PathElt* p) { Fixed x2, y2; PrvForBend(p, &x2, &y2); @@ -570,7 +570,7 @@ PrvHorz(Fixed x, Fixed y, PPathElt p) } static bool -NxtVert(Fixed x, Fixed y, PPathElt p) +NxtVert(Fixed x, Fixed y, PathElt* p) { Fixed x2, y2, x3, y3; NxtForBend(p, &x2, &y2, &x3, &y3); @@ -578,7 +578,7 @@ NxtVert(Fixed x, Fixed y, PPathElt p) } static bool -PrvVert(Fixed x, Fixed y, PPathElt p) +PrvVert(Fixed x, Fixed y, PathElt* p) { Fixed x2, y2; PrvForBend(p, &x2, &y2); @@ -597,7 +597,7 @@ TstSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, Fixed x2, Fixed y2) } static bool -PrvSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +PrvSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2; p = PrvForBend(p, &x2, &y2); @@ -607,7 +607,7 @@ PrvSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) } static bool -NxtSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PPathElt p) +NxtSameDir(Fixed x0, Fixed y0, Fixed x1, Fixed y1, PathElt* p) { Fixed x2, y2, x3, y3; p = NxtForBend(p, &x2, &y2, &x3, &y3); @@ -622,7 +622,7 @@ void GenVPts(int32_t specialGlyphType) { /* specialGlyphType 1 = upper; -1 = lower; 0 = neither */ - PPathElt p, fl; + PathElt *p, *fl; bool isVert, flex1, flex2; Fixed flx0, fly0, llx, lly, urx, ury, yavg, yend, ydist, q, q2; Fixed prvx, prvy, nxtx, nxty, xx, yy, yd2; @@ -851,7 +851,7 @@ PickHSpot(Fixed x0, Fixed y0, Fixed x1, Fixed y1, Fixed xdist, Fixed px1, void GenHPts(void) { - PPathElt p, fl; + PathElt *p, *fl; bool isHoriz, flex1, flex2; Fixed flx0, fly0, llx, lly, urx, ury, xavg, xend, xdist, q, q2; Fixed prvx, prvy, nxtx, nxty, xx, yy, xd2; diff --git a/libpsautohint/src/head.c b/libpsautohint/src/head.c index 7bce03b35..b81470354 100644 --- a/libpsautohint/src/head.c +++ b/libpsautohint/src/head.c @@ -9,8 +9,8 @@ #include "ac.h" -PPathElt -GetDest(PPathElt cldest) +PathElt* +GetDest(PathElt* cldest) { if (cldest == NULL) return NULL; @@ -23,8 +23,8 @@ GetDest(PPathElt cldest) } } -PPathElt -GetClosedBy(PPathElt clsdby) +PathElt* +GetClosedBy(PathElt* clsdby) { if (clsdby == NULL) return NULL; @@ -42,7 +42,7 @@ GetClosedBy(PPathElt clsdby) } void -GetEndPoint(PPathElt e, Fixed* x1p, Fixed* y1p) +GetEndPoint(PathElt* e, Fixed* x1p, Fixed* y1p) { if (e == NULL) { *x1p = 0; @@ -73,7 +73,7 @@ GetEndPoint(PPathElt e, Fixed* x1p, Fixed* y1p) } void -GetEndPoints(PPathElt p, Fixed* px0, Fixed* py0, Fixed* px1, Fixed* py1) +GetEndPoints(PathElt* p, Fixed* px0, Fixed* py0, Fixed* px1, Fixed* py1) { GetEndPoint(p, px1, py1); GetEndPoint(p->prev, px0, py0); @@ -155,7 +155,7 @@ HorzQuo(Fixed xk, Fixed yk, Fixed xl, Fixed yl) } bool -IsTiny(PPathElt e) +IsTiny(PathElt* e) { Fixed x0 = 0, y0 = 0, x1 = 0, y1 = 0; GetEndPoints(e, &x0, &y0, &x1, &y1); @@ -163,7 +163,7 @@ IsTiny(PPathElt e) } bool -IsShort(PPathElt e) +IsShort(PathElt* e) { Fixed x0 = 0, y0 = 0, x1 = 0, y1 = 0, dx = 0, dy = 0, mn = 0, mx = 0; GetEndPoints(e, &x0, &y0, &x1, &y1); @@ -182,10 +182,10 @@ IsShort(PPathElt e) change in coordinare system. */ } -PPathElt -NxtForBend(PPathElt p, Fixed* px2, Fixed* py2, Fixed* px3, Fixed* py3) +PathElt* +NxtForBend(PathElt* p, Fixed* px2, Fixed* py2, Fixed* px3, Fixed* py3) { - PPathElt nxt, nxtMT = NULL; + PathElt *nxt, *nxtMT = NULL; Fixed x = 0, y = 0; nxt = p; GetEndPoint(p, &x, &y); @@ -224,10 +224,10 @@ NxtForBend(PPathElt p, Fixed* px2, Fixed* py2, Fixed* px3, Fixed* py3) return nxt; } -PPathElt -PrvForBend(PPathElt p, Fixed* px2, Fixed* py2) +PathElt* +PrvForBend(PathElt* p, Fixed* px2, Fixed* py2) { - PPathElt prv, prvCP = NULL; + PathElt *prv, *prvCP = NULL; Fixed x2, y2; prv = p; while (true) { @@ -266,9 +266,9 @@ PrvForBend(PPathElt p, Fixed* px2, Fixed* py2) } static bool -CheckHeight(bool upperFlag, PPathElt p) +CheckHeight(bool upperFlag, PathElt* p) { - PPathElt ee; + PathElt* ee; Fixed y, yy; ee = gPathStart; y = -p->y; @@ -284,13 +284,13 @@ CheckHeight(bool upperFlag, PPathElt p) } bool -IsLower(PPathElt p) +IsLower(PathElt* p) { return CheckHeight(false, p); } bool -IsUpper(PPathElt p) +IsUpper(PathElt* p) { return CheckHeight(true, p); } diff --git a/libpsautohint/src/merge.c b/libpsautohint/src/merge.c index 5ed75cf40..240d9f3ac 100644 --- a/libpsautohint/src/merge.c +++ b/libpsautohint/src/merge.c @@ -17,11 +17,11 @@ * band is expanded by CLSMRG in each direction */ static bool -CloseElements(PPathElt e1, PPathElt e2, Fixed loc1, Fixed loc2, bool vert) +CloseElements(PathElt* e1, PathElt* e2, Fixed loc1, Fixed loc2, bool vert) { Fixed tmp; Fixed x, y; - PPathElt e; + PathElt* e; if (e1 == e2) return true; if (loc1 < loc2) { @@ -55,10 +55,10 @@ CloseElements(PPathElt e1, PPathElt e2, Fixed loc1, Fixed loc2, bool vert) } bool -CloseSegs(PHintSeg s1, PHintSeg s2, bool vert) +CloseSegs(HintSeg* s1, HintSeg* s2, bool vert) { /* true if the elements for these segs are "close" in the path */ - PPathElt e1, e2; + PathElt *e1, *e2; Fixed loc1, loc2; if (s1 == s2) return true; @@ -81,7 +81,7 @@ DoPrune(void) that to be the head of the list. Then remove from the list any subsequent element for which 'pruned' is true. */ - PHintVal vL = gValList, vPrv; + HintVal *vL = gValList, *vPrv; while (vL != NULL && vL->pruned) vL = vL->vNxt; gValList = vL; @@ -99,8 +99,8 @@ DoPrune(void) } } -static PHintVal -PruneOne(PHintVal sLst, bool hFlg, PHintVal sL, int32_t i) +static HintVal* +PruneOne(HintVal* sLst, bool hFlg, HintVal* sL, int32_t i) { /* Simply set the 'pruned' field to True for sLst. */ if (hFlg) @@ -138,8 +138,8 @@ PruneOne(PHintVal sLst, bool hFlg, PHintVal sL, int32_t i) void PruneVVals(void) { - PHintVal sLst, sL; - PHintSeg seg1, seg2, sg1, sg2; + HintVal *sLst, *sL; + HintSeg *seg1, *seg2, *sg1, *sg2; Fixed lft, rht, l, r, prndist; Fixed val, v; bool flg, otherLft, otherRht; @@ -214,8 +214,8 @@ PruneVVals(void) void PruneHVals(void) { - PHintVal sLst, sL; - PHintSeg seg1, seg2, sg1, sg2; + HintVal *sLst, *sL; + HintSeg *seg1, *seg2, *sg1, *sg2; Fixed bot, top, t, b; Fixed val, v, prndist; bool flg, otherTop, otherBot, topInBlue, botInBlue, ghst; @@ -342,11 +342,11 @@ PruneHVals(void) } static void -FindBestVals(PHintVal vL) +FindBestVals(HintVal* vL) { Fixed bV, bS; Fixed t, b; - PHintVal vL2, vPrv, bstV; + HintVal *vL2, *vPrv, *bstV; for (; vL != NULL; vL = vL->vNxt) { if (vL->vBst != NULL) continue; /* already assigned */ @@ -380,10 +380,10 @@ FindBestVals(PHintVal vL) possibly other fonts as well. The old version causes bogus hinting and extra newhints. */ static void -ReplaceVals(Fixed oldB, Fixed oldT, Fixed newB, Fixed newT, PHintVal newBst, +ReplaceVals(Fixed oldB, Fixed oldT, Fixed newB, Fixed newT, HintVal* newBst, bool vert) { - PHintVal vL; + HintVal* vL; for (vL = gValList; vL != NULL; vL = vL->vNxt) { if (vL->vLoc1 != oldB || vL->vLoc2 != oldT || vL->merge) continue; @@ -405,9 +405,9 @@ ReplaceVals(Fixed oldB, Fixed oldT, Fixed newB, Fixed newT, PHintVal newBst, void MergeVals(bool vert) { - PHintVal vLst, vL; - PHintVal bstV, bV; - PHintSeg seg1, seg2, sg1, sg2; + HintVal *vLst, *vL; + HintVal *bstV, *bV; + HintSeg *seg1, *seg2, *sg1, *sg2; Fixed bot, top, b, t; Fixed val, v, spc, s; bool ghst; diff --git a/libpsautohint/src/misc.c b/libpsautohint/src/misc.c index 64004fb85..74818bbe2 100644 --- a/libpsautohint/src/misc.c +++ b/libpsautohint/src/misc.c @@ -12,7 +12,7 @@ int32_t CountSubPaths(void) { - PPathElt e = gPathStart; + PathElt* e = gPathStart; int32_t cnt = 0; while (e != NULL) { if (e->type == MOVETO) @@ -24,7 +24,7 @@ CountSubPaths(void) void RoundPathCoords(void) { - PPathElt e; + PathElt* e; e = gPathStart; while (e != NULL) { if (e->type == CURVETO) { @@ -45,7 +45,7 @@ RoundPathCoords(void) static int32_t CheckForHint(void) { - PPathElt mt, cp; + PathElt *mt, *cp; mt = gPathStart; while (mt != NULL) { if (mt->type != MOVETO) { @@ -65,7 +65,7 @@ CheckForHint(void) bool PreCheckForHinting(void) { - PPathElt e; + PathElt* e; int32_t cnt = 0; while (gPathEnd != NULL) { if (gPathEnd->type == MOVETO) @@ -79,7 +79,7 @@ PreCheckForHinting(void) e = gPathStart; while (e != NULL) { if (e->type == CLOSEPATH) { - PPathElt nxt; + PathElt* nxt; if (e == gPathEnd) break; nxt = e->next; @@ -108,8 +108,8 @@ PreCheckForHinting(void) return true; } -static PPathElt -GetSubpathNext(PPathElt e) +static PathElt* +GetSubpathNext(PathElt* e) { while (true) { e = e->next; @@ -123,8 +123,8 @@ GetSubpathNext(PPathElt e) return e; } -static PPathElt -GetSubpathPrev(PPathElt e) +static PathElt* +GetSubpathPrev(PathElt* e) { while (true) { e = e->prev; @@ -139,9 +139,9 @@ GetSubpathPrev(PPathElt e) } static bool -AddAutoFlexProp(PPathElt e, bool yflag) +AddAutoFlexProp(PathElt* e, bool yflag) { - PPathElt e0 = e, e1 = e->next; + PathElt *e0 = e, *e1 = e->next; if (e0->type != CURVETO || e1->type != CURVETO) { LogMsg(LOGERROR, NONFATALERROR, "Illegal input."); } @@ -162,7 +162,7 @@ AddAutoFlexProp(PPathElt e, bool yflag) better */ static void -TryYFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) +TryYFlex(PathElt* e, PathElt* n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) { Fixed x2, y2, x3, y3, x4, y4; double d0sq, d1sq, quot, dx, dy; @@ -193,7 +193,7 @@ TryYFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) if (gFlexStrict) { bool top, dwn; - PPathElt p, q; + PathElt *p, *q; q = GetSubpathNext(n); GetEndPoint(q, &x3, &y3); if (ProdLt0(y3 - y2, y1 - y2)) @@ -221,7 +221,7 @@ TryYFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) } static void -TryXFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) +TryXFlex(PathElt* e, PathElt* n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) { Fixed x2, y2, x3, y3, x4, y4; double d0sq, d1sq, quot, dx, dy; @@ -252,7 +252,7 @@ TryXFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) return; if (gFlexStrict) { - PPathElt p, q; + PathElt *p, *q; bool lft; q = GetSubpathNext(n); GetEndPoint(q, &x3, &y3); @@ -282,7 +282,7 @@ TryXFlex(PPathElt e, PPathElt n, Fixed x0, Fixed y0, Fixed x1, Fixed y1) void AutoAddFlex(void) { - PPathElt e, n; + PathElt *e, *n; Fixed x0, y0, x1, y1; e = gPathStart; while (e != NULL) { diff --git a/libpsautohint/src/pick.c b/libpsautohint/src/pick.c index 8c7636c18..b66401ae6 100644 --- a/libpsautohint/src/pick.c +++ b/libpsautohint/src/pick.c @@ -10,7 +10,7 @@ #include "ac.h" #include "bbox.h" -static PHintVal Vrejects, Hrejects; +static HintVal *Vrejects, *Hrejects; void InitPick(int32_t reason) @@ -25,7 +25,7 @@ InitPick(int32_t reason) #define LtPruneB(val) ((val) < FixOne && ((val) << 10) < gPruneB) static bool -ConsiderPicking(Fixed bestSpc, Fixed bestVal, PHintVal hintList, +ConsiderPicking(Fixed bestSpc, Fixed bestVal, HintVal* hintList, Fixed prevBestVal) { if (bestSpc > 0) @@ -42,14 +42,14 @@ ConsiderPicking(Fixed bestSpc, Fixed bestVal, PHintVal hintList, } void -PickVVals(PHintVal valList) +PickVVals(HintVal* valList) { - PHintVal hintList, rejectList, vlist, nxt; + HintVal *hintList, *rejectList, *vlist, *nxt; Fixed bestVal = 0, prevBestVal; hintList = rejectList = NULL; prevBestVal = 0; while (true) { - PHintVal prev, bestPrev, best; + HintVal *prev, *bestPrev, *best; Fixed lft, rght; vlist = valList; prev = bestPrev = best = NULL; @@ -130,7 +130,7 @@ InSerifBand(Fixed y0, Fixed y1, int32_t n, Fixed* p) } static bool -ConsiderValForSeg(PHintVal val, PHintSeg seg, Fixed loc, int32_t nb, Fixed* b, +ConsiderValForSeg(HintVal* val, HintSeg* seg, Fixed loc, int32_t nb, Fixed* b, int32_t ns, Fixed* s, bool primary) { if (primary && val->vSpc > 0.0) @@ -144,18 +144,18 @@ ConsiderValForSeg(PHintVal val, PHintSeg seg, Fixed loc, int32_t nb, Fixed* b, return true; } -static PHintVal -FndBstVal(PHintSeg seg, bool seg1Flg, PHintVal cList, PHintVal rList, +static HintVal* +FndBstVal(HintSeg* seg, bool seg1Flg, HintVal* cList, HintVal* rList, int32_t nb, Fixed* b, int32_t ns, Fixed* s, bool locFlg, bool hFlg) { Fixed loc, vloc; - PHintVal best, vList; - PHintSeg vseg; + HintVal *best, *vList; + HintSeg* vseg; best = NULL; loc = seg->sLoc; vList = cList; while (true) { - PHintVal initLst = vList; + HintVal* initLst = vList; while (vList != NULL) { if (seg1Flg) { vseg = vList->vSeg1; @@ -188,11 +188,11 @@ FndBstVal(PHintSeg seg, bool seg1Flg, PHintVal cList, PHintVal rList, } #define FixSixteenth (0x10) -static PHintVal -FindBestValForSeg(PHintSeg seg, bool seg1Flg, PHintVal cList, PHintVal rList, +static HintVal* +FindBestValForSeg(HintSeg* seg, bool seg1Flg, HintVal* cList, HintVal* rList, int32_t nb, Fixed* b, int32_t ns, Fixed* s, bool hFlg) { - PHintVal best, nonghst, ghst = NULL; + HintVal *best, *nonghst, *ghst = NULL; best = FndBstVal(seg, seg1Flg, cList, rList, nb, b, ns, s, false, hFlg); if (best != NULL && best->vGhst) { nonghst = @@ -218,7 +218,7 @@ FindBestValForSeg(PHintSeg seg, bool seg1Flg, PHintVal cList, PHintVal rList, } static bool -MembValList(PHintVal val, PHintVal vList) +MembValList(HintVal* val, HintVal* vList) { while (vList != NULL) { if (val == vList) @@ -228,10 +228,10 @@ MembValList(PHintVal val, PHintVal vList) return false; } -static PHintVal -PrevVal(PHintVal val, PHintVal vList) +static HintVal* +PrevVal(HintVal* val, HintVal* vList) { - PHintVal prev; + HintVal* prev; if (val == vList) return NULL; prev = vList; @@ -248,8 +248,8 @@ PrevVal(PHintVal val, PHintVal vList) } static void -FindRealVal(PHintVal vlist, Fixed top, Fixed bot, PHintSeg* pseg1, - PHintSeg* pseg2) +FindRealVal(HintVal* vlist, Fixed top, Fixed bot, HintSeg** pseg1, + HintSeg** pseg2) { while (vlist != NULL) { if (vlist->vLoc2 == top && vlist->vLoc1 == bot && !vlist->vGhst) { @@ -262,13 +262,13 @@ FindRealVal(PHintVal vlist, Fixed top, Fixed bot, PHintSeg* pseg1, } void -PickHVals(PHintVal valList) +PickHVals(HintVal* valList) { - PHintVal vlist, hintList, rejectList, bestPrev, prev, best, nxt; + HintVal *vlist, *hintList, *rejectList, *bestPrev, *prev, *best, *nxt; Fixed bestVal, prevBestVal; Fixed bot, top, vtop, vbot; - PHintVal newBst; - PHintSeg seg1, seg2; + HintVal* newBst; + HintSeg *seg1, *seg2; hintList = rejectList = NULL; prevBestVal = 0; while (true) { @@ -379,10 +379,10 @@ PickHVals(PHintVal valList) } static void -FindBestValForSegs(PHintSeg sList, bool seg1Flg, PHintVal cList, PHintVal rList, +FindBestValForSegs(HintSeg* sList, bool seg1Flg, HintVal* cList, HintVal* rList, int32_t nb, Fixed* b, int32_t ns, Fixed* s, bool hFlg) { - PHintVal best; + HintVal* best; while (sList != NULL) { best = FindBestValForSeg(sList, seg1Flg, cList, rList, nb, b, ns, s, hFlg); @@ -394,7 +394,7 @@ FindBestValForSegs(PHintSeg sList, bool seg1Flg, PHintVal cList, PHintVal rList, static void SetPruned(void) { - PHintVal vL = gValList; + HintVal* vL = gValList; while (vL != NULL) { vL->pruned = true; vL = vL->vNxt; diff --git a/libpsautohint/src/read.c b/libpsautohint/src/read.c index 0846c6d39..fbae6ef3c 100644 --- a/libpsautohint/src/read.c +++ b/libpsautohint/src/read.c @@ -24,7 +24,7 @@ static int32_t stkindex; static bool flex, startchar; static bool forMultiMaster, includeHints; /* Reading file for comparison of multiple master data and hint information. - Reads into PGlyphPathElt structure instead of PPathElt. */ + Reads into GlyphPathElt structure instead of PathElt. */ static float origEmSquare = 0.0; @@ -101,11 +101,11 @@ PopPCd(Cd* pcd) currentx += (dx); \ currenty += (dy) -static PPathElt +static PathElt* AppendElement(int32_t etype) { - PPathElt e; - e = (PPathElt)Alloc(sizeof(PathElt)); + PathElt* e; + e = (PathElt*)Alloc(sizeof(PathElt)); e->type = (int16_t)etype; if (gPathEnd != NULL) { gPathEnd->next = e; @@ -133,7 +133,7 @@ static void RDcurveto(const ACFontInfo* fontinfo, Cd c1, Cd c2, Cd c3) { if (!forMultiMaster) { - PPathElt new; + PathElt* new; new = AppendElement(CURVETO); new->x1 = ScaleAbs(fontinfo, c1.x); new->y1 = -ScaleAbs(fontinfo, c1.y); @@ -142,7 +142,7 @@ RDcurveto(const ACFontInfo* fontinfo, Cd c1, Cd c2, Cd c3) new->x3 = ScaleAbs(fontinfo, c3.x); new->y3 = -ScaleAbs(fontinfo, c3.y); } else { - PGlyphPathElt new; + GlyphPathElt* new; new = AppendGlyphPathElement(RCT); new->x = tempx; new->y = tempy; @@ -167,13 +167,13 @@ static void RDmtlt(const ACFontInfo* fontinfo, int32_t etype) { if (!forMultiMaster) { - PPathElt new; + PathElt* new; new = AppendElement(etype); new->x = ScaleAbs(fontinfo, currentx); new->y = -ScaleAbs(fontinfo, currenty); return; } else { - PGlyphPathElt new; + GlyphPathElt* new; new = AppendGlyphPathElement(etype == LINETO ? RDT : RMT); new->x = currentx; new->y = currenty; diff --git a/libpsautohint/src/report.c b/libpsautohint/src/report.c index 1c5e6ed45..b67c408b3 100644 --- a/libpsautohint/src/report.c +++ b/libpsautohint/src/report.c @@ -29,7 +29,7 @@ ReportAddFlex(void) } void -ReportLinearCurve(PPathElt e, Fixed x0, Fixed y0, Fixed x1, Fixed y1) +ReportLinearCurve(PathElt* e, Fixed x0, Fixed y0, Fixed x1, Fixed y1) { if (gAutoLinearCurveFix) { e->type = LINETO; @@ -72,7 +72,7 @@ ReportNonVError(Fixed x0, Fixed y0, Fixed x1, Fixed y1) } void -ExpectedMoveTo(PPathElt e) +ExpectedMoveTo(PathElt* e) { char* s; switch (e->type) { @@ -120,7 +120,7 @@ ReportTryFlexError(bool CPflg, Fixed x, Fixed y) } void -ReportSplit(PPathElt e) +ReportSplit(PathElt* e) { Fixed x0, y0, x1, y1; GetEndPoints(e, &x0, &y0, &x1, &y1); @@ -130,7 +130,7 @@ ReportSplit(PPathElt e) } void -AskForSplit(PPathElt e) +AskForSplit(PathElt* e) { Fixed x0, y0, x1, y1; if (e->type == MOVETO) @@ -142,7 +142,7 @@ AskForSplit(PPathElt e) } void -ReportPossibleLoop(PPathElt e) +ReportPossibleLoop(PathElt* e) { Fixed x0, y0, x1, y1; if (e->type == MOVETO) @@ -155,7 +155,7 @@ ReportPossibleLoop(PPathElt e) } void -ReportConflictCheck(PPathElt e, PPathElt conflict, PPathElt cp) +ReportConflictCheck(PathElt* e, PathElt* conflict, PathElt* cp) { Fixed ex, ey, cx, cy, cpx, cpy; GetEndPoint(e, &ex, &ey); @@ -167,7 +167,7 @@ ReportConflictCheck(PPathElt e, PPathElt conflict, PPathElt cp) } void -ReportConflictCnt(PPathElt e, int32_t cnt) +ReportConflictCnt(PathElt* e, int32_t cnt) { Fixed ex, ey; GetEndPoint(e, &ex, &ey); @@ -176,7 +176,7 @@ ReportConflictCnt(PPathElt e, int32_t cnt) } void -ReportRemFlare(PPathElt e, PPathElt e2, bool hFlg, int32_t i) +ReportRemFlare(PathElt* e, PathElt* e2, bool hFlg, int32_t i) { Fixed ex1, ey1, ex2, ey2; GetEndPoint(e, &ex1, &ey1); @@ -187,7 +187,7 @@ ReportRemFlare(PPathElt e, PPathElt e2, bool hFlg, int32_t i) } void -ReportRemConflict(PPathElt e) +ReportRemConflict(PathElt* e) { Fixed ex, ey; GetEndPoint(e, &ex, &ey); @@ -196,7 +196,7 @@ ReportRemConflict(PPathElt e) } void -ReportRotateSubpath(PPathElt e) +ReportRotateSubpath(PathElt* e) { Fixed ex, ey; GetEndPoint(e, &ex, &ey); @@ -221,7 +221,7 @@ PrintDebugVal(Fixed v) } static void -ShwHV(PHintVal val) +ShwHV(HintVal* val) { Fixed bot, top; bot = -val->vLoc1; @@ -234,10 +234,10 @@ ShwHV(PHintVal val) } void -ShowHVal(PHintVal val) +ShowHVal(HintVal* val) { Fixed l, r; - PHintSeg seg; + HintSeg* seg; ShwHV(val); seg = val->vSeg1; if (seg == NULL) @@ -252,7 +252,7 @@ ShowHVal(PHintVal val) } void -ShowHVals(PHintVal lst) +ShowHVals(HintVal* lst) { while (lst != NULL) { ShowHVal(lst); @@ -261,13 +261,13 @@ ShowHVals(PHintVal lst) } void -ReportAddHVal(PHintVal val) +ReportAddHVal(HintVal* val) { ShowHVal(val); } static void -ShwVV(PHintVal val) +ShwVV(HintVal* val) { Fixed lft, rht; lft = val->vLoc1; @@ -278,10 +278,10 @@ ShwVV(PHintVal val) } void -ShowVVal(PHintVal val) +ShowVVal(HintVal* val) { Fixed b, t; - PHintSeg seg; + HintSeg* seg; ShwVV(val); seg = val->vSeg1; if (seg == NULL) @@ -296,7 +296,7 @@ ShowVVal(PHintVal val) } void -ShowVVals(PHintVal lst) +ShowVVals(HintVal* lst) { while (lst != NULL) { ShowVVal(lst); @@ -305,13 +305,13 @@ ShowVVals(PHintVal lst) } void -ReportAddVVal(PHintVal val) +ReportAddVVal(HintVal* val) { ShowVVal(val); } void -ReportFndBstVal(PHintSeg seg, PHintVal val, bool hFlg) +ReportFndBstVal(HintSeg* seg, HintVal* val, bool hFlg) { if (hFlg) { LogMsg(LOGDEBUG, OK, "FndBstVal: sLoc %g sLft %g sRght %g ", @@ -331,7 +331,7 @@ ReportFndBstVal(PHintSeg seg, PHintVal val, bool hFlg) } void -ReportCarry(Fixed l0, Fixed l1, Fixed loc, PHintVal hints, bool vert) +ReportCarry(Fixed l0, Fixed l1, Fixed loc, HintVal* hints, bool vert) { if (vert) { ShowVVal(hints); @@ -346,7 +346,7 @@ ReportCarry(Fixed l0, Fixed l1, Fixed loc, PHintVal hints, bool vert) } void -ReportBestCP(PPathElt e, PPathElt cp) +ReportBestCP(PathElt* e, PathElt* cp) { Fixed ex, ey, px, py; GetEndPoint(e, &ex, &ey); @@ -360,7 +360,7 @@ ReportBestCP(PPathElt e, PPathElt cp) } void -LogHintInfo(PHintPoint pl) +LogHintInfo(HintPoint* pl) { char c = pl->c; if (c == 'y' || c == 'm') { /* vertical lines */ @@ -380,7 +380,7 @@ LogHintInfo(PHintPoint pl) } static void -LstHVal(PHintVal val) +LstHVal(HintVal* val) { LogMsg(LOGDEBUG, OK, "\t"); ShowHVal(val); @@ -388,7 +388,7 @@ LstHVal(PHintVal val) } static void -LstVVal(PHintVal val) +LstVVal(HintVal* val) { LogMsg(LOGDEBUG, OK, "\t"); ShowVVal(val); @@ -398,9 +398,9 @@ LstVVal(PHintVal val) void ListHintInfo(void) { /* debugging routine */ - PPathElt e; - PSegLnkLst hLst, vLst; - PHintSeg seg; + PathElt* e; + SegLnkLst *hLst, *vLst; + HintSeg* seg; Fixed x, y; e = gPathStart; while (e != NULL) { @@ -485,7 +485,7 @@ ReportMergeVVal(Fixed l0, Fixed r0, Fixed l1, Fixed r1, Fixed v0, Fixed s0, } void -ReportPruneHVal(PHintVal val, PHintVal v, int32_t i) +ReportPruneHVal(HintVal* val, HintVal* v, int32_t i) { LogMsg(LOGDEBUG, OK, "PruneHVal: %d\n\t", i); ShowHVal(val); @@ -494,7 +494,7 @@ ReportPruneHVal(PHintVal val, PHintVal v, int32_t i) } void -ReportPruneVVal(PHintVal val, PHintVal v, int32_t i) +ReportPruneVVal(HintVal* val, HintVal* v, int32_t i) { LogMsg(LOGDEBUG, OK, "PruneVVal: %d\n\t", i); ShowVVal(val); diff --git a/libpsautohint/src/shuffle.c b/libpsautohint/src/shuffle.c index 395042816..bb6d275a1 100644 --- a/libpsautohint/src/shuffle.c +++ b/libpsautohint/src/shuffle.c @@ -17,7 +17,7 @@ void InitShuffleSubpaths(void) { int32_t cnt = -1; - PPathElt e = gPathStart; + PathElt* e = gPathStart; while (e != NULL) { /* every element is marked with its subpath count */ if (e->type == MOVETO) cnt++; @@ -93,11 +93,11 @@ PrintOutLinks(unsigned char* outlinks) } void -MarkLinks(PHintVal vL, bool hFlg) +MarkLinks(HintVal* vL, bool hFlg) { int32_t i, j; - PHintSeg seg; - PPathElt e; + HintSeg* seg; + PathElt* e; if (links == NULL) return; for (; vL != NULL; vL = vL->vNxt) { @@ -133,7 +133,7 @@ Outpath(unsigned char* links, unsigned char* outlinks, unsigned char* output, { unsigned char *lnks, *outlnks; int32_t i = bst; - PPathElt e = gPathStart; + PathElt* e = gPathStart; while (e != NULL) { if (e->count == i) break; diff --git a/libpsautohint/src/write.c b/libpsautohint/src/write.c index 8a57813cb..6df28ae32 100644 --- a/libpsautohint/src/write.c +++ b/libpsautohint/src/write.c @@ -16,7 +16,7 @@ static Fixed currentx, currenty; static bool firstFlex, wrtHintInfo; static char S0[MAXBUFFLEN + 1]; -static PHintPoint bst; +static HintPoint* bst; static char bch; static Fixed bx, by; static bool bstB; @@ -179,7 +179,7 @@ safestrcat(char* s1, char* s2) } static void -NewBest(PHintPoint lst) +NewBest(HintPoint* lst) { bst = lst; bch = lst->c; @@ -220,7 +220,7 @@ WriteOne(const ACFontInfo* fontinfo, Fixed s) } static void -WritePointItem(const ACFontInfo* fontinfo, PHintPoint lst) +WritePointItem(const ACFontInfo* fontinfo, HintPoint* lst) { switch (lst->c) { case 'b': @@ -246,9 +246,9 @@ WritePointItem(const ACFontInfo* fontinfo, PHintPoint lst) } static void -WrtPntLst(const ACFontInfo* fontinfo, PHintPoint lst) +WrtPntLst(const ACFontInfo* fontinfo, HintPoint* lst) { - PHintPoint ptLst; + HintPoint* ptLst; char ch; Fixed x0, x1, y0, y1; ptLst = lst; @@ -300,7 +300,7 @@ WrtPntLst(const ACFontInfo* fontinfo, PHintPoint lst) } static void -wrtnewhints(const ACFontInfo* fontinfo, PPathElt e) +wrtnewhints(const ACFontInfo* fontinfo, PathElt* e) { if (!wrtHintInfo) { return; @@ -316,9 +316,9 @@ wrtnewhints(const ACFontInfo* fontinfo, PPathElt e) } static bool -IsFlex(PPathElt e) +IsFlex(PathElt* e) { - PPathElt e0, e1; + PathElt *e0, *e1; if (firstFlex) { e0 = e; e1 = e->next; @@ -330,7 +330,7 @@ IsFlex(PPathElt e) } static void -mt(const ACFontInfo* fontinfo, Cd c, PPathElt e) +mt(const ACFontInfo* fontinfo, Cd c, PathElt* e) { if (e->newhints != 0) { wrtnewhints(fontinfo, e); @@ -360,7 +360,7 @@ mt(const ACFontInfo* fontinfo, Cd c, PPathElt e) } static void -dt(const ACFontInfo* fontinfo, Cd c, PPathElt e) +dt(const ACFontInfo* fontinfo, Cd c, PathElt* e) { if (e->newhints != 0) { wrtnewhints(fontinfo, e); @@ -400,7 +400,7 @@ static Cd fc1, fc2, fc3; WriteString("rmt\npreflx2a\n") static void -wrtflex(Cd c1, Cd c2, Cd c3, PPathElt e) +wrtflex(Cd c1, Cd c2, Cd c3, PathElt* e) { int32_t dmin, delta; bool yflag; @@ -503,7 +503,7 @@ wrtflex(Cd c1, Cd c2, Cd c3, PPathElt e) } static void -ct(const ACFontInfo* fontinfo, Cd c1, Cd c2, Cd c3, PPathElt e) +ct(const ACFontInfo* fontinfo, Cd c1, Cd c2, Cd c3, PathElt* e) { if (e->newhints != 0) { wrtnewhints(fontinfo, e); @@ -542,7 +542,7 @@ ct(const ACFontInfo* fontinfo, Cd c1, Cd c2, Cd c3, PPathElt e) } static void -cp(const ACFontInfo* fontinfo, PPathElt e) +cp(const ACFontInfo* fontinfo, PathElt* e) { if (e->newhints != 0) { wrtnewhints(fontinfo, e); @@ -564,7 +564,7 @@ static void NumberPath(void) { int16_t cnt; - PPathElt e; + PathElt* e; e = gPathStart; cnt = 1; while (e != NULL) { @@ -576,7 +576,7 @@ NumberPath(void) void SaveFile(const ACFontInfo* fontinfo) { - PPathElt e = gPathStart; + PathElt* e = gPathStart; Cd c1, c2, c3; /* AddSolEol(); */