| Index: third_party/ots/src/loca.cc
|
| diff --git a/third_party/ots/src/loca.cc b/third_party/ots/src/loca.cc
|
| index 4b291f028c0848dacbaec63c68db5da5d11bcd40..aae04c25ab78db23aa5be4e07b28a451a2149068 100644
|
| --- a/third_party/ots/src/loca.cc
|
| +++ b/third_party/ots/src/loca.cc
|
| @@ -14,25 +14,25 @@
|
|
|
| namespace ots {
|
|
|
| -bool ots_loca_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
|
| +bool ots_loca_parse(Font *font, const uint8_t *data, size_t length) {
|
| Buffer table(data, length);
|
|
|
| // We can't do anything useful in validating this data except to ensure that
|
| // the values are monotonically increasing.
|
|
|
| OpenTypeLOCA *loca = new OpenTypeLOCA;
|
| - file->loca = loca;
|
| + font->loca = loca;
|
|
|
| - if (!file->maxp || !file->head) {
|
| + if (!font->maxp || !font->head) {
|
| return OTS_FAILURE_MSG("maxp or head tables missing from font, needed by loca");
|
| }
|
|
|
| - const unsigned num_glyphs = file->maxp->num_glyphs;
|
| + const unsigned num_glyphs = font->maxp->num_glyphs;
|
| unsigned last_offset = 0;
|
| loca->offsets.resize(num_glyphs + 1);
|
| // maxp->num_glyphs is uint16_t, thus the addition never overflows.
|
|
|
| - if (file->head->index_to_loc_format == 0) {
|
| + if (font->head->index_to_loc_format == 0) {
|
| // Note that the <= here (and below) is correct. There is one more offset
|
| // than the number of glyphs in order to give the length of the final
|
| // glyph.
|
| @@ -64,13 +64,13 @@ bool ots_loca_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
|
| return true;
|
| }
|
|
|
| -bool ots_loca_should_serialise(OpenTypeFile *file) {
|
| - return file->loca != NULL;
|
| +bool ots_loca_should_serialise(Font *font) {
|
| + return font->loca != NULL;
|
| }
|
|
|
| -bool ots_loca_serialise(OTSStream *out, OpenTypeFile *file) {
|
| - const OpenTypeLOCA *loca = file->loca;
|
| - const OpenTypeHEAD *head = file->head;
|
| +bool ots_loca_serialise(OTSStream *out, Font *font) {
|
| + const OpenTypeLOCA *loca = font->loca;
|
| + const OpenTypeHEAD *head = font->head;
|
|
|
| if (!head) {
|
| return OTS_FAILURE_MSG("Missing head table in font needed by loca");
|
| @@ -95,8 +95,13 @@ bool ots_loca_serialise(OTSStream *out, OpenTypeFile *file) {
|
| return true;
|
| }
|
|
|
| -void ots_loca_free(OpenTypeFile *file) {
|
| - delete file->loca;
|
| +void ots_loca_reuse(Font *font, Font *other) {
|
| + font->loca = other->loca;
|
| + font->loca_reused = true;
|
| +}
|
| +
|
| +void ots_loca_free(Font *font) {
|
| + delete font->loca;
|
| }
|
|
|
| } // namespace ots
|
|
|