| Index: src/vorg.cc
|
| diff --git a/src/vorg.cc b/src/vorg.cc
|
| old mode 100644
|
| new mode 100755
|
| index b218c8895e4070bc5ce21e9c24df0fc1a3513eb8..d3ce72ab332b0e9424a3f94c0c58779f182e685c
|
| --- a/src/vorg.cc
|
| +++ b/src/vorg.cc
|
| @@ -7,10 +7,17 @@
|
| #include <vector>
|
|
|
| // VORG - Vertical Origin Table
|
| -// http://www.microsoft.com/opentype/otspec/vorg.htm
|
| +// http://www.microsoft.com/typography/otspec/vorg.htm
|
|
|
| -#define DROP_THIS_TABLE \
|
| - do { delete file->vorg; file->vorg = 0; } while (0)
|
| +#define TABLE_NAME "VORG"
|
| +
|
| +#define DROP_THIS_TABLE(...) \
|
| + do { \
|
| + delete file->vorg; \
|
| + file->vorg = 0; \
|
| + OTS_FAILURE_MSG_(file, TABLE_NAME ": " __VA_ARGS__); \
|
| + OTS_FAILURE_MSG("Table discarded"); \
|
| + } while (0)
|
|
|
| namespace ots {
|
|
|
| @@ -24,16 +31,14 @@ bool ots_vorg_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
|
| !table.ReadU16(&vorg->minor_version) ||
|
| !table.ReadS16(&vorg->default_vert_origin_y) ||
|
| !table.ReadU16(&num_recs)) {
|
| - return OTS_FAILURE();
|
| + return OTS_FAILURE_MSG("Failed to read header");
|
| }
|
| if (vorg->major_version != 1) {
|
| - OTS_WARNING("bad major version: %u", vorg->major_version);
|
| - DROP_THIS_TABLE;
|
| + DROP_THIS_TABLE("bad major version: %u", vorg->major_version);
|
| return true;
|
| }
|
| if (vorg->minor_version != 0) {
|
| - OTS_WARNING("bad minor version: %u", vorg->minor_version);
|
| - DROP_THIS_TABLE;
|
| + DROP_THIS_TABLE("bad minor version: %u", vorg->minor_version);
|
| return true;
|
| }
|
|
|
| @@ -49,11 +54,10 @@ bool ots_vorg_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
|
|
|
| if (!table.ReadU16(&rec.glyph_index) ||
|
| !table.ReadS16(&rec.vert_origin_y)) {
|
| - return OTS_FAILURE();
|
| + return OTS_FAILURE_MSG("Failed to read record %d", i);
|
| }
|
| if ((i != 0) && (rec.glyph_index <= last_glyph_index)) {
|
| - OTS_WARNING("the table is not sorted");
|
| - DROP_THIS_TABLE;
|
| + DROP_THIS_TABLE("the table is not sorted");
|
| return true;
|
| }
|
| last_glyph_index = rec.glyph_index;
|
| @@ -78,14 +82,14 @@ bool ots_vorg_serialise(OTSStream *out, OpenTypeFile *file) {
|
| !out->WriteU16(vorg->minor_version) ||
|
| !out->WriteS16(vorg->default_vert_origin_y) ||
|
| !out->WriteU16(num_metrics)) {
|
| - return OTS_FAILURE();
|
| + return OTS_FAILURE_MSG("Failed to write table header");
|
| }
|
|
|
| for (uint16_t i = 0; i < num_metrics; ++i) {
|
| const OpenTypeVORGMetrics& rec = vorg->metrics[i];
|
| if (!out->WriteU16(rec.glyph_index) ||
|
| !out->WriteS16(rec.vert_origin_y)) {
|
| - return OTS_FAILURE();
|
| + return OTS_FAILURE_MSG("Failed to write record %d", i);
|
| }
|
| }
|
|
|
| @@ -97,3 +101,6 @@ void ots_vorg_free(OpenTypeFile *file) {
|
| }
|
|
|
| } // namespace ots
|
| +
|
| +#undef TABLE_NAME
|
| +#undef DROP_THIS_TABLE
|
|
|