]> Shamusworld >> Repos - ttedit/commitdiff
Add ability to move points with the arrow keys.
authorShamus Hammons <jlhamm@acm.org>
Fri, 19 Feb 2016 02:27:54 +0000 (20:27 -0600)
committerShamus Hammons <jlhamm@acm.org>
Fri, 19 Feb 2016 02:27:54 +0000 (20:27 -0600)
16 files changed:
src/editwindow.cpp
src/editwindow.h
src/glyphpoints.cpp
src/glyphpoints.h
src/graphicprimitives.cpp
src/graphicprimitives.h
src/mainwindow.cpp
src/mainwindow.h
src/toolwindow.cpp
src/toolwindow.h
src/ttf.cpp
src/ttf.h
src/types.h [deleted file]
src/vector.cpp
src/vector.h
ttedit.pro

index 429943d2a7c707cfbcdc08cff1f0e894ce1319f9..9d0f5d8d803b725ca27ab5a2f051e3f39bf3ea4a 100755 (executable)
@@ -212,7 +212,7 @@ void EditWindow::paintEvent(QPaintEvent * /*event*/)
                        rotated.RotatePoints(rotationAngle, IPoint(rotationCenter.x(), rotationCenter.y()));
                else if (tool == TOOLRotatePoly)
                {
-                       uint16 poly = rotated.GetPolyForPointNumber(ptHighlight);
+                       uint16_t poly = rotated.GetPolyForPointNumber(ptHighlight);
                        rotated.RotatePolyAroundCentroid(poly, rotationAngle);
                }
 
@@ -226,6 +226,7 @@ void EditWindow::DrawGlyph(QPainter & p, GlyphPoints & glyph)
 {
        for(int poly=0; poly<glyph.GetNumPolys(); poly++)
        {
+#if 0
                if (glyph.GetNumPoints(poly) < 3)
                        continue;
 
@@ -266,11 +267,14 @@ void EditWindow::DrawGlyph(QPainter & p, GlyphPoints & glyph)
                                pt = pt2;
                        }
                }
+#else
+               DrawGlyphPoly(p, glyph, poly);
+#endif
        }
 }
 
 
-void EditWindow::DrawGlyphPoly(QPainter & p, GlyphPoints & glyph, uint16 poly)
+void EditWindow::DrawGlyphPoly(QPainter & p, GlyphPoints & glyph, uint16_t poly)
 {
        // Sanity check
        if (glyph.GetNumPoints(poly) < 3)
@@ -559,7 +563,7 @@ void EditWindow::mouseMoveEvent(QMouseEvent * event)
 
                                for(int i=0; i<pts.GetNumPoints(); i++)
                                {
-                                       int32 p1x = pts.GetX(i), p1y = pts.GetY(i),
+                                       int32_t p1x = pts.GetX(i), p1y = pts.GetY(i),
                                                p2x = pts.GetX(pts.GetNext(i)), p2y = pts.GetY(pts.GetNext(i));
 
                                        Vector ls(p2x, p2y, 0, p1x, p1y, 0), v1(pt2.x(), pt2.y(), 0, p1x, p1y, 0),
@@ -659,7 +663,7 @@ void EditWindow::mouseReleaseEvent(QMouseEvent * event)
                                pts.RotatePoints(rotationAngle, IPoint(rotationCenter.x(), rotationCenter.y()));
                        else
                        {
-                               uint16 poly = pts.GetPolyForPointNumber(ptHighlight);
+                               uint16_t poly = pts.GetPolyForPointNumber(ptHighlight);
                                pts.RotatePolyAroundCentroid(poly, rotationAngle);
                        }
 
@@ -681,10 +685,31 @@ void EditWindow::mouseReleaseEvent(QMouseEvent * event)
 
 void EditWindow::keyPressEvent(QKeyEvent * event)
 {
+       // Sanity checking...
+       if (ptHighlight == -1)
+               return;
+
+       if (event->key() == Qt::Key_Up)
+       {
+               pts.SetXY(ptHighlight, pts.GetX(ptHighlight), pts.GetY(ptHighlight) + 1);
+       }
+       else if (event->key() == Qt::Key_Down)
+               pts.SetXY(ptHighlight, pts.GetX(ptHighlight), pts.GetY(ptHighlight) - 1);
+       else if (event->key() == Qt::Key_Right)
+               pts.SetXY(ptHighlight, pts.GetX(ptHighlight) + 1, pts.GetY(ptHighlight));
+       else if (event->key() == Qt::Key_Left)
+               pts.SetXY(ptHighlight, pts.GetX(ptHighlight) - 1, pts.GetY(ptHighlight));
+       else
+               return;
+
+       event->accept();
+       update();
+       ((TTEdit *)qApp)->charWnd->MakePathFromPoints(&pts);
+       ((TTEdit *)qApp)->charWnd->update();
 }
 
 
-void EditWindow::keyReleaseEvent(QKeyEvent * event)
+void EditWindow::keyReleaseEvent(QKeyEvent * /*event*/)
 {
 }
 
index 8821da4905f6a683563ae8861131101e96b902a8..652535941fd35d21e45fdd477beed0f3f14e0d4f 100755 (executable)
@@ -9,7 +9,7 @@
 #define __EDITWINDOW_H__
 
 #include <QtWidgets>
-#include "types.h"
+#include <stdint.h>
 #include "toolwindow.h"                                                        // For ToolType enum
 #include "glyphpoints.h"
 
@@ -23,29 +23,29 @@ class EditWindow: public QWidget
                QSize sizeHint() const;
 
        protected:
-               void paintEvent(QPaintEvent * event);
-               void mousePressEvent(QMouseEvent * event);
-               void mouseMoveEvent(QMouseEvent * event);
-               void mouseReleaseEvent(QMouseEvent * event);
+               void paintEvent(QPaintEvent *);
+               void mousePressEvent(QMouseEvent *);
+               void mouseMoveEvent(QMouseEvent *);
+               void mouseReleaseEvent(QMouseEvent *);
                void keyPressEvent(QKeyEvent *);
                void keyReleaseEvent(QKeyEvent *);
 
        private:
                void CreateCursors(void);
-               QPoint GetAdjustedMousePosition(QMouseEvent * event);
+               QPoint GetAdjustedMousePosition(QMouseEvent *);
                QPoint GetAdjustedClientPosition(int x, int y);
                void DrawGlyph(QPainter & p, GlyphPoints & glyph);
-               void DrawGlyphPoly(QPainter & p, GlyphPoints & glyph, uint16 poly);
+               void DrawGlyphPoly(QPainter & p, GlyphPoints & glyph, uint16_t poly);
 
        public:
                QImage image;
                QPoint pt, ptOffset, ptPrevious;
                double scale;                                                   // Window scaling factor
-               int32 offsetX, offsetY;                                 // Window offsets
+               int32_t offsetX, offsetY;                                       // Window offsets
                ToolType tool;                                                  // Current tool
                GlyphPoints pts;                                                // Glyph point structure
-               int32 ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight;
-               int16 polyHighlight, oldPolyHighlight;
+               int32_t ptHighlight, oldPtHighlight, ptNextHighlight, oldPtNextHighlight;
+               int16_t polyHighlight, oldPolyHighlight;
                bool polyFirstPoint;
                bool showRotationCenter, haveZeroPoint;
                QPoint rotationCenter, rotationZeroPoint, rotationCurrentPoint;
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++)
        {
index 03375fa4c6e8079f260af057083fd393e6f903c1..8e8011f2b4893c9232df8186e36297a305853bd7 100755 (executable)
 #ifndef __GLYPHPOINTS_H__
 #define __GLYPHPOINTS_H__
 
-#include "types.h"
+#include <stdint.h>
 #include <stdio.h>
 
 
 // "IPoint" is an Integer based Point
 struct IPoint
 {
-       int32 x, y;
+       int32_t x, y;
        bool onCurve;
 
-       IPoint(int32 xx=0, int32 yy=0, bool oc=true): x(xx), y(yy), onCurve(oc) {}
+       IPoint(int32_t xx=0, int32_t yy=0, bool oc=true): x(xx), y(yy), onCurve(oc) {}
        bool operator==(const IPoint & p) { return (p.x == x && p.y == y ? true: false); };
 };
 
 
 struct GuideLine
 {
-       int32 x, y;
+       int32_t x, y;
        double angle;
 };
 
@@ -45,10 +45,10 @@ class GlyphPoints
 //Turns out the compiler barfs regardless...
 //Turns out the problem was that the copy ctor wasn't declared as CONST...
                GlyphPoints(int nPts = 0, int nPlys = 0, int * xa = NULL, int * ya = NULL,
-                       bool * oca = NULL, uint16 * pa = NULL);
+                       bool * oca = NULL, uint16_t * pa = NULL);
 //             GlyphPoints(void);// And now *this* is needed... Bleah!
 //             GlyphPoints(int nPts, int nPlys = 0, int * xa = NULL, int * ya = NULL,
-//                     bool * oca = NULL, uint16 * pa = NULL);
+//                     bool * oca = NULL, uint16_t * pa = NULL);
                GlyphPoints(int xx, int yy, bool oc);
 //             GlyphPoints(GlyphPoints &);                             // Copy constructor
                GlyphPoints(const GlyphPoints &);                               // Copy constructor
@@ -58,64 +58,64 @@ class GlyphPoints
                GlyphPoints operator+(const IPoint &);
                GlyphPoints& operator+=(const IPoint &);
                void Clear(void);
-               void InsertPoint(uint16, int, int, bool);
-               void InsertPoint(uint16, const IPoint &);
-               void DeletePoint(uint16);
-               uint16 GetNumPoints(void);
-               uint16 GetNumPoints(uint16 poly);
-               uint16 GetNumPolys(void);
-               int GetX(uint16);
-               int GetY(uint16);
-               bool GetOnCurve(uint16);
-               int GetX(uint16, uint16);
-               int GetNextX(uint16, uint16);
-               int GetY(uint16, uint16);
-               int GetNextY(uint16, uint16);
-               IPoint GetPoint(uint16, uint16);
-               IPoint GetPoint(uint16);
-               bool GetOnCurve(uint16, uint16);
-               bool GetPrevOnCurve(uint16, uint16);
-               bool GetNextOnCurve(uint16, uint16);
-               uint16 GetPolyStart(uint16);
-               uint16 GetPolyEnd(uint16);
+               void InsertPoint(uint16_t, int, int, bool);
+               void InsertPoint(uint16_t, const IPoint &);
+               void DeletePoint(uint16_t);
+               uint16_t GetNumPoints(void);
+               uint16_t GetNumPoints(uint16_t poly);
+               uint16_t GetNumPolys(void);
+               int GetX(uint16_t);
+               int GetY(uint16_t);
+               bool GetOnCurve(uint16_t);
+               int GetX(uint16_t, uint16_t);
+               int GetNextX(uint16_t, uint16_t);
+               int GetY(uint16_t, uint16_t);
+               int GetNextY(uint16_t, uint16_t);
+               IPoint GetPoint(uint16_t, uint16_t);
+               IPoint GetPoint(uint16_t);
+               bool GetOnCurve(uint16_t, uint16_t);
+               bool GetPrevOnCurve(uint16_t, uint16_t);
+               bool GetNextOnCurve(uint16_t, uint16_t);
+               uint16_t GetPolyStart(uint16_t);
+               uint16_t GetPolyEnd(uint16_t);
                void OffsetPoints(int, int);
-               void OffsetPoly(uint16, int32, int32);
+               void OffsetPoly(uint16_t, int32_t, int32_t);
                void ScalePoints(float);
-               void SetXY(uint16, int, int);
-               void SetOnCurve(uint16, bool);
-               void SetPoint(const uint16 pointNum, const IPoint point);
-               uint16 GetPrev(uint16);
-               uint16 GetNext(uint16);
-               uint16 GetPrev(uint16, uint16);
-               uint16 GetNext(uint16, uint16);
-               uint16 GetPoly(uint16);
+               void SetXY(uint16_t, int, int);
+               void SetOnCurve(uint16_t, bool);
+               void SetPoint(const uint16_t pointNum, const IPoint point);
+               uint16_t GetPrev(uint16_t);
+               uint16_t GetNext(uint16_t);
+               uint16_t GetPrev(uint16_t, uint16_t);
+               uint16_t GetNext(uint16_t, uint16_t);
+               uint16_t GetPoly(uint16_t);
                void AddNewPolyAtEnd(void);
-               IPoint GetMidpointToPrev(uint16, uint16);
-               IPoint GetMidpointToNext(uint16, uint16);
-               IPoint GetPrevPoint(uint16, uint16);
-               IPoint GetNextPoint(uint16, uint16);
-               uint16 GetPolyForPoint(IPoint point);
-               uint16 GetPolyForPointNumber(uint16 pointNumber);
+               IPoint GetMidpointToPrev(uint16_t, uint16_t);
+               IPoint GetMidpointToNext(uint16_t, uint16_t);
+               IPoint GetPrevPoint(uint16_t, uint16_t);
+               IPoint GetNextPoint(uint16_t, uint16_t);
+               uint16_t GetPolyForPoint(IPoint point);
+               uint16_t GetPolyForPointNumber(uint16_t pointNumber);
 
                IPoint RotatePoint(const double angle, const IPoint point, const IPoint center);
                void RotatePoints(const double angle, const IPoint point);
-               IPoint GetPolyCentroid(const int16 poly);
-               void RotatePolyAroundCentroid(const int16 poly, const double angle);
-               void InvertPolyDrawSequence(const uint16 poly);
+               IPoint GetPolyCentroid(const int16_t poly);
+               void RotatePolyAroundCentroid(const int16_t poly, const double angle);
+               void InvertPolyDrawSequence(const uint16_t poly);
 
                bool LoadGlyphFromFile(FILE *);
                bool SaveGlyphToFile(FILE *);
 
        private:
-               void AllocateAndCopy(int, int, int *, int *, bool *, uint16 *);
+               void AllocateAndCopy(int, int, int *, int *, bool *, uint16_t *);
                void FreeAllocatedMemory(void);
 
        private:
                int numPoints, numPolys;
                int * x, * y;
                bool * onCurve;
-               uint16 * polyEnd;
-               uint16 pointsAllocated, polysAllocated;
+               uint16_t * polyEnd;
+               uint16_t pointsAllocated, polysAllocated;
 };
 
 #endif // __GLYPHPOINTS_H__
index dd9b480e54650eca6ce7553d3326276da7de3511..9dec2150b448b7568aeb3c3795703083b2e93fd6 100755 (executable)
@@ -63,7 +63,7 @@ void Bezier(QPainter &p, IPoint p1, IPoint p2, IPoint p3)
 //
 // Draw a round dot (5x5, centered on [x, y])
 //
-void DrawRoundDot(QPainter &p, int32 x, int32 y)
+void DrawRoundDot(QPainter &p, int32_t x, int32_t y)
 {
        QPoint pt[8];
 
@@ -83,7 +83,7 @@ void DrawRoundDot(QPainter &p, int32 x, int32 y)
 //
 // Draw a sqaure dot (5x5, centered on [x, y])
 //
-void DrawSquareDot(QPainter &p, int32 x, int32 y)
+void DrawSquareDot(QPainter &p, int32_t x, int32_t y)
 {
        QPoint pt[4];
 
@@ -99,10 +99,10 @@ void DrawSquareDot(QPainter &p, int32 x, int32 y)
 //
 // Draw a sqaure dot (nxn, centered on [x, y])
 //
-void DrawSquareDotN(QPainter &p, int32 x, int32 y, uint32 n)
+void DrawSquareDotN(QPainter &p, int32_t x, int32_t y, uint32_t n)
 {
        QPoint pt[4];
-       uint32 offset = (n - 1) / 2;
+       uint32_t offset = (n - 1) / 2;
 
        pt[0] = QPoint(x - offset, y - offset);
        pt[1] = QPoint(x + offset, y - offset);
@@ -116,7 +116,7 @@ void DrawSquareDotN(QPainter &p, int32 x, int32 y, uint32 n)
 //
 // Draw a round dot (nxn, centered on [x, y])
 //
-void DrawRoundDotN(QPainter &p, int32 x, int32 y, uint32 n)
+void DrawRoundDotN(QPainter &p, int32_t x, int32_t y, uint32_t n)
 {
        int radius = (n / 2) + 1;
        p.drawEllipse(x - radius, y - radius, n, n);
index 9b2de448b8deac80c20e3645993c99e03793c015..6d5b27ba98d4d970c9206e26b9334d27e064e0a8 100755 (executable)
@@ -8,8 +8,8 @@
 #ifndef __GRAPHICPRIMITIVES_H__
 #define __GRAPHICPRIMITIVES_H__
 
+#include <stdint.h>
 #include <QtGui>                                                               // For QPainter
-#include "types.h"                                                             // For int32
 #include "glyphpoints.h"                                               // For IPoint
 
 struct point
@@ -21,9 +21,9 @@ struct point
 
 void Bezier(QPainter &, point, point, point);
 void Bezier(QPainter &, IPoint, IPoint, IPoint);
-void DrawRoundDot(QPainter &, int32, int32);
-void DrawSquareDot(QPainter &, int32, int32);
-void DrawRoundDotN(QPainter &, int32, int32, uint32);
-void DrawSquareDotN(QPainter &, int32, int32, uint32);
+void DrawRoundDot(QPainter &, int32_t, int32_t);
+void DrawSquareDot(QPainter &, int32_t, int32_t);
+void DrawRoundDotN(QPainter &, int32_t, int32_t, uint32_t);
+void DrawSquareDotN(QPainter &, int32_t, int32_t, uint32_t);
 
 #endif // __GRAPHICPRIMITIVES_H__
index 25b63d11af9d534907a81fc3a3787cd660aeeb08..dea9087af7bf9496ed81a93fd60475091567f55e 100644 (file)
@@ -45,6 +45,7 @@ MainWindow::MainWindow()
        ((TTEdit *)qApp)->charWnd = new CharWindow(this);
        editWnd = new EditWindow(this);
        setCentralWidget(editWnd);
+       editWnd->setFocus();
        setWindowIcon(QIcon(":/res/ttedit.png"));
        setWindowTitle("TTEdit!");
 
index 80df508ce42d6ebc96fdfe522cc56c216f5a7e0e..7038b1ed8d52b0f639ebd24eac75b14dcd559464 100644 (file)
@@ -73,3 +73,4 @@ class MainWindow: public QMainWindow
 };
 
 #endif // __MAINWINDOW_H__
+
index 5fd774c1498430542df30b7ec84403e2afaf2041..13d3754d6429e1e7a039d5b1ec68422bd53dd11f 100755 (executable)
@@ -23,7 +23,6 @@
 #define DEBUGTP                                // Toolpalette debugging...
 
 #include "toolwindow.h"
-#include "types.h"
 
 
 ToolWindow::ToolWindow(void): QWidget(NULL, Qt::Window | Qt::FramelessWindowHint),
@@ -72,7 +71,7 @@ ToolType ToolWindow::FindSelectedTool(void)
 //printf("pt = %u, %u\n", pt.x(), pt.y());
 
        // Divide mouse coords by the bitmap stamp size to find which one is pointed to
-       uint32 x = (uint32)pt.x() / sizeStamp.x(), y = (uint32)pt.y() / sizeStamp.y();
+       uint32_t x = (uint32_t)pt.x() / sizeStamp.x(), y = (uint32_t)pt.y() / sizeStamp.y();
 
        // Preset failure into newTool, in case no new tool is selected
        ToolType newTool = TOOLNone;
index 1077d673843d5f3e555efc7a7978a0bba8e15c88..47125c26ce397952b2f3784476d8446e90507b16 100755 (executable)
@@ -48,3 +48,4 @@ class ToolWindow: public QWidget
 };
 
 #endif // __TOOLWINDOW_H__
+
index ce312a8d6dfc2ddd70265dfc0f9265f4a13028ae..799f0321ffc288aad01c42836e19b991d961d0c7 100755 (executable)
@@ -20,7 +20,7 @@
 // - Eliminate ALL references to BYTE, WORD, SBYTE, SWORD, etc.
 //
 
-#include <stdio.h>                                                             // For file handling, etc.                                                                                              //
+#include <stdio.h>                                                             // For file handling, etc.
 #include <stdlib.h>
 #include <string.h>
 #include "charnames.h"
@@ -35,7 +35,7 @@
 #define NUMTABS  24                   // Number of distinct tables
 
 
-/*void fskip(HANDLE file, uint32 bytesToSkip)
+/*void fskip(HANDLE file, uint32_t bytesToSkip)
 {
        SetFilePointer(file, (LONG)bytesToSkip, NULL, FILE_CURRENT);
 }*/
@@ -43,9 +43,9 @@
 //
 // Get a BYTE from the current file...
 //
-uint8 ReadByte(FILE * file)
+uint8_t ReadByte(FILE * file)
 {
-       return (uint8)fgetc(file);
+       return (uint8_t)fgetc(file);
 }
 
 // The following routines get and put WORDs and DWORDs in little endian
@@ -55,10 +55,10 @@ uint8 ReadByte(FILE * file)
 //
 // Get a WORD from the current file...
 //
-uint16 ReadWord(FILE * file)
+uint16_t ReadWord(FILE * file)
 {
-       uint16 word = (uint16)fgetc(file) << 8;
-       word |= (uint16)fgetc(file);
+       uint16_t word = (uint16_t)fgetc(file) << 8;
+       word |= (uint16_t)fgetc(file);
 
        return word;
 }
@@ -66,14 +66,14 @@ uint16 ReadWord(FILE * file)
 //
 // Get a double WORD from the current file...
 //
-uint32 ReadDWord(FILE * file)
+uint32_t ReadDWord(FILE * file)
 {
-       uint32 dword = 0;
+       uint32_t dword = 0;
 
        for(int i=0; i<4; i++)
        {
                dword <<= 8;
-               dword |= (uint8)fgetc(file);
+               dword |= (uint8_t)fgetc(file);
        }
 
        return dword;
@@ -82,7 +82,7 @@ uint32 ReadDWord(FILE * file)
 //
 // Write a WORD to the current file...
 //
-void WriteWord(FILE * file, uint16 word)
+void WriteWord(FILE * file, uint16_t word)
 {
        fputc(word >> 8, file);                                         // Hi byte
        fputc(word & 0xFF, file);                                       // Lo byte
@@ -91,7 +91,7 @@ void WriteWord(FILE * file, uint16 word)
 //
 // Write a double WORD to the current file...
 //
-void WriteDWord(FILE * file, uint32 dword)
+void WriteDWord(FILE * file, uint32_t dword)
 {
        for(int i=0; i<4; i++)
        {
@@ -107,7 +107,7 @@ void WriteDWord(FILE * file, uint32 dword)
 //
 // Return a BYTE from a BYTE based table
 //
-uint8 GetByte(uint8 * table, uint32 &ptr)
+uint8_t GetByte(uint8_t * table, uint32_t &ptr)
 {
        return table[ptr++];
 }
@@ -115,25 +115,25 @@ uint8 GetByte(uint8 * table, uint32 &ptr)
 //
 // Return a WORD from a BYTE based table
 //
-uint16 GetWord(uint8 * table, uint32 &ptr)
+uint16_t GetWord(uint8_t * table, uint32_t &ptr)
 {
-       uint16 hi = table[ptr++];
-       uint16 lo = table[ptr++];
+       uint16_t hi = table[ptr++];
+       uint16_t lo = table[ptr++];
 
-       return (uint16)((hi<<8) | lo);
+       return (uint16_t)((hi<<8) | lo);
 }
 
 //
 // Return a double WORD from a BYTE based table
 //
-uint32 GetDWord(uint8 * table, uint32 &ptr)
+uint32_t GetDWord(uint8_t * table, uint32_t &ptr)
 {
-       uint32 hi1 = table[ptr++];
-       uint32 lo1 = table[ptr++];
-       uint32 hi2 = table[ptr++];
-       uint32 lo2 = table[ptr++];
+       uint32_t hi1 = table[ptr++];
+       uint32_t lo1 = table[ptr++];
+       uint32_t hi2 = table[ptr++];
+       uint32_t lo2 = table[ptr++];
 
-       return (uint32)((hi1 << 24) | (lo1 << 16) | (hi2 << 8) | lo2);
+       return (uint32_t)((hi1 << 24) | (lo1 << 16) | (hi2 << 8) | lo2);
 }
 
 /////////////////////////////////////////////////////////////////////////////
@@ -143,7 +143,7 @@ uint32 GetDWord(uint8 * table, uint32 &ptr)
 //
 // Store a BYTE in a BYTE based table
 //
-void SetByte(uint8 * table, uint32 &ptr, uint8 data)
+void SetByte(uint8_t * table, uint32_t &ptr, uint8_t data)
 {
        table[ptr++] = data;
 }
@@ -151,7 +151,7 @@ void SetByte(uint8 * table, uint32 &ptr, uint8 data)
 //
 // Store a WORD in a BYTE based table
 //
-void SetWord(uint8 * table, uint32 &ptr, uint16 data)
+void SetWord(uint8_t * table, uint32_t &ptr, uint16_t data)
 {
        table[ptr++] = data>>8;  table[ptr++] = data&0xFF;
 }
@@ -159,16 +159,16 @@ void SetWord(uint8 * table, uint32 &ptr, uint16 data)
 //
 // Store a DWORD in a BYTE based table
 //
-void SetDWord(uint8 * table, uint32 &ptr, uint32 data)
+void SetDWord(uint8_t * table, uint32_t &ptr, uint32_t data)
 {
-       table[ptr++] = (uint8)(data >> 24); table[ptr++] = (uint8)(data >> 16);
-       table[ptr++] = (uint8)(data >> 8);  table[ptr++] = (uint8)(data & 0xFF);
+       table[ptr++] = (uint8_t)(data >> 24); table[ptr++] = (uint8_t)(data >> 16);
+       table[ptr++] = (uint8_t)(data >> 8);  table[ptr++] = (uint8_t)(data & 0xFF);
 }
 
 /////////////////////////////////////////////////////////////////////////////
 // Fixed point to float (& vice versa) conversions
 /////////////////////////////////////////////////////////////////////////////
-float FixedToFloat(int16 fixed)
+float FixedToFloat(int16_t fixed)
 {
        return (float)fixed / 16384.0f;
 }
@@ -201,10 +201,10 @@ TTF::TTF(void)
        larray[18] = &maxp_len; larray[19] = &name_len; larray[20] = &post_len;
        larray[21] = &prep_len; larray[22] = &vhea_len; larray[23] = &vmtx_len;
 
-       for(uint32 i=0; i<NUMTABS; i++)
+       for(uint32_t i=0; i<NUMTABS; i++)
                *parray[i] = NULL;                                              // Init pointers...
 
-       for(uint32 i=0; i<MAXGLYPHS; i++)
+       for(uint32_t i=0; i<MAXGLYPHS; i++)
                glyph[i] = NULL;
 }
 
@@ -232,7 +232,7 @@ void TTF::Init(void)
 /////////////////////////////////////////////////////////////////////////////
 void TTF::ClearTables(void)
 {
-       for(uint32 i=0; i<NUMTABS; i++)
+       for(uint32_t i=0; i<NUMTABS; i++)
        {
                if ((*parray[i]) != NULL)
                {
@@ -242,7 +242,7 @@ void TTF::ClearTables(void)
                }
        }  
 
-       for(uint32 i=0; i<MAXGLYPHS; i++)
+       for(uint32_t i=0; i<MAXGLYPHS; i++)
        {
                if (glyph[i] != NULL)
                {
@@ -262,7 +262,7 @@ bool TTF::Load(const char * filename)
 {
 //     unsigned char ch;                                                       // Temp variable
 //     UINT num_tabs;                                                          // Number of tables
-       uint32 offset[NUMTABS], length[NUMTABS];        // Temporary storage...
+       uint32_t offset[NUMTABS], length[NUMTABS];      // Temporary storage...
        char names[NUMTABS][5];
        char narray[NUMTABS][5] = { "EBDT", "EBLC", "EBSC", "LTSH", "OS/2", "PCLT",
                "VDMX", "cmap", "cvt ", "fpgm", "gasp", "glyf", "hdmx", "head", "hhea",
@@ -292,7 +292,7 @@ WriteLogMsg("File was NOT a TTF file!\n");
 }
 #endif
 
-       uint32 num_tabs = ReadWord(file);                       // Get # of tables
+       uint32_t num_tabs = ReadWord(file);                     // Get # of tables
 #ifdef TTFDEBUG
 WriteLogMsg("Number of tables is %u...\n", num_tabs);
 #endif
@@ -302,7 +302,7 @@ WriteLogMsg("Number of tables is %u...\n", num_tabs);
 #ifdef TTFDEBUG
 WriteLogMsg("Reading names of tables...\n");
 #endif
-       for(uint32 i=0; i<num_tabs; i++)
+       for(uint32_t i=0; i<num_tabs; i++)
        {
 //             ReadFile(file, names[i], 4, &bytesRead, NULL);
                fread(names[i], 1, 4, file);
@@ -316,14 +316,14 @@ WriteLogMsg("Reading names of tables...\n");
 #ifdef TTFDEBUG
 WriteLogMsg("Reading tables...\n");
 #endif
-       for(uint32 i=0; i<num_tabs; i++)
+       for(uint32_t i=0; i<num_tabs; i++)
        {
-               for(uint32 j=0; j<NUMTABS; j++)
+               for(uint32_t j=0; j<NUMTABS; j++)
                {
                        if ((strcmp(names[i], narray[j])) == 0) // Found a match...
                        {
-//                             *parray[j] = (uint8 *)GlobalAlloc(GMEM_FIXED, length[i]);       // Allocate space
-                               *parray[j] = (uint8 *)malloc(length[i]); // Alloc space
+//                             *parray[j] = (uint8_t *)GlobalAlloc(GMEM_FIXED, length[i]);     // Allocate space
+                               *parray[j] = (uint8_t *)malloc(length[i]); // Alloc space
 
                                if (*parray[j] == NULL)
                                        return false;                           // Bail out if nothing allocated
@@ -358,7 +358,7 @@ bool TTF::Save(const char * filename)
 {
 //  fstream file;
 //     ULONG offset = 12;
-       uint32 numtabs = 0;
+       uint32_t numtabs = 0;
        char padding[3] = { 0, 0, 0 };
        // Convert this to a table of ULONGs to decrease complexity...
 //wouldn't be endian safe then...
@@ -371,11 +371,11 @@ bool TTF::Save(const char * filename)
 
        BuildTables();                                                          // Ignore return value...  
 
-       for(uint32 i=0; i<NUMTABS; i++)                         // Figure out how many tables there are
+       for(uint32_t i=0; i<NUMTABS; i++)                               // Figure out how many tables there are
                if ((*parray[i]) != NULL)
                        numtabs++;
 
-       uint32 offset = 12 + (numtabs * 16);            // Calc correct offset to start of data
+       uint32_t offset = 12 + (numtabs * 16);          // Calc correct offset to start of data
 
 //     HANDLE file = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
 //             NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
@@ -387,7 +387,7 @@ bool TTF::Save(const char * filename)
        WriteWord(file, 0);                                                     // entrySelector Log2(max power of 2 <= numTables).
        WriteWord(file, 0);                                                     // NumTables x 16 - searchRange.
 
-       for(uint32 i=0; i<NUMTABS; i++)                                 // Write out table directory...
+       for(uint32_t i=0; i<NUMTABS; i++)                                       // Write out table directory...
        {
                if ((*parray[i]) != NULL)
                {
@@ -400,20 +400,20 @@ bool TTF::Save(const char * filename)
                        WriteDWord(file, offset);                       // Offset
                        WriteDWord(file, (*larray[i]));         // Length
 
-                       offset += (((*larray[i]) + 3) & ~3);    // Pad out to 4-uint8 boundary...
+                       offset += (((*larray[i]) + 3) & ~3);    // Pad out to 4-uint8_t boundary...
                }
        }
 
-       for(uint32 i=0; i<NUMTABS; i++)                                 // Write out the tables...
+       for(uint32_t i=0; i<NUMTABS; i++)                                       // Write out the tables...
        {
                if ((*parray[i]) != NULL)
                {
-//                     for(uint32 j=0; j<(*larray[i]); j++)
+//                     for(uint32_t j=0; j<(*larray[i]); j++)
 //                             file.put((*parray[i])[j]);
 //                     WriteFile(file, *parray[i], *larray[i], &bytesWritten, NULL);
                        fwrite(*parray[i], 1, *larray[i], file);
 
-                       uint32 remainder = ((*larray[i]) & 0x3);
+                       uint32_t remainder = ((*larray[i]) & 0x3);
                        if (remainder)               // i.e., it's not evenly div by 4
 //                             for(j=remainder; j<4; j++)
 //                                     file.put((char)0);       // pad it!
@@ -432,18 +432,18 @@ bool TTF::Save(const char * filename)
 //
 // This function encodes the glyph data and stores it to the 'glyf' table.
 /////////////////////////////////////////////////////////////////////////////
-bool TTF::EncodeGlyph(uint16 glyphnum)
+bool TTF::EncodeGlyph(uint16_t glyphnum)
 {
        bool retval = false;                                            // Assume failure
-       uint8 flag, xbuf[4000], ybuf[4000], fbuf[2000];
-       uint32 xp = 0, yp = 0, fp = 0;                          // Table pointers
+       uint8_t flag, xbuf[4000], ybuf[4000], fbuf[2000];
+       uint32_t xp = 0, yp = 0, fp = 0;                                // Table pointers
 
        if (glyphnum < myMaxp.numGlyphs)  // numofgls is 1 based ind, glyph# 0 based
        {
                // need to add composite encoding...
                int lastx = 0, lasty = 0;
 
-               for(uint32 i=0; i<numberOfPoints; i++)
+               for(uint32_t i=0; i<numberOfPoints; i++)
                {
                        flag = 0;
                        int curx = gx[i] - lastx, cury = gy[i] - lasty;
@@ -453,7 +453,7 @@ bool TTF::EncodeGlyph(uint16 glyphnum)
 
                        if (curx)
                        {
-                               if ((curx > 255) || (curx < -255)) // I.e., it's 2 uint8 value
+                               if ((curx > 255) || (curx < -255)) // I.e., it's 2 uint8_t value
                                        SetWord(xbuf, xp, curx);
                                else
                                {
@@ -473,7 +473,7 @@ bool TTF::EncodeGlyph(uint16 glyphnum)
   
                        if (cury)
                        {
-                               if ((cury > 255) || (cury < -255)) // I.e., it's 2 uint8 value
+                               if ((cury > 255) || (cury < -255)) // I.e., it's 2 uint8_t value
                                        SetWord(ybuf, yp, cury);
                                else
                                {
@@ -502,7 +502,7 @@ bool TTF::EncodeGlyph(uint16 glyphnum)
     {
       if (fbuf[i] == fbuf[i+1])  // 
       {
-        uint8 count = 0;  // Sentinel takes care of check for end of flags...
+        uint8_t count = 0;  // Sentinel takes care of check for end of flags...
         while (fbuf[i] == fbuf[++i])  count++; // Count number of repeats
         i--;
         fbuf[fp++] = fbuf[i] | 0x08; // Set repeat flag
@@ -514,35 +514,35 @@ bool TTF::EncodeGlyph(uint16 glyphnum)
                fp = numberOfPoints;
                // Find length of glyph and reallocate space if necessary
 
-               uint32 newLength = 12 + numberOfPolys*2 + numberOfHints + fp + xp + yp;
+               uint32_t newLength = 12 + numberOfPolys*2 + numberOfHints + fp + xp + yp;
 
                if (newLength & 0x03)
                        newLength += (4 - newLength & 0x03);
 
                if (glyphLen[glyphnum] != newLength)
                {
-                       glyph[glyphnum] = (uint8 *)realloc(glyph[glyphnum], newLength);
+                       glyph[glyphnum] = (uint8_t *)realloc(glyph[glyphnum], newLength);
                        glyphLen[glyphnum] = newLength;
                }
 
                // And finally, store it!
 
-               uint32 gp = 0;                                                  // Glyph pointer...
+               uint32_t gp = 0;                                                        // Glyph pointer...
                SetWord(glyph[glyphnum], gp, numberOfPolys);
                SetWord(glyph[glyphnum], gp, llx);
                SetWord(glyph[glyphnum], gp, lly);
                SetWord(glyph[glyphnum], gp, urx);
                SetWord(glyph[glyphnum], gp, ury);
-               for(uint32 i=0; i<numberOfPolys; i++)
+               for(uint32_t i=0; i<numberOfPolys; i++)
                        SetWord(glyph[glyphnum], gp, poly[i]);
                SetWord(glyph[glyphnum], gp, numberOfHints);
-               for(uint32 i=0; i<numberOfHints; i++)
+               for(uint32_t i=0; i<numberOfHints; i++)
                        SetByte(glyph[glyphnum], gp, hint[i]);
-               for(uint32 i=0; i<fp; i++)
+               for(uint32_t i=0; i<fp; i++)
                        SetByte(glyph[glyphnum], gp, fbuf[i]);
-               for(uint32 i=0; i<xp; i++)
+               for(uint32_t i=0; i<xp; i++)
                        SetByte(glyph[glyphnum], gp, xbuf[i]);
-               for(uint32 i=0; i<yp; i++)
+               for(uint32_t i=0; i<yp; i++)
                        SetByte(glyph[glyphnum], gp, ybuf[i]);
 
                retval = true;                                                  // Successfully encoded!
@@ -557,10 +557,10 @@ bool TTF::EncodeGlyph(uint16 glyphnum)
 // This function decodes the glyph data and stores it to the object's
 // internal array.
 /////////////////////////////////////////////////////////////////////////////
-bool TTF::DecodeGlyph(uint16 glyphnum)
+bool TTF::DecodeGlyph(uint16_t glyphnum)
 {
        bool retval = false;
-       uint32 i, dp;
+       uint32_t i, dp;
 
        // glyphnum is 0 based index, while numGlyphs is 1 based
        if (glyphnum >= myMaxp.numGlyphs)
@@ -578,10 +578,10 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
        isCompositeGlyph = false;   // Default is no
        numberOfPolys = GetWord(glyph[glyphnum], dp);  // # of polygons
 
-       llx = (int16)GetWord(glyph[glyphnum], dp);           // Lower left X
-       lly = (int16)GetWord(glyph[glyphnum], dp);           // Lower left Y
-       urx = (int16)GetWord(glyph[glyphnum], dp);           // Upper right X
-       ury = (int16)GetWord(glyph[glyphnum], dp);           // Upper right Y
+       llx = (int16_t)GetWord(glyph[glyphnum], dp);           // Lower left X
+       lly = (int16_t)GetWord(glyph[glyphnum], dp);           // Lower left Y
+       urx = (int16_t)GetWord(glyph[glyphnum], dp);           // Upper right X
+       ury = (int16_t)GetWord(glyph[glyphnum], dp);           // Upper right Y
 
        // Need to handle composite glyphs better here.  The ways things
        // are set now is a recipe for disaster...
@@ -600,19 +600,19 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
                {
                        cmpst.flags = GetWord(glyph[glyphnum], dp);
                        cmpst.glyphIndex = GetWord(glyph[glyphnum], dp);
-                       cmpst.arg1 = (cmpst.flags & 0x01 ? (int16)GetWord(glyph[glyphnum], dp) : (int8)GetByte(glyph[glyphnum], dp));
-                       cmpst.arg2 = (cmpst.flags & 0x01 ? (int16)GetWord(glyph[glyphnum], dp) : (int8)GetByte(glyph[glyphnum], dp));
+                       cmpst.arg1 = (cmpst.flags & 0x01 ? (int16_t)GetWord(glyph[glyphnum], dp) : (int8_t)GetByte(glyph[glyphnum], dp));
+                       cmpst.arg2 = (cmpst.flags & 0x01 ? (int16_t)GetWord(glyph[glyphnum], dp) : (int8_t)GetByte(glyph[glyphnum], dp));
 
                        if (cmpst.flags & 0x08)
-                               cmpst.xScale = cmpst.yScale = FixedToFloat((int16)GetWord(glyph[glyphnum], dp));
+                               cmpst.xScale = cmpst.yScale = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp));
                        else if (cmpst.flags & 0x40)
-                               cmpst.xScale = FixedToFloat((int16)GetWord(glyph[glyphnum], dp)),
-                               cmpst.yScale = FixedToFloat((int16)GetWord(glyph[glyphnum], dp));
+                               cmpst.xScale = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp)),
+                               cmpst.yScale = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp));
                        else if (cmpst.flags & 0x80)
-                               cmpst.xScale = FixedToFloat((int16)GetWord(glyph[glyphnum], dp)),
-                               cmpst.scale01 = FixedToFloat((int16)GetWord(glyph[glyphnum], dp)),
-                               cmpst.scale10 = FixedToFloat((int16)GetWord(glyph[glyphnum], dp)),
-                               cmpst.yScale = FixedToFloat((int16)GetWord(glyph[glyphnum], dp));
+                               cmpst.xScale = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp)),
+                               cmpst.scale01 = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp)),
+                               cmpst.scale10 = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp)),
+                               cmpst.yScale = FixedToFloat((int16_t)GetWord(glyph[glyphnum], dp));
 
                        compositeList.AddAtRear(cmpst);
                }
@@ -624,9 +624,9 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
 //do {
 //     USHORT flags;
 //     USHORT glyphIndex;
-//     if ( flags & ARG_1_AND_2_ARE_uint16S) {
-//     (SHORT or Fuint16) argument1;
-//     (SHORT or Fuint16) argument2;
+//     if ( flags & ARG_1_AND_2_ARE_uint16_tS) {
+//     (SHORT or Fuint16_t) argument1;
+//     (SHORT or Fuint16_t) argument2;
 //     } else {
 //             USHORT arg1and2; /* (arg1 << 8) | arg2 */
 //     }
@@ -644,11 +644,11 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
 //} while ( flags & MORE_COMPONENTS ) 
 //if (flags & WE_HAVE_INSTR){
 //     USHORT numInstr
-//     uint8 instr[numInstr]
+//     uint8_t instr[numInstr]
 //
 //Flags                    Bit     Description 
-//ARG_1_AND_2_ARE_uint16S    0       If this is set, the arguments are uint16s;
-//                                 otherwise, they are uint8s.
+//ARG_1_AND_2_ARE_uint16_tS    0       If this is set, the arguments are uint16_ts;
+//                                 otherwise, they are uint8_ts.
 //ARGS_ARE_XY_VALUES       1       If this is set, the arguments are xy values;
 //                                 otherwise, they are points.
 //ROUND_XY_TO_GRID         2       For the xy values if the preceding is true.
@@ -678,20 +678,20 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
 
        // Decode the dots...
 
-       uint32 num_pts = poly[numberOfPolys-1] + 1;
+       uint32_t num_pts = poly[numberOfPolys-1] + 1;
        numberOfPoints = num_pts; // necessary??
-       uint32 xptr, yptr;        // pointers to beginning of coord data
-       uint32 numXs = 0;
+       uint32_t xptr, yptr;        // pointers to beginning of coord data
+       uint32_t numXs = 0;
        int xx = 0, yy = 0, repeat;
-       uint32 numTokens = num_pts, k, numRep;
+       uint32_t numTokens = num_pts, k, numRep;
 
        // We make an educated guess that num_pts = num_tokens; but if there
        // is repeated data in the tokens, then we need to adjust the # of
        // tokens down appropriately.
 
-       for(uint32 i=0; i<numTokens; i++)
+       for(uint32_t i=0; i<numTokens; i++)
        {
-               uint8 token = glyph[glyphnum][dp+i];  uint32 rpts = 1;
+               uint8_t token = glyph[glyphnum][dp+i];  uint32_t rpts = 1;
 
                if (token & 0x08)      // Repeated token?
                {
@@ -706,7 +706,7 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
                        numTokens -= (numRep - 1); // Yes, adjust.
                }
 
-               // 10 = same x(0uint8s), 00 = 2uint8s, 02&12 = 1uint8
+               // 10 = same x(0uint8_ts), 00 = 2uint8_ts, 02&12 = 1uint8_t
                if ((token & 0x02) == 0x02)
                        numXs += rpts;
 
@@ -721,9 +721,9 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
 
        k = 0;                               // Index to the point array
 
-       for(uint32 i=0; i<numTokens; i++)
+       for(uint32_t i=0; i<numTokens; i++)
        {
-               uint8 token = glyph[glyphnum][dp+i];
+               uint8_t token = glyph[glyphnum][dp+i];
                repeat = 1;
 
                if (token & 0x08)
@@ -741,7 +741,7 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
                                xx -= GetByte(glyph[glyphnum], xptr);
 
                        if ((token & 0x12) == 0x00)
-                               xx += (int16)GetWord(glyph[glyphnum], xptr);
+                               xx += (int16_t)GetWord(glyph[glyphnum], xptr);
 
                        gx[k] = xx;                      // Store x-coordinate
 
@@ -752,7 +752,7 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
                                yy -= GetByte(glyph[glyphnum], yptr);
 
                        if ((token & 0x24) == 0x00)
-                               yy += (int16)GetWord(glyph[glyphnum], yptr);
+                               yy += (int16_t)GetWord(glyph[glyphnum], yptr);
 
                        gy[k] = yy;                      // Store y-coordinate
 
@@ -774,7 +774,7 @@ bool TTF::DecodeGlyph(uint16 glyphnum)
  This function decodes the 'glyf' data for a non-composite (atomic) glyph and
  returns it as a GlyphPoints object. Helper function.
  *****************************************************************************/
-GlyphPoints TTF::GetGlyphPoints(uint16 glyphNum)
+GlyphPoints TTF::GetGlyphPoints(uint16_t glyphNum)
 {
        if (DecodeGlyph(glyphNum))
                return GlyphPoints(numberOfPoints, numberOfPolys, gx, gy, onCurve, poly);
@@ -788,7 +788,7 @@ GlyphPoints TTF::GetGlyphPoints(uint16 glyphNum)
  This function decodes the 'glyf' data for a composite glyph and returns
  it as a GlyphPoints object.
  *****************************************************************************/
-GlyphPoints TTF::GetAllCompositePoints(uint16 glyphNum)
+GlyphPoints TTF::GetAllCompositePoints(uint16_t glyphNum)
 {
 //  int tmpGlyph = currentGlyph;
   
@@ -835,11 +835,11 @@ GlyphPoints TTF::GetAllCompositePoints(uint16 glyphNum)
 }
 
 /////////////////////////////////////////////////////////////////////////////
-// Member function: void GetCharName(int cNum, uint8 * buf)
+// Member function: void GetCharName(int cNum, uint8_t * buf)
 //
 // This function returns the character name of the glyph number passed in.
 /////////////////////////////////////////////////////////////////////////////
-void TTF::GetCharName(int cNum, uint8 * buf)
+void TTF::GetCharName(int cNum, uint8_t * buf)
 {
        buf[0] = 0;                                                                     // Set failure as default condition
   
@@ -849,10 +849,10 @@ void TTF::GetCharName(int cNum, uint8 * buf)
        if (post[1] != 0x02 || post[2] != 0x00)         // i.e., it's NOT a V2.0 table
                return;
 
-       uint8 * pTab = NULL;
-       uint32 tabOff = 34, numGlyphs = (uint32)((post[32] << 8) | post[33]);
-       uint32 index = (uint32)((post[tabOff + cNum * 2] << 8) | post[tabOff + cNum * 2 + 1]);
-       uint32 nInd2;
+       uint8_t * pTab = NULL;
+       uint32_t tabOff = 34, numGlyphs = (uint32_t)((post[32] << 8) | post[33]);
+       uint32_t index = (uint32_t)((post[tabOff + cNum * 2] << 8) | post[tabOff + cNum * 2 + 1]);
+       uint32_t nInd2;
 
        if (index > 257)
        {
@@ -866,13 +866,13 @@ void TTF::GetCharName(int cNum, uint8 * buf)
                pTab = macStdNames;
        }
 
-       for(uint32 i=0; i<index; i++)
-               nInd2 = nInd2 + pTab[nInd2] + 1; // 1st uint8 is length of string + that uint8
+       for(uint32_t i=0; i<index; i++)
+               nInd2 = nInd2 + pTab[nInd2] + 1; // 1st uint8_t is length of string + that uint8_t
 
-       uint8 len = pTab[nInd2];
+       uint8_t len = pTab[nInd2];
        nInd2++;
 
-       for(uint8 i=0; i<len; i++)
+       for(uint8_t i=0; i<len; i++)
                buf[i] = pTab[nInd2 + i];
 
        buf[len] = 0;
@@ -894,7 +894,7 @@ WriteLogMsg("Bad HEAD header: Expected 54, found %u...\n", head_len);
                return false;                                                   // Corrupt data?
        }
 
-       uint32 tp = 0;
+       uint32_t tp = 0;
        myHead.version            = GetDWord(head, tp);
        myHead.fontRevision       = GetDWord(head, tp);
        myHead.checkSumAdjustment = GetDWord(head, tp);
@@ -911,9 +911,9 @@ WriteLogMsg("Bad HEAD header: Expected 54, found %u...\n", head_len);
        myHead.yMax               = GetWord(head, tp);
        myHead.macStyle           = GetWord(head, tp);
        myHead.lowestRecPPEM      = GetWord(head, tp);
-       myHead.fontDirectionHint  = (int16)GetWord(head, tp);
-       myHead.indexToLocFormat   = (int16)GetWord(head, tp);
-       myHead.glyphDataFormat    = (int16)GetWord(head, tp);
+       myHead.fontDirectionHint  = (int16_t)GetWord(head, tp);
+       myHead.indexToLocFormat   = (int16_t)GetWord(head, tp);
+       myHead.glyphDataFormat    = (int16_t)GetWord(head, tp);
 
        if (maxp_len != 32)
        {
@@ -941,17 +941,17 @@ WriteLogMsg("Bad MAXP header: Expected 32, found %u...\n", maxp_len);
        myMaxp.maxComponentDepth     = GetWord(maxp, tp);
 
        tp = 0;                                                                         // Reset table pointer
-       uint32 start = (myHead.indexToLocFormat ? GetDWord(loca, tp) : GetWord(loca, tp) << 1);
+       uint32_t start = (myHead.indexToLocFormat ? GetDWord(loca, tp) : GetWord(loca, tp) << 1);
 
-       for(uint32 i=0; i<myMaxp.numGlyphs; i++)
+       for(uint32_t i=0; i<myMaxp.numGlyphs; i++)
        {
-               uint32 end = (myHead.indexToLocFormat ? GetDWord(loca, tp) : GetWord(loca, tp) << 1);
-               uint32 length = end - start;
+               uint32_t end = (myHead.indexToLocFormat ? GetDWord(loca, tp) : GetWord(loca, tp) << 1);
+               uint32_t length = end - start;
                glyphLen[i] = length;                                   // Lengths are saved 'cause malloc is sloppy
 
                if (length)     // loca+start? pointer arithmetic?
                {
-                       glyph[i] = (uint8 *)malloc(length);     // Allocate space,
+                       glyph[i] = (uint8_t *)malloc(length);   // Allocate space,
                        memcpy(glyph[i], glyf+start, length);   // and move it!
                }
                else
@@ -971,9 +971,9 @@ WriteLogMsg("Bad MAXP header: Expected 32, found %u...\n", maxp_len);
 /////////////////////////////////////////////////////////////////////////////
 bool TTF::BuildTables(void)
 {
-       uint32 i, tp, start;
+       uint32_t i, tp, start;
 
-       myHead.indexToLocFormat = 1;                            // We don't bother with [uint16s*2] format...
+       myHead.indexToLocFormat = 1;                            // We don't bother with [uint16_ts*2] format...
 
        // Build HEAD table
 
@@ -994,9 +994,9 @@ bool TTF::BuildTables(void)
        SetWord(head, tp, myHead.yMax);//               = GetWord(head, tp);
        SetWord(head, tp, myHead.macStyle);//           = GetWord(head, tp);
        SetWord(head, tp, myHead.lowestRecPPEM);//      = GetWord(head, tp);
-       SetWord(head, tp, myHead.fontDirectionHint);//  = (int16)GetWord(head, tp);
-       SetWord(head, tp, myHead.indexToLocFormat);//   = (int16)GetWord(head, tp);
-       SetWord(head, tp, myHead.glyphDataFormat);//    = (int16)GetWord(head, tp);
+       SetWord(head, tp, myHead.fontDirectionHint);//  = (int16_t)GetWord(head, tp);
+       SetWord(head, tp, myHead.indexToLocFormat);//   = (int16_t)GetWord(head, tp);
+       SetWord(head, tp, myHead.glyphDataFormat);//    = (int16_t)GetWord(head, tp);
 
        // Build MAXP table
 
@@ -1024,7 +1024,7 @@ bool TTF::BuildTables(void)
        if (loca)
                free(loca);                                                             // And create/reallocate it...
 
-       loca = (uint8 *) malloc(loca_len);
+       loca = (uint8_t *) malloc(loca_len);
 
        glyf_len = 0;                                                           // Refigure glyf table length
 
@@ -1034,7 +1034,7 @@ bool TTF::BuildTables(void)
        if (glyf)
                free(glyf);
 
-       glyf = (uint8 *) malloc(glyf_len);
+       glyf = (uint8_t *) malloc(glyf_len);
 
        start = tp = 0;                                                         // Reset table pointer
 
@@ -1060,7 +1060,7 @@ bool TTF::BuildTables(void)
 // internal array.  If the flag isDirty is set, it also encodes the internal
 // array and stores it to the 'glyf' table.
 /////////////////////////////////////////////////////////////////////////////
-bool TTF::SetGlyph(uint16 glyphnum)
+bool TTF::SetGlyph(uint16_t glyphnum)
 {
        bool retval = false;                                            // Set failure as default
 
@@ -1086,7 +1086,7 @@ bool TTF::SetGlyph(uint16 glyphnum)
 // is greater than the number of glyphs, glyph is added at end of list. This
 // glyph then becomes the current glyph.
 /////////////////////////////////////////////////////////////////////////////
-bool TTF::AddGlyph(uint16 glyphnum)
+bool TTF::AddGlyph(uint16_t glyphnum)
 {
        // incomplete: JLH
        bool retval = false;
@@ -1105,7 +1105,7 @@ bool TTF::AddGlyph(uint16 glyphnum)
 // This function deletes the glyph at position glyphnum.  All glyphs after
 // this glyph are moved down in position.
 /////////////////////////////////////////////////////////////////////////////
-bool TTF::DeleteGlyph(uint16 glyphnum)
+bool TTF::DeleteGlyph(uint16_t glyphnum)
 {
        // incomplete: JLH
        bool retval = false;
@@ -1124,7 +1124,7 @@ Box TTF::GetBoundingBox(void)
        return Box(llx, lly, urx, ury);
 }
 
-GlyphPt TTF::GetPoint(uint16 pointno)
+GlyphPt TTF::GetPoint(uint16_t pointno)
 {
        GlyphPt p;
 
@@ -1135,12 +1135,12 @@ GlyphPt TTF::GetPoint(uint16 pointno)
        return p;
 }
 
-uint16 TTF::GetNumberOfPolys(void)
+uint16_t TTF::GetNumberOfPolys(void)
 {
        return numberOfPolys;
 }
 
-uint16 TTF::GetPolyEnd(uint16 polynum)
+uint16_t TTF::GetPolyEnd(uint16_t polynum)
 {
        if (polynum >= numberOfPolys)
                return 0;
@@ -1148,7 +1148,7 @@ uint16 TTF::GetPolyEnd(uint16 polynum)
        return poly[polynum];
 }
 
-int TTF::GetPointX(uint16 pointno)
+int TTF::GetPointX(uint16_t pointno)
 {
        if (pointno >= MAXPOINTS)
                return 0;
@@ -1156,7 +1156,7 @@ int TTF::GetPointX(uint16 pointno)
        return gx[pointno];
 }
 
-int TTF::GetPointY(uint16 pointno)
+int TTF::GetPointY(uint16_t pointno)
 {
        if (pointno >= MAXPOINTS)
                return 0;
@@ -1164,7 +1164,7 @@ int TTF::GetPointY(uint16 pointno)
        return gy[pointno];
 }
 
-bool TTF::GetOnCurve(uint16 pointno)
+bool TTF::GetOnCurve(uint16_t pointno)
 {
        if (pointno >= MAXPOINTS)
                return true;
@@ -1172,7 +1172,7 @@ bool TTF::GetOnCurve(uint16 pointno)
        return onCurve[pointno];
 }
 
-bool TTF::SetOnCurve(uint16 pointno, bool state)
+bool TTF::SetOnCurve(uint16_t pointno, bool state)
 {
        if (pointno >= numberOfPoints)
                return false;
@@ -1183,7 +1183,7 @@ bool TTF::SetOnCurve(uint16 pointno, bool state)
        return true;
 }
 
-bool TTF::MovePoint(uint16 pointno, int x, int y)
+bool TTF::MovePoint(uint16_t pointno, int x, int y)
 {
        if (pointno >= numberOfPoints)
                return false;
@@ -1194,7 +1194,7 @@ bool TTF::MovePoint(uint16 pointno, int x, int y)
        return true;
 }
 
-bool TTF::MovePoint(uint16 pointno, GlyphPt p)
+bool TTF::MovePoint(uint16_t pointno, GlyphPt p)
 {
        if (pointno >= numberOfPoints)
                return false;
index 2ea45be926f220cc29ced99bd2c378f38cc02189..49a3869a3de1725d9a6660167dbbf6db2cc8c347 100755 (executable)
--- a/src/ttf.h
+++ b/src/ttf.h
@@ -8,35 +8,28 @@
 // TTF database.
 //
 
-// These really shouldn't be included here, but are for now...
-//#include <string.h>
-////#include <afxwin.h>  // This is needed only for things like BOOL, etc.
-//#include <fstream.h>
-//#include <stdlib.h>
-//#include <malloc.h>  // Both for malloc, free, _msize, realloc
-
 #ifndef __TTF_H__
 #define __TTF_H__
 
+#include <stdint.h>
 #include "list.h"
-#include "types.h"
 #include "glyphpoints.h"
 
 #define MAXGLYPHS 4096                 // Number of glyphs in object
 #define MAXPOINTS 2000                 // Number of points in a glyph
-#define MAXHINTS  2000                 // Number of hint uint8s in glyph
+#define MAXHINTS  2000                 // Number of hint uint8_ts in glyph
 
 //
 // "head" struct
 //
 struct Head
 {
-       uint32 version;                         // Fixed - Table version number (0x00010000 for version 1.0.)
-       uint32 fontRevision;            // Fixed - fontRevision (Set by font manufacturer.)
-       uint32 checkSumAdjustment;      // To compute: Set it to 0, sum the entire font
+       uint32_t version;                               // Fixed - Table version number (0x00010000 for version 1.0.)
+       uint32_t fontRevision;          // Fixed - fontRevision (Set by font manufacturer.)
+       uint32_t checkSumAdjustment;    // To compute: Set it to 0, sum the entire font
                                                                // as ULONG, then store 0xB1B0AFBA - sum.
-       uint32 magicNumber;                     // Set to 0x5F0F3CF5.
-       uint16 flags;                           /* Bit 0 - baseline for font at y=0;
+       uint32_t magicNumber;                   // Set to 0x5F0F3CF5.
+       uint16_t flags;                         /* Bit 0 - baseline for font at y=0;
                                                                   Bit 1 - left sidebearing at x=0;
                                                                   Bit 2 - instructions may depend on point     size;
                                                                   Bit 3 - force ppem to integer values for all
@@ -45,23 +38,23 @@ struct Head
                                                                   Bit 4 - instructions may alter advance width
                                                                                        (the advance widths might not scale linearly);
                                                                   Note: All other bits must be zero.*/
-       uint16 unitsPerEm;                      // Valid range is from 16 to 16384
-       uint32 /*longDateTime*/ createdh, createdl;             // International date (8-uint8 field).
-       uint32 /*longDateTime*/ modifiedh, modifiedl;   // International date (8-uint8 field).
-       uint16 xMin;                            // For all glyph bounding boxes.
-       uint16 yMin;                            // For all glyph bounding boxes.
-       uint16 xMax;                            // For all glyph bounding boxes.
-       uint16 yMax;                            // For all glyph bounding boxes.
-       uint16 macStyle;                        /* Bit 0 bold (if set to 1); Bit 1 italic (if set to 1)
+       uint16_t unitsPerEm;                    // Valid range is from 16 to 16384
+       uint32_t /*longDateTime*/ createdh, createdl;           // International date (8-uint8_t field).
+       uint32_t /*longDateTime*/ modifiedh, modifiedl; // International date (8-uint8_t field).
+       uint16_t xMin;                          // For all glyph bounding boxes.
+       uint16_t yMin;                          // For all glyph bounding boxes.
+       uint16_t xMax;                          // For all glyph bounding boxes.
+       uint16_t yMax;                          // For all glyph bounding boxes.
+       uint16_t macStyle;                      /* Bit 0 bold (if set to 1); Bit 1 italic (if set to 1)
                                                                   Bits 2-15 reserved (set to 0).*/
-       uint16 lowestRecPPEM;           // Smallest readable size in pixels.
-       int16  fontDirectionHint;       /* 0   Fully mixed directional glyphs;
+       uint16_t lowestRecPPEM;         // Smallest readable size in pixels.
+       int16_t  fontDirectionHint;     /* 0   Fully mixed directional glyphs;
                                                                   1   Only strongly left to right;
                                                                   2   Like 1 but also contains neutrals;
                                                                  -1   Only strongly right to left;
                                                                  -2   Like -1 but also contains neutrals.*/
-       int16  indexToLocFormat;        // 0 for short offsets, 1 for long.
-       int16  glyphDataFormat;         // 0 for current format.
+       int16_t  indexToLocFormat;      // 0 for short offsets, 1 for long.
+       int16_t  glyphDataFormat;               // 0 for current format.
 };
 
 //
@@ -69,24 +62,24 @@ struct Head
 //
 struct Maxp
 {
-       uint32 version;                                 // Table version number 0x00010000 for version 1.0. 
-       uint16 numGlyphs;                               // The number of glyphs in the font. 
-       uint16 maxPoints;                               // Maximum points in a non-composite glyph. 
-       uint16 maxContours;                             // Maximum contours in a non-composite glyph. 
-       uint16 maxCompositePoints;              // Maximum points in a composite glyph. 
-       uint16 maxCompositeContours;    // Maximum contours in a composite glyph. 
-       uint16 maxZones;                                // 1 if instructions do not use the twilight
+       uint32_t version;                                       // Table version number 0x00010000 for version 1.0. 
+       uint16_t numGlyphs;                             // The number of glyphs in the font. 
+       uint16_t maxPoints;                             // Maximum points in a non-composite glyph. 
+       uint16_t maxContours;                           // Maximum contours in a non-composite glyph. 
+       uint16_t maxCompositePoints;            // Maximum points in a composite glyph. 
+       uint16_t maxCompositeContours;  // Maximum contours in a composite glyph. 
+       uint16_t maxZones;                              // 1 if instructions do not use the twilight
                                                                        // zone (Z0), or 2 if instructions do use Z0;
                                                                        // should be set to 2 in most cases. 
-       uint16 maxTwilightPoints;               // Maximum points used in Z0. 
-       uint16 maxStorage;                              // Number of Storage Area locations.  
-       uint16 maxFunctionDefs;                 // Number of FDEFs. 
-       uint16 maxInstructionDefs;              // Number of IDEFs. 
-       uint16 maxStackElements;                // Maximum stack depth. 
-       uint16 maxSizeOfInstructions;   // Maximum uint8 count for glyph instructions. 
-       uint16 maxComponentElements;    // Maximum number of components referenced at
+       uint16_t maxTwilightPoints;             // Maximum points used in Z0. 
+       uint16_t maxStorage;                            // Number of Storage Area locations.  
+       uint16_t maxFunctionDefs;                       // Number of FDEFs. 
+       uint16_t maxInstructionDefs;            // Number of IDEFs. 
+       uint16_t maxStackElements;              // Maximum stack depth. 
+       uint16_t maxSizeOfInstructions; // Maximum uint8_t count for glyph instructions. 
+       uint16_t maxComponentElements;  // Maximum number of components referenced at
                                                                        // "top level" for any composite glyph. 
-       uint16 maxComponentDepth;               // Maximum levels of recursion; 1 for simple components.
+       uint16_t maxComponentDepth;             // Maximum levels of recursion; 1 for simple components.
 };
 
 //
@@ -102,10 +95,10 @@ particular encoding, and the offset to the actual subtable:
 Type   Description     
 USHORT Platform ID.    
 USHORT Platform-specific encoding ID.  
-ULONG  uint8 offset from beginning of table to the subtable for this encoding. 
+ULONG  uint8_t offset from beginning of table to the subtable for this encoding.       
 
 USHORT  format          Format number is set to 4.  
-USHORT  length          Length in uint8s.  
+USHORT  length          Length in uint8_ts.  
 USHORT version Version number (starts at 0).   
 USHORT segCountX2      2 x segCount.   
 USHORT searchRange     2 x (2**floor(log2(segCount)))  
@@ -141,17 +134,17 @@ struct GlyphPt
 
 struct Box
 {
-       int16 llx, lly, urx, ury;
+       int16_t llx, lly, urx, ury;
 
        // Default constructor
-       Box(int16 lx = 0, int16 ly = 0, int16 rx = 0, int16 ry = 0):
+       Box(int16_t lx = 0, int16_t ly = 0, int16_t rx = 0, int16_t ry = 0):
                llx(lx), lly(ly), urx(rx), ury(ry) {}
 };
 
 struct NameRec
 {
-       uint16 platformID, platformSpecID, languageID, nameID, length;
-       uint8 * str;
+       uint16_t platformID, platformSpecID, languageID, nameID, length;
+       uint8_t * str;
 
        NameRec(): str(NULL) {}
 
@@ -179,17 +172,17 @@ struct NameRec
                languageID     = c.languageID;
                nameID         = c.nameID;
                length         = c.length;
-//Fix this             str            = (uint8 *)strdup((char *)c.str);
+//Fix this             str            = (uint8_t *)strdup((char *)c.str);
        }
 };
 
 struct Composite
 {
-       uint16 flags, glyphIndex;
-       int16 arg1, arg2;
+       uint16_t flags, glyphIndex;
+       int16_t arg1, arg2;
        float xScale, yScale, scale01, scale10;
 
-       Composite(uint16 fl = 0, uint16 gl = 0, int16 a1 = 0, int16 a2 = 0,
+       Composite(uint16_t fl = 0, uint16_t gl = 0, int16_t a1 = 0, int16_t a2 = 0,
                float xs = 1.0f, float ys = 1.0f, float s01 = 1.0f, float s10 = 1.0f):
                flags(fl), glyphIndex(gl), arg1(a1), arg2(a2), xScale(xs), yScale(ys),
                scale01(s01), scale10(s10) {}
@@ -229,8 +222,8 @@ struct Composite
 class TTF
 {
        private:
-               bool EncodeGlyph(uint16);
-               bool DecodeGlyph(uint16);
+               bool EncodeGlyph(uint16_t);
+               bool DecodeGlyph(uint16_t);
                bool ExtractTables(void);
                bool BuildTables(void);
 
@@ -241,54 +234,54 @@ class TTF
                bool Load(const char *);                                // Load font database
                bool Save(const char *);                                // Save font database
                void ClearTables(void);                                 // Deallocate memory...
-               bool SetGlyph(uint16 glyphnum);                 // Set internal pointer/encode/decode
-               bool AddGlyph(uint16 glyphnum);
-               bool DeleteGlyph(uint16 glyphnum);
+               bool SetGlyph(uint16_t glyphnum);                       // Set internal pointer/encode/decode
+               bool AddGlyph(uint16_t glyphnum);
+               bool DeleteGlyph(uint16_t glyphnum);
                Box GetBoundingBox(void);
-               GlyphPt GetPoint(uint16 pointno);
-               uint16 GetNumberOfPolys(void);
-               uint16 GetPolyEnd(uint16 polynum);
-               int GetPointX(uint16 pointno);
-               int GetPointY(uint16 pointno);
-               bool GetOnCurve(uint16 pointno);
-               bool SetOnCurve(uint16 pointno, bool state);
-               bool MovePoint(uint16 pointno, int x, int y);
-               bool MovePoint(uint16 pointno, GlyphPt p);
-               bool AddPoint(uint16 pointno, int x, int y, bool state);
-               bool DeletePoint(uint16 pointno);
+               GlyphPt GetPoint(uint16_t pointno);
+               uint16_t GetNumberOfPolys(void);
+               uint16_t GetPolyEnd(uint16_t polynum);
+               int GetPointX(uint16_t pointno);
+               int GetPointY(uint16_t pointno);
+               bool GetOnCurve(uint16_t pointno);
+               bool SetOnCurve(uint16_t pointno, bool state);
+               bool MovePoint(uint16_t pointno, int x, int y);
+               bool MovePoint(uint16_t pointno, GlyphPt p);
+               bool AddPoint(uint16_t pointno, int x, int y, bool state);
+               bool DeletePoint(uint16_t pointno);
                bool IsCompositeGlyph(void);
-               GlyphPoints GetGlyphPoints(uint16);
-               GlyphPoints GetAllCompositePoints(uint16);
-               void GetCharName(int, uint8 *);
+               GlyphPoints GetGlyphPoints(uint16_t);
+               GlyphPoints GetAllCompositePoints(uint16_t);
+               void GetCharName(int, uint8_t *);
 
        private:
                bool isDirty;                                                   // Has glyph been modified?
                bool isCompositeGlyph;                                  // Is it a composite? (need structs to store composite info...)
-               uint16 currentGlyph;                                    // The glyph currently decoded
-               uint16 numberOfPoints;
+               uint16_t currentGlyph;                                  // The glyph currently decoded
+               uint16_t numberOfPoints;
                int gx[MAXPOINTS];                                              // Internal point arrays...
                int gy[MAXPOINTS];                                              // These could be dynamically allocated in the
                bool onCurve[MAXPOINTS];                                // constructor, with default values being set
-               uint16 numberOfHints;
-               uint8 hint[MAXHINTS];                                   // Hints storage
-               uint16 numberOfPolys;                                   // Number of polygons in glyph
-               uint16 poly[200];                                               // End points of polygons
-               int16 llx, lly, urx, ury;                               // Lower left/Upper right X/Y
+               uint16_t numberOfHints;
+               uint8_t hint[MAXHINTS];                                 // Hints storage
+               uint16_t numberOfPolys;                                 // Number of polygons in glyph
+               uint16_t poly[200];                                             // End points of polygons
+               int16_t llx, lly, urx, ury;                             // Lower left/Upper right X/Y
 //     public://remove after debugging...
-               uint8 * glyph[MAXGLYPHS];                               // Placeholders for glyphs
-               uint32 glyphLen[MAXGLYPHS];                             // Glyph lengths are stored since malloc() is sloppy
+               uint8_t * glyph[MAXGLYPHS];                             // Placeholders for glyphs
+               uint32_t glyphLen[MAXGLYPHS];                           // Glyph lengths are stored since malloc() is sloppy
                Maxp myMaxp;                                                    // Internal placeholders for this shiat
                Head myHead;
 //     public: //private: later...
                List<Composite> compositeList;                  // Composite glyph list
-               uint8 * EBDT, * EBLC, * EBSC, * LTSH, * OS_2, * PCLT, * VDMX, * cmap, * cvt,  * fpgm,
+               uint8_t * EBDT, * EBLC, * EBSC, * LTSH, * OS_2, * PCLT, * VDMX, * cmap, * cvt,  * fpgm,
                        * gasp, * glyf, * hdmx, * head, * hhea, * hmtx, * kern, * loca, * maxp, * name,
                        * post, * prep, * vhea, * vmtx;
-               uint32 EBDT_len, EBLC_len, EBSC_len, LTSH_len, OS_2_len, PCLT_len, VDMX_len, cmap_len,
+               uint32_t EBDT_len, EBLC_len, EBSC_len, LTSH_len, OS_2_len, PCLT_len, VDMX_len, cmap_len,
                        cvt_len,  fpgm_len, gasp_len, glyf_len, hdmx_len, head_len, hhea_len, hmtx_len,
                        kern_len, loca_len, maxp_len, name_len, post_len, prep_len, vhea_len, vmtx_len;
-               uint8 * * parray[24];                                   // Pointer array
-               uint32 * larray[24];                                    // Length array
+               uint8_t * * parray[24];                                 // Pointer array
+               uint32_t * larray[24];                                  // Length array
                bool loaded;                                                    // Font loaded/init'ed?
 };
 
diff --git a/src/types.h b/src/types.h
deleted file mode 100755 (executable)
index 0fc13b5..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-//
-// Basic types for platform independent code
-//
-
-#ifndef __TYPES_H__
-#define __TYPES_H__
-
-// This should be portable, since it's part of the C99 standard...!
-
-#include <stdint.h>
-
-typedef uint8_t                uint8;
-typedef int8_t         int8;
-typedef uint16_t       uint16;
-typedef int16_t                int16;
-typedef uint32_t       uint32;
-typedef int32_t                int32;
-typedef uint64_t       uint64;
-typedef int64_t                int64;
-
-/*#ifndef _WINDOWS_
-#define NULL   0
-// This is for non-compliant compilers that don't follow proper scoping rules (and suck). ;-)
-#define for if(false);else for
-#endif*/
-#ifndef NULL
-#define NULL    0
-#endif
-
-#endif // __TYPES_H__
index 1f4c29cc5ae5b69eedd639efaa5fa0a6bc56883c..1ba2064ee925fd510bd7bc0ed6d878664f344e98 100755 (executable)
@@ -323,14 +323,14 @@ Vector& Vector::operator-=(double const v)
 // Check for equality
 bool Vector::operator==(Vector const v)
 {
-       return (x == v.x && y == v.y && z == v.z ? true : false);
+       return ((x == v.x) && (y == v.y) && (z == v.z) ? true : false);
 }
 
 
 // Check for inequality
 bool Vector::operator!=(Vector const v)
 {
-       return (x != v.x || y != v.y || z != v.z ? true : false);
+       return ((x != v.x) || (y != v.y) || (z != v.z) ? true : false);
 }
 
 
@@ -348,7 +348,7 @@ Vector Vector::Unit(void)
 
 double Vector::Magnitude(void)
 {
-       return sqrt(x * x + y * y + z * z);
+       return sqrt((x * x) + (y * y) + (z * z));
 }
 
 
@@ -365,17 +365,26 @@ double Vector::Angle(void)
 
 
 //
-// Angle between these two vectors
+// Returns the smallest angle between these two vectors
 //
 double Vector::Angle(Vector v)
 {
+// seems that something relies on this bad behavior... :-P
+#if 0
+       // Discard the sign from the subtraction
+       double angle = fabs(Angle() - v.Angle());
+
+       // Return the complementary angle if greater than 180⁰
+       return (angle <= 180.0 ? angle : 360.0 - angle);
+#else
        return Angle() - v.Angle();
+#endif
 }
 
 
 bool Vector::isZero(double epsilon/*= 1e-6*/)
 {
-       return (fabs(x) < epsilon && fabs(y) < epsilon && fabs(z) < epsilon ? true : false);
+       return ((fabs(x) < epsilon) && (fabs(y) < epsilon) && (fabs(z) < epsilon) ? true : false);
 }
 
 
@@ -392,7 +401,7 @@ double Vector::Magnitude(Vector v1, Vector v2)
        double xx = v1.x - v2.x;
        double yy = v1.y - v2.y;
        double zz = v1.z - v2.z;
-       return sqrt(xx * xx + yy * yy + zz * zz);
+       return sqrt((xx * xx) + (yy * yy) + (zz * zz));
 }
 
 #endif
index 6c46dffa842fc7f956ff8c37a0f446a343a70866..4504fe4572a8f088407029c0f36342d8d0ae350e 100755 (executable)
@@ -98,4 +98,5 @@ typedef Vector Point;
 
 #endif // __VECTOR_H__
 
-#endif
\ No newline at end of file
+#endif
+
index 996c9a4f52421687b7e3350a676b9dad99666457..1e860184bef7fff1ed31905eb840693c0b002fa5 100644 (file)
@@ -9,7 +9,6 @@ HEADERS += src/ttedit.h
 HEADERS += src/mainwindow.h
 HEADERS += src/editwindow.h
 HEADERS += src/glyphpoints.h
-HEADERS += src/types.h
 HEADERS += src/debug.h
 HEADERS += src/toolwindow.h
 HEADERS += src/charwindow.h