- {
- /* here, the buffer length must be a multiple of 4 */
- FT_ULong len = (lengths[i] + 3) & ~3;
- unsigned char *buf = new unsigned char[len];
-
- buf[len - 1] = 0x00; /* assure padding with zeros */
- buf[len - 2] = 0x00;
- buf[len - 3] = 0x00;
-
- FT_Error error = FT_Load_Sfnt_Table (face, tags[i], 0, buf, NULL);
- if (error)
- programming_error ("FT_Load_Sfnt_Table (): error.");
-
- if (tag == head_tag)
- {
- /*
- first pass of computing the font checksum
- needs checkSumAdjustment = 0
- */
- buf[8] = 0x00;
- buf[9] = 0x00;
- buf[10] = 0x00;
- buf[11] = 0x00;
- }
-
- checksum = 0;
- unsigned char *endq = buf + len;
- for (unsigned char *q = buf; q < endq; q += 4)
- checksum += (q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
- font_checksum += checksum;
-
- delete[] buf;
-
- *(p++) = (tags[i] & 0xFF000000UL) >> 24;
- *(p++) = (tags[i] & 0x00FF0000UL) >> 16;
- *(p++) = (tags[i] & 0x0000FF00UL) >> 8;
- *(p++) = tags[i] & 0x000000FFUL;
-
- *(p++) = (checksum & 0xFF000000UL) >> 24;
- *(p++) = (checksum & 0x00FF0000UL) >> 16;
- *(p++) = (checksum & 0x0000FF00UL) >> 8;
- *(p++) = checksum & 0x000000FFUL;
-
- *(p++) = (offset & 0xFF000000UL) >> 24;
- *(p++) = (offset & 0x00FF0000UL) >> 16;
- *(p++) = (offset & 0x0000FF00UL) >> 8;
- *(p++) = offset & 0x000000FFUL;
-
- *(p++) = (lengths[i] & 0xFF000000UL) >> 24;
- *(p++) = (lengths[i] & 0x00FF0000UL) >> 16;
- *(p++) = (lengths[i] & 0x0000FF00UL) >> 8;
- *(p++) = lengths[i] & 0x000000FFUL;
-
- /* offset must be a multiple of 4 */
- offset += (lengths[i] + 3) & ~3;
- }
+ {
+ /* here, the buffer length must be a multiple of 4 */
+ FT_ULong len = (lengths[i] + 3) & ~3;
+ unsigned char *buf = new unsigned char[len];
+
+ buf[len - 1] = 0x00; /* assure padding with zeros */
+ buf[len - 2] = 0x00;
+ buf[len - 3] = 0x00;
+
+ FT_Error error = FT_Load_Sfnt_Table (face, tags[i], 0, buf, NULL);
+ if (error)
+ programming_error ("FT_Load_Sfnt_Table (): error.");
+
+ if (tag == head_tag)
+ {
+ /*
+ first pass of computing the font checksum
+ needs checkSumAdjustment = 0
+ */
+ buf[8] = 0x00;
+ buf[9] = 0x00;
+ buf[10] = 0x00;
+ buf[11] = 0x00;
+ }
+
+ checksum = 0;
+ unsigned char *endq = buf + len;
+ for (unsigned char *q = buf; q < endq; q += 4)
+ checksum += (q[0] << 24) | (q[1] << 16) | (q[2] << 8) | q[3];
+ font_checksum += checksum;
+
+ delete[] buf;
+
+ *(p++) = (unsigned char) ((tags[i] & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((tags[i] & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((tags[i] & 0x0000FF00UL) >> 8);
+ *(p++) = tags[i] & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((checksum & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((checksum & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((checksum & 0x0000FF00UL) >> 8);
+ *(p++) = checksum & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((offset & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((offset & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((offset & 0x0000FF00UL) >> 8);
+ *(p++) = offset & 0x000000FFUL;
+
+ *(p++) = (unsigned char) ((lengths[i] & 0xFF000000UL) >> 24);
+ *(p++) = (unsigned char) ((lengths[i] & 0x00FF0000UL) >> 16);
+ *(p++) = (unsigned char) ((lengths[i] & 0x0000FF00UL) >> 8);
+ *(p++) = lengths[i] & 0x000000FFUL;
+
+ /* offset must be a multiple of 4 */
+ offset += (lengths[i] + 3) & ~3;
+ }