| Index: third_party/ots/src/vmtx.cc
|
| diff --git a/third_party/ots/src/vmtx.cc b/third_party/ots/src/vmtx.cc
|
| index e29d32b29f9b55de3a76727a2d0af75f656b860d..0944e598baca6811d118d2c307a4f00b630767d8 100644
|
| --- a/third_party/ots/src/vmtx.cc
|
| +++ b/third_party/ots/src/vmtx.cc
|
| @@ -15,39 +15,44 @@
|
|
|
| namespace ots {
|
|
|
| -bool ots_vmtx_parse(OpenTypeFile *file, const uint8_t *data, size_t length) {
|
| +bool ots_vmtx_parse(Font *font, const uint8_t *data, size_t length) {
|
| Buffer table(data, length);
|
| OpenTypeVMTX *vmtx = new OpenTypeVMTX;
|
| - file->vmtx = vmtx;
|
| + font->vmtx = vmtx;
|
|
|
| - if (!file->vhea || !file->maxp) {
|
| + if (!font->vhea || !font->maxp) {
|
| return OTS_FAILURE_MSG("vhea or maxp table missing as needed by vmtx");
|
| }
|
|
|
| - if (!ParseMetricsTable(file, &table, file->maxp->num_glyphs,
|
| - &file->vhea->header, &vmtx->metrics)) {
|
| + if (!ParseMetricsTable(font, &table, font->maxp->num_glyphs,
|
| + &font->vhea->header, &vmtx->metrics)) {
|
| return OTS_FAILURE_MSG("Failed to parse vmtx metrics");
|
| }
|
|
|
| return true;
|
| }
|
|
|
| -bool ots_vmtx_should_serialise(OpenTypeFile *file) {
|
| +bool ots_vmtx_should_serialise(Font *font) {
|
| // vmtx should serialise when vhea and GSUB are preserved.
|
| // See the comment in ots_vhea_should_serialise().
|
| - return file->vmtx != NULL && file->vhea != NULL &&
|
| - ots_gsub_should_serialise(file);
|
| + return font->vmtx != NULL && font->vhea != NULL &&
|
| + ots_gsub_should_serialise(font);
|
| }
|
|
|
| -bool ots_vmtx_serialise(OTSStream *out, OpenTypeFile *file) {
|
| - if (!SerialiseMetricsTable(file, out, &file->vmtx->metrics)) {
|
| +bool ots_vmtx_serialise(OTSStream *out, Font *font) {
|
| + if (!SerialiseMetricsTable(font, out, &font->vmtx->metrics)) {
|
| return OTS_FAILURE_MSG("Failed to write vmtx metrics");
|
| }
|
| return true;
|
| }
|
|
|
| -void ots_vmtx_free(OpenTypeFile *file) {
|
| - delete file->vmtx;
|
| +void ots_vmtx_reuse(Font *font, Font *other) {
|
| + font->vmtx = other->vmtx;
|
| + font->vmtx_reused = true;
|
| +}
|
| +
|
| +void ots_vmtx_free(Font *font) {
|
| + delete font->vmtx;
|
| }
|
|
|
| } // namespace ots
|
|
|