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 "gpos.h" | 5 #include "gpos.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "gdef.h" | 10 #include "gdef.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 {GPOS_TYPE_PAIR_ADJUSTMENT, ParsePairAdjustment}, | 62 {GPOS_TYPE_PAIR_ADJUSTMENT, ParsePairAdjustment}, |
63 {GPOS_TYPE_CURSIVE_ATTACHMENT, ParseCursiveAttachment}, | 63 {GPOS_TYPE_CURSIVE_ATTACHMENT, ParseCursiveAttachment}, |
64 {GPOS_TYPE_MARK_TO_BASE_ATTACHMENT, ParseMarkToBaseAttachment}, | 64 {GPOS_TYPE_MARK_TO_BASE_ATTACHMENT, ParseMarkToBaseAttachment}, |
65 {GPOS_TYPE_MARK_TO_LIGATURE_ATTACHMENT, ParseMarkToLigatureAttachment}, | 65 {GPOS_TYPE_MARK_TO_LIGATURE_ATTACHMENT, ParseMarkToLigatureAttachment}, |
66 {GPOS_TYPE_MARK_TO_MARK_ATTACHMENT, ParseMarkToMarkAttachment}, | 66 {GPOS_TYPE_MARK_TO_MARK_ATTACHMENT, ParseMarkToMarkAttachment}, |
67 {GPOS_TYPE_CONTEXT_POSITIONING, ParseContextPositioning}, | 67 {GPOS_TYPE_CONTEXT_POSITIONING, ParseContextPositioning}, |
68 {GPOS_TYPE_CHAINED_CONTEXT_POSITIONING, ParseChainedContextPositioning}, | 68 {GPOS_TYPE_CHAINED_CONTEXT_POSITIONING, ParseChainedContextPositioning}, |
69 {GPOS_TYPE_EXTENSION_POSITIONING, ParseExtensionPositioning} | 69 {GPOS_TYPE_EXTENSION_POSITIONING, ParseExtensionPositioning} |
70 }; | 70 }; |
71 | 71 |
72 // TODO(bashi): Port Chromium's arraysize macro and use it instead of sizeof(). | |
73 const ots::LookupSubtableParser kGposLookupSubtableParser = { | 72 const ots::LookupSubtableParser kGposLookupSubtableParser = { |
74 sizeof(kGposTypeParsers) / sizeof(kGposTypeParsers[0]), | 73 arraysize(kGposTypeParsers), |
75 GPOS_TYPE_EXTENSION_POSITIONING, kGposTypeParsers | 74 GPOS_TYPE_EXTENSION_POSITIONING, kGposTypeParsers |
76 }; | 75 }; |
77 | 76 |
78 // Shared Tables: ValueRecord, Anchor Table, and MarkArray | 77 // Shared Tables: ValueRecord, Anchor Table, and MarkArray |
79 | 78 |
80 bool ParseValueRecord(ots::Buffer* subtable, const uint8_t *data, | 79 bool ParseValueRecord(ots::Buffer* subtable, const uint8_t *data, |
81 const size_t length, const uint16_t value_format) { | 80 const size_t length, const uint16_t value_format) { |
82 // Check existence of adjustment fields. | 81 // Check existence of adjustment fields. |
83 for (unsigned i = 0; i < 4; ++i) { | 82 for (unsigned i = 0; i < 4; ++i) { |
84 if ((value_format >> i) & 0x1) { | 83 if ((value_format >> i) & 0x1) { |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 | 801 |
803 return true; | 802 return true; |
804 } | 803 } |
805 | 804 |
806 void ots_gpos_free(OpenTypeFile *file) { | 805 void ots_gpos_free(OpenTypeFile *file) { |
807 delete file->gpos; | 806 delete file->gpos; |
808 } | 807 } |
809 | 808 |
810 } // namespace ots | 809 } // namespace ots |
811 | 810 |
OLD | NEW |