]> Shamusworld >> Repos - ttedit/blobdiff - src/glyphpoints.cpp
Add ability to move points with the arrow keys.
[ttedit] / src / glyphpoints.cpp
index 2e80e387e4987871dbf6c261ea608ea18b91046d..0b0575253914002506c9186279f2b0a2c37a9d1b 100755 (executable)
 }*/
 
 GlyphPoints::GlyphPoints(int nPts/*=0*/, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
-       bool * oca/*=null*/, uint16 * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
+       bool * oca/*=null*/, uint16_t * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
 //GlyphPoints::GlyphPoints(int nPts, int nPlys/*=0*/, int * xa/*=null*/, int * ya/*=null*/,
-//     bool * oca/*=null*/, uint16 * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
+//     bool * oca/*=null*/, uint16_t * pa/*=null*/): x(NULL), y(NULL), onCurve(NULL), polyEnd(NULL)
 {
        AllocateAndCopy(nPts, nPlys, xa, ya, oca, pa);
 
        if (nPlys == 0)
        {
                numPolys = 1;
-               polyEnd = new uint16[numPolys];
+               polyEnd = new uint16_t[numPolys];
                polyEnd[0] = numPoints - 1;
        }
 #ifdef DEBUG
@@ -90,7 +90,7 @@ GlyphPoints::~GlyphPoints()
 }
 
 
-void GlyphPoints::AllocateAndCopy(int nPts, int nPlys, int * xa, int * ya, bool * oca, uint16 * pa)
+void GlyphPoints::AllocateAndCopy(int nPts, int nPlys, int * xa, int * ya, bool * oca, uint16_t * pa)
 {
        numPoints = nPts, numPolys = nPlys;
 
@@ -115,7 +115,7 @@ void GlyphPoints::AllocateAndCopy(int nPts, int nPlys, int * xa, int * ya, bool
 
        if (numPolys)
        {
-               polyEnd = new uint16[numPolys];
+               polyEnd = new uint16_t[numPolys];
 
                if (pa)                                                                 // Copy poly ends in if they're passed in...
                        for(int i=0; i<nPlys; i++)
@@ -161,7 +161,7 @@ GlyphPoints GlyphPoints::operator+(const GlyphPoints &c)
        int * totX = new int[totPoints];
        int * totY = new int[totPoints];
        bool * totOnCurve = new bool[totPoints];
-       uint16 * totPolyEnd = new uint16[totPolys];
+       uint16_t * totPolyEnd = new uint16_t[totPolys];
 
        for(int i=0; i<numPoints; i++)
        {
@@ -202,7 +202,7 @@ GlyphPoints GlyphPoints::operator+(const IPoint &c)
        int * totX = new int[numPoints + 1];
        int * totY = new int[numPoints + 1];
        bool * totOnCurve = new bool[numPoints + 1];
-       uint16 * totPolyEnd = new uint16[numPolys];
+       uint16_t * totPolyEnd = new uint16_t[numPolys];
 
        for(int i=0; i<numPoints; i++)
                totX[i] = x[i], totY[i] = y[i], totOnCurve[i] = onCurve[i];
@@ -240,12 +240,12 @@ void GlyphPoints::Clear(void)
        numPoints = numPolys = pointsAllocated = polysAllocated = 0;
 
        numPolys = 1;
-       polyEnd = new uint16[numPolys];
+       polyEnd = new uint16_t[numPolys];
        polyEnd[0] = numPoints - 1;
 }
 
 
-void GlyphPoints::InsertPoint(uint16 pt, int xx, int yy, bool oc)
+void GlyphPoints::InsertPoint(uint16_t pt, int xx, int yy, bool oc)
 {
        if (pt > numPoints)                                                     // > because we can insert at end...!
                throw GP_OUT_OF_RANGE;
@@ -280,7 +280,7 @@ void GlyphPoints::InsertPoint(uint16 pt, int xx, int yy, bool oc)
 }
 
 
-void GlyphPoints::InsertPoint(uint16 pt, const IPoint &p)
+void GlyphPoints::InsertPoint(uint16_t pt, const IPoint &p)
 {
        InsertPoint(pt, p.x, p.y, p.onCurve);
 }
@@ -292,10 +292,10 @@ void GlyphPoints::InsertPoint(uint16 pt, const IPoint &p)
 // size counters down as needed. In the future, we'll keep track so we
 // don't have to reallocate *every* damn time a point is added...
 //
-void GlyphPoints::DeletePoint(uint16 pt)
+void GlyphPoints::DeletePoint(uint16_t pt)
 {
        // Adjust polygon ends appropriately
-       uint16 poly = GetPoly(pt);
+       uint16_t poly = GetPoly(pt);
 
        for(int i=poly; i<numPolys; i++)
                polyEnd[i]--;
@@ -319,18 +319,18 @@ void GlyphPoints::DeletePoint(uint16 pt)
 }
 
 
-uint16 GlyphPoints::GetNumPoints(void)
+uint16_t GlyphPoints::GetNumPoints(void)
 {
        return numPoints;
 }
 
 
-uint16 GlyphPoints::GetNumPoints(uint16 poly)
+uint16_t GlyphPoints::GetNumPoints(uint16_t poly)
 {
        if (poly >= numPolys)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetNumPoints(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetNumPoints(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -341,18 +341,18 @@ WriteLogMsg("Exception: GetNumPoints(uint16). poly=%u, numPolys=%u\xD\xA", poly,
 }
 
 
-uint16 GlyphPoints::GetNumPolys(void)
+uint16_t GlyphPoints::GetNumPolys(void)
 {
        return numPolys;
 }
 
 
-int GlyphPoints::GetX(uint16 pt)
+int GlyphPoints::GetX(uint16_t pt)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetX(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetX(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -363,12 +363,12 @@ WriteLogMsg("Exception: GetX(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints)
 }
 
 
-int GlyphPoints::GetY(uint16 pt)
+int GlyphPoints::GetY(uint16_t pt)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetY(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetY(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -379,12 +379,12 @@ WriteLogMsg("Exception: GetY(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints)
 }
 
 
-bool GlyphPoints::GetOnCurve(uint16 pt)
+bool GlyphPoints::GetOnCurve(uint16_t pt)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetOnCurve(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetOnCurve(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -395,12 +395,12 @@ WriteLogMsg("Exception: GetOnCurve(uint16). pt=%u, numPoints=%u\xD\xA", pt, numP
 }
 
 
-int GlyphPoints::GetX(uint16 poly, uint16 pt)
+int GlyphPoints::GetX(uint16_t poly, uint16_t pt)
 {
        if (pt >= GetNumPoints(poly))
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetX(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetX(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -411,18 +411,18 @@ WriteLogMsg("Exception: GetX(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\x
 }
 
 
-int GlyphPoints::GetNextX(uint16 poly, uint16 pt)
+int GlyphPoints::GetNextX(uint16_t poly, uint16_t pt)
 {
        return GetX(poly, GetNext(poly, pt));
 }
 
 
-int GlyphPoints::GetY(uint16 poly, uint16 pt)
+int GlyphPoints::GetY(uint16_t poly, uint16_t pt)
 {
        if (pt >= GetNumPoints(poly))
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetY(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetY(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -433,19 +433,19 @@ WriteLogMsg("Exception: GetY(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\x
 }
 
 
-int GlyphPoints::GetNextY(uint16 poly, uint16 pt)
+int GlyphPoints::GetNextY(uint16_t poly, uint16_t pt)
 {
        return GetY(poly, GetNext(poly, pt));
 }
 
 
-IPoint GlyphPoints::GetPoint(uint16 poly, uint16 pt)
+IPoint GlyphPoints::GetPoint(uint16_t poly, uint16_t pt)
 {
        return IPoint(GetX(poly, pt), GetY(poly, pt), GetOnCurve(poly, pt));
 }
 
 
-IPoint GlyphPoints::GetPoint(uint16 pointNumber)
+IPoint GlyphPoints::GetPoint(uint16_t pointNumber)
 {
        if (pointNumber > numPoints)
                throw GP_OUT_OF_RANGE;
@@ -454,12 +454,12 @@ IPoint GlyphPoints::GetPoint(uint16 pointNumber)
 }
 
 
-bool GlyphPoints::GetOnCurve(uint16 poly, uint16 pt)
+bool GlyphPoints::GetOnCurve(uint16_t poly, uint16_t pt)
 {
        if (pt >= GetNumPoints(poly))
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetOnCurve(uint16, uint16). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
+WriteLogMsg("Exception: GetOnCurve(uint16_t, uint16_t). poly= %u, pt=%u, numPoints=%u\xD\xA", poly, pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -470,24 +470,24 @@ WriteLogMsg("Exception: GetOnCurve(uint16, uint16). poly= %u, pt=%u, numPoints=%
 }
 
 
-bool GlyphPoints::GetPrevOnCurve(uint16 poly, uint16 pt)
+bool GlyphPoints::GetPrevOnCurve(uint16_t poly, uint16_t pt)
 {
        return GetOnCurve(poly, GetPrev(poly, pt));
 }
 
 
-bool GlyphPoints::GetNextOnCurve(uint16 poly, uint16 pt)
+bool GlyphPoints::GetNextOnCurve(uint16_t poly, uint16_t pt)
 {
        return GetOnCurve(poly, GetNext(poly, pt));
 }
 
 
-uint16 GlyphPoints::GetPolyStart(uint16 poly)
+uint16_t GlyphPoints::GetPolyStart(uint16_t poly)
 {
        if (poly >= numPolys)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -499,12 +499,12 @@ WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, n
 }
 
 
-uint16 GlyphPoints::GetPolyEnd(uint16 poly)
+uint16_t GlyphPoints::GetPolyEnd(uint16_t poly)
 {
        if (poly >= numPolys)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -525,19 +525,19 @@ void GlyphPoints::OffsetPoints(int xOff, int yOff)
 //
 // Offset only a specific polygon in the glyph
 //
-void GlyphPoints::OffsetPoly(uint16 poly, int32 xOff, int32 yOff)
+void GlyphPoints::OffsetPoly(uint16_t poly, int32_t xOff, int32_t yOff)
 {
        if (poly >= numPolys)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
 }
 #endif
 
-       uint16 polyStart = (poly == 0 ? 0 : polyEnd[poly - 1] + 1);
+       uint16_t polyStart = (poly == 0 ? 0 : polyEnd[poly - 1] + 1);
 
        for(int i=0; i<GetNumPoints(poly); i++)
                x[polyStart + i] += xOff, y[polyStart + i] += yOff;
@@ -552,12 +552,12 @@ void GlyphPoints::ScalePoints(float sc)
 }
 
 
-void GlyphPoints::SetXY(uint16 pt, int xx, int yy)
+void GlyphPoints::SetXY(uint16_t pt, int xx, int yy)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: SetXY(uint16, int, int). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: SetXY(uint16_t, int, int). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -568,12 +568,12 @@ WriteLogMsg("Exception: SetXY(uint16, int, int). pt=%u, numPoints=%u\xD\xA", pt,
 }
 
 
-void GlyphPoints::SetOnCurve(uint16 pt, bool oc)
+void GlyphPoints::SetOnCurve(uint16_t pt, bool oc)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: SetOnCurve(uint16, bool). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: SetOnCurve(uint16_t, bool). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -584,12 +584,12 @@ WriteLogMsg("Exception: SetOnCurve(uint16, bool). pt=%u, numPoints=%u\xD\xA", pt
 }
 
 
-void GlyphPoints::SetPoint(const uint16 pointNum, const IPoint point)
+void GlyphPoints::SetPoint(const uint16_t pointNum, const IPoint point)
 {
        if (pointNum >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: SetPoint(uint16, IPoint). pt=%u, numPoints=%u\xD\xA", pointNum, numPoints);
+WriteLogMsg("Exception: SetPoint(uint16_t, IPoint). pt=%u, numPoints=%u\xD\xA", pointNum, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -600,10 +600,10 @@ WriteLogMsg("Exception: SetPoint(uint16, IPoint). pt=%u, numPoints=%u\xD\xA", po
 }
 
 
-uint16 GlyphPoints::GetPrev(uint16 pt)
+uint16_t GlyphPoints::GetPrev(uint16_t pt)
 {
 // pt = 7, polyEnd = 4, 9, 15
-       uint16 min = 0, max = numPoints - 1;
+       uint16_t min = 0, max = numPoints - 1;
 
        for(int i=0; i<numPolys; i++)
        {
@@ -617,7 +617,7 @@ uint16 GlyphPoints::GetPrev(uint16 pt)
                }
        }
 
-       uint16 retVal = pt - 1;
+       uint16_t retVal = pt - 1;
 
        if (pt == min)
                retVal = max;
@@ -626,9 +626,9 @@ uint16 GlyphPoints::GetPrev(uint16 pt)
 }
 
 
-uint16 GlyphPoints::GetNext(uint16 pt)
+uint16_t GlyphPoints::GetNext(uint16_t pt)
 {
-       uint16 min = 0, max = numPoints - 1;
+       uint16_t min = 0, max = numPoints - 1;
 
        for(int i=0; i<numPolys; i++)
        {
@@ -642,7 +642,7 @@ uint16 GlyphPoints::GetNext(uint16 pt)
                }
        }
 
-       uint16 retVal = pt + 1;
+       uint16_t retVal = pt + 1;
 
        if (pt == max)
                retVal = min;
@@ -655,7 +655,7 @@ uint16 GlyphPoints::GetNext(uint16 pt)
 // Get previous point for this polygon using wraparound.
 // Note that pt is a zero-based index!
 //
-uint16 GlyphPoints::GetPrev(uint16 poly, uint16 pt)
+uint16_t GlyphPoints::GetPrev(uint16_t poly, uint16_t pt)
 {
        return (pt == 0 ? GetNumPoints(poly) - 1 : pt - 1);
 }
@@ -665,19 +665,19 @@ uint16 GlyphPoints::GetPrev(uint16 poly, uint16 pt)
 // Get next point for this polygon using wraparound.
 // Note that pt is a zero-based index!
 //
-uint16 GlyphPoints::GetNext(uint16 poly, uint16 pt)
+uint16_t GlyphPoints::GetNext(uint16_t poly, uint16_t pt)
 {
        return (pt == GetNumPoints(poly) - 1 ? 0 : pt + 1);
 }
 
 
 #warning "!!! This function returns incorrect results !!!"
-uint16 GlyphPoints::GetPoly(uint16 pt)
+uint16_t GlyphPoints::GetPoly(uint16_t pt)
 {
        if (pt >= numPoints)
 #ifdef DEBUG
 {
-WriteLogMsg("Exception: GetPoly(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
+WriteLogMsg("Exception: GetPoly(uint16_t). pt=%u, numPoints=%u\xD\xA", pt, numPoints);
 #endif
                throw GP_OUT_OF_RANGE;
 #ifdef DEBUG
@@ -688,7 +688,7 @@ WriteLogMsg("Exception: GetPoly(uint16). pt=%u, numPoints=%u\xD\xA", pt, numPoin
                if (pt <= polyEnd[i])
                        return i;
 
-       return (uint16)-1;
+       return (uint16_t)-1;
 }
 
 
@@ -697,9 +697,9 @@ void GlyphPoints::AddNewPolyAtEnd(void)
        if (numPoints == 0)                                                     // By default, we already *have* a poly
                return;
 
-       uint16 * newPolyEnd = new uint16[numPolys + 1];
+       uint16_t * newPolyEnd = new uint16_t[numPolys + 1];
 
-       for(uint16 i=0; i<numPolys; i++)
+       for(uint16_t i=0; i<numPolys; i++)
                newPolyEnd[i] = polyEnd[i];
 
        newPolyEnd[numPolys] = newPolyEnd[numPolys - 1];
@@ -709,49 +709,49 @@ void GlyphPoints::AddNewPolyAtEnd(void)
 }
 
 
-IPoint GlyphPoints::GetMidpointToPrev(uint16 poly, uint16 pt)
+IPoint GlyphPoints::GetMidpointToPrev(uint16_t poly, uint16_t pt)
 {
-       uint16 prev = GetPrev(poly, pt);
+       uint16_t prev = GetPrev(poly, pt);
 
-       int32 x1 = GetX(poly, pt), y1 = GetY(poly, pt);
-       int32 x2 = GetX(poly, prev), y2 = GetY(poly, prev);
+       int32_t x1 = GetX(poly, pt), y1 = GetY(poly, pt);
+       int32_t x2 = GetX(poly, prev), y2 = GetY(poly, prev);
 
        return IPoint((x1 + x2) / 2.0f, (y1 + y2) / 2.0f);
 }
 
 
-IPoint GlyphPoints::GetMidpointToNext(uint16 poly, uint16 pt)
+IPoint GlyphPoints::GetMidpointToNext(uint16_t poly, uint16_t pt)
 {
-       uint16 next = GetNext(poly, pt);
+       uint16_t next = GetNext(poly, pt);
 
-       int32 x1 = GetX(poly, pt), y1 = GetY(poly, pt);
-       int32 x2 = GetX(poly, next), y2 = GetY(poly, next);
+       int32_t x1 = GetX(poly, pt), y1 = GetY(poly, pt);
+       int32_t x2 = GetX(poly, next), y2 = GetY(poly, next);
 
        return IPoint((x1 + x2) / 2.0f, (y1 + y2) / 2.0f);
 }
 
 
-IPoint GlyphPoints::GetPrevPoint(uint16 poly, uint16 pt)
+IPoint GlyphPoints::GetPrevPoint(uint16_t poly, uint16_t pt)
 {
-       uint16 prevPt = GetPrev(poly, pt);
+       uint16_t prevPt = GetPrev(poly, pt);
 
        return IPoint(GetX(poly, prevPt), GetY(poly, prevPt));
 }
 
 
-IPoint GlyphPoints::GetNextPoint(uint16 poly, uint16 pt)
+IPoint GlyphPoints::GetNextPoint(uint16_t poly, uint16_t pt)
 {
-       uint16 nextPt = GetNext(poly, pt);
+       uint16_t nextPt = GetNext(poly, pt);
 
        return IPoint(GetX(poly, nextPt), GetY(poly, nextPt));
 }
 
 
-uint16 GlyphPoints::GetPolyForPoint(IPoint point)
+uint16_t GlyphPoints::GetPolyForPoint(IPoint point)
 {
-       uint16 poly = 0;
+       uint16_t poly = 0;
 
-       for(uint16 i=0; i<numPoints; i++)
+       for(uint16_t i=0; i<numPoints; i++)
        {
                if (i > polyEnd[poly])
                        poly++;
@@ -764,14 +764,14 @@ uint16 GlyphPoints::GetPolyForPoint(IPoint point)
 }
 
 
-uint16 GlyphPoints::GetPolyForPointNumber(uint16 pointNumber)
+uint16_t GlyphPoints::GetPolyForPointNumber(uint16_t pointNumber)
 {
        // If there's only one poly, we know where the point is...
        if (numPolys <= 1)
                return 0;
 
        // Otherwise, do a linear search through the polys to find the right one
-       for(uint16 i=0; i<numPolys; i++)
+       for(uint16_t i=0; i<numPolys; i++)
        {
                if (pointNumber >= GetPolyStart(i) && pointNumber <= polyEnd[i])
                        return i;
@@ -824,7 +824,7 @@ void GlyphPoints::RotatePoints(const double angle, const IPoint pt)
 }
 
 
-IPoint GlyphPoints::GetPolyCentroid(const int16 poly)
+IPoint GlyphPoints::GetPolyCentroid(const int16_t poly)
 {
        // We should throw an exception here, but meh
        // (this actually short circuits the exception handling in all the GetPolyXXX() functions)
@@ -836,7 +836,7 @@ IPoint GlyphPoints::GetPolyCentroid(const int16 poly)
 //     if (poly >= numPolys)
 //#ifdef DEBUG
 //{
-//WriteLogMsg("Exception: GetPolyEnd(uint16). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
+//WriteLogMsg("Exception: GetPolyEnd(uint16_t). poly=%u, numPolys=%u\xD\xA", poly, numPolys);
 //#endif
 //             throw GP_OUT_OF_RANGE;
 //#ifdef DEBUG
@@ -844,9 +844,9 @@ IPoint GlyphPoints::GetPolyCentroid(const int16 poly)
 //#endif
 
        IPoint centroid;                                                                // Initializes to (0, 0)
-       uint16 numPointsInPoly = GetNumPoints(poly);
+       uint16_t numPointsInPoly = GetNumPoints(poly);
 
-       for(uint16 i=GetPolyStart(poly); i<=GetPolyEnd(poly); i++)
+       for(uint16_t i=GetPolyStart(poly); i<=GetPolyEnd(poly); i++)
        {
                centroid.x += x[i];
                centroid.y += y[i];
@@ -859,14 +859,14 @@ IPoint GlyphPoints::GetPolyCentroid(const int16 poly)
 }
 
 
-void GlyphPoints::RotatePolyAroundCentroid(const int16 poly, const double angle)
+void GlyphPoints::RotatePolyAroundCentroid(const int16_t poly, const double angle)
 {
        if (poly >= numPolys)
                return;
 
        IPoint centroid = GetPolyCentroid(poly);
 
-       for(uint16 i=GetPolyStart(poly); i<=GetPolyEnd(poly); i++)
+       for(uint16_t i=GetPolyStart(poly); i<=GetPolyEnd(poly); i++)
        {
                IPoint rotated = RotatePoint(angle, IPoint(x[i], y[i]), centroid);
                x[i] = rotated.x;
@@ -875,18 +875,18 @@ void GlyphPoints::RotatePolyAroundCentroid(const int16 poly, const double angle)
 }
 
 
-void GlyphPoints::InvertPolyDrawSequence(const uint16 poly)
+void GlyphPoints::InvertPolyDrawSequence(const uint16_t poly)
 {
        if (poly >= numPolys)
                throw GP_OUT_OF_RANGE;
 
-       uint16 pointNum1 = GetPolyStart(poly);
-       uint16 pointNum2 = GetPolyEnd(poly);
+       uint16_t pointNum1 = GetPolyStart(poly);
+       uint16_t pointNum2 = GetPolyEnd(poly);
 
        // Algorithm: Step through points in the polygon, swapping 1st and last, then
        // 2nd and (last - 1), 3rd and (last - 2), etc. We only do this for half the
        // points, as doing it for all would undo the swapping we did in the 1st half.
-       for(uint16 i=0; i<GetNumPoints(poly)/2; i++)
+       for(uint16_t i=0; i<GetNumPoints(poly)/2; i++)
        {
                IPoint point1 = GetPoint(pointNum1 + i);
                IPoint point2 = GetPoint(pointNum2 - i);
@@ -917,7 +917,7 @@ bool GlyphPoints::LoadGlyphFromFile(FILE * file)
        }
 
        fscanf(file, "%s %u", line, &numPolys);
-       polyEnd = new uint16[numPolys];
+       polyEnd = new uint16_t[numPolys];
 
        for(int i=0; i<numPolys; i++)
        {