// - 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"
#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);
}*/
//
// 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
//
// 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;
}
//
// 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;
//
// 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
//
// 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++)
{
//
// 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++];
}
//
// 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);
}
/////////////////////////////////////////////////////////////////////////////
//
// 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;
}
//
// 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;
}
//
// 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;
}
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;
}
/////////////////////////////////////////////////////////////////////////////
void TTF::ClearTables(void)
{
- for(uint32 i=0; i<NUMTABS; i++)
+ for(uint32_t i=0; i<NUMTABS; i++)
{
if ((*parray[i]) != NULL)
{
}
}
- for(uint32 i=0; i<MAXGLYPHS; i++)
+ for(uint32_t i=0; i<MAXGLYPHS; i++)
{
if (glyph[i] != NULL)
{
{
// 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",
}
#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
#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);
#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
{
// 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...
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);
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)
{
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!
//
// 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;
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
{
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
{
{
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
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!
// 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)
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...
{
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);
}
//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 */
// }
//} 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.
// 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?
{
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;
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)
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
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
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);
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;
}
/////////////////////////////////////////////////////////////////////////////
-// 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
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)
{
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;
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);
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)
{
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
/////////////////////////////////////////////////////////////////////////////
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
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
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
if (glyf)
free(glyf);
- glyf = (uint8 *) malloc(glyf_len);
+ glyf = (uint8_t *) malloc(glyf_len);
start = tp = 0; // Reset table pointer
// 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
// 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;
// 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;
return Box(llx, lly, urx, ury);
}
-GlyphPt TTF::GetPoint(uint16 pointno)
+GlyphPt TTF::GetPoint(uint16_t pointno)
{
GlyphPt p;
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;
return poly[polynum];
}
-int TTF::GetPointX(uint16 pointno)
+int TTF::GetPointX(uint16_t pointno)
{
if (pointno >= MAXPOINTS)
return 0;
return gx[pointno];
}
-int TTF::GetPointY(uint16 pointno)
+int TTF::GetPointY(uint16_t pointno)
{
if (pointno >= MAXPOINTS)
return 0;
return gy[pointno];
}
-bool TTF::GetOnCurve(uint16 pointno)
+bool TTF::GetOnCurve(uint16_t pointno)
{
if (pointno >= MAXPOINTS)
return true;
return onCurve[pointno];
}
-bool TTF::SetOnCurve(uint16 pointno, bool state)
+bool TTF::SetOnCurve(uint16_t pointno, bool state)
{
if (pointno >= numberOfPoints)
return false;
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;
return true;
}
-bool TTF::MovePoint(uint16 pointno, GlyphPt p)
+bool TTF::MovePoint(uint16_t pointno, GlyphPt p)
{
if (pointno >= numberOfPoints)
return false;