| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vhea.h" | 5 #include "vhea.h" |
| 6 | 6 |
| 7 #include "gsub.h" | |
| 8 #include "head.h" | 7 #include "head.h" |
| 9 #include "maxp.h" | 8 #include "maxp.h" |
| 10 | 9 |
| 11 // vhea - Vertical Header Table | 10 // vhea - Vertical Header Table |
| 12 // http://www.microsoft.com/typography/otspec/vhea.htm | 11 // http://www.microsoft.com/typography/otspec/vhea.htm |
| 13 | 12 |
| 14 #define TABLE_NAME "vhea" | 13 #define TABLE_NAME "vhea" |
| 15 | 14 |
| 16 namespace ots { | 15 namespace ots { |
| 17 | 16 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 30 | 29 |
| 31 if (!ParseMetricsHeader(font, &table, &vhea->header)) { | 30 if (!ParseMetricsHeader(font, &table, &vhea->header)) { |
| 32 return OTS_FAILURE_MSG("Failed to parse metrics in vhea"); | 31 return OTS_FAILURE_MSG("Failed to parse metrics in vhea"); |
| 33 } | 32 } |
| 34 | 33 |
| 35 return true; | 34 return true; |
| 36 } | 35 } |
| 37 | 36 |
| 38 bool ots_vhea_should_serialise(Font *font) { | 37 bool ots_vhea_should_serialise(Font *font) { |
| 39 // vhea should'nt serialise when vmtx doesn't exist. | 38 // vhea should'nt serialise when vmtx doesn't exist. |
| 40 // Firefox developer pointed out that vhea/vmtx should serialise iff GSUB is | 39 return font->vhea != NULL && font->vmtx != NULL; |
| 41 // preserved. See http://crbug.com/77386 | |
| 42 return font->vhea != NULL && font->vmtx != NULL && | |
| 43 ots_gsub_should_serialise(font); | |
| 44 } | 40 } |
| 45 | 41 |
| 46 bool ots_vhea_serialise(OTSStream *out, Font *font) { | 42 bool ots_vhea_serialise(OTSStream *out, Font *font) { |
| 47 if (!SerialiseMetricsHeader(font, out, &font->vhea->header)) { | 43 if (!SerialiseMetricsHeader(font, out, &font->vhea->header)) { |
| 48 return OTS_FAILURE_MSG("Failed to write vhea metrics"); | 44 return OTS_FAILURE_MSG("Failed to write vhea metrics"); |
| 49 } | 45 } |
| 50 return true; | 46 return true; |
| 51 } | 47 } |
| 52 | 48 |
| 53 void ots_vhea_reuse(Font *font, Font *other) { | 49 void ots_vhea_reuse(Font *font, Font *other) { |
| 54 font->vhea = other->vhea; | 50 font->vhea = other->vhea; |
| 55 font->vhea_reused = true; | 51 font->vhea_reused = true; |
| 56 } | 52 } |
| 57 | 53 |
| 58 void ots_vhea_free(Font *font) { | 54 void ots_vhea_free(Font *font) { |
| 59 delete font->vhea; | 55 delete font->vhea; |
| 60 } | 56 } |
| 61 | 57 |
| 62 } // namespace ots | 58 } // namespace ots |
| 63 | 59 |
| 64 #undef TABLE_NAME | 60 #undef TABLE_NAME |
| OLD | NEW |