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 "gsub.h" | 5 #include "gsub.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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 {GSUB_TYPE_MULTIPLE, ParseMutipleSubstitution}, | 56 {GSUB_TYPE_MULTIPLE, ParseMutipleSubstitution}, |
57 {GSUB_TYPE_ALTERNATE, ParseAlternateSubstitution}, | 57 {GSUB_TYPE_ALTERNATE, ParseAlternateSubstitution}, |
58 {GSUB_TYPE_LIGATURE, ParseLigatureSubstitution}, | 58 {GSUB_TYPE_LIGATURE, ParseLigatureSubstitution}, |
59 {GSUB_TYPE_CONTEXT, ParseContextSubstitution}, | 59 {GSUB_TYPE_CONTEXT, ParseContextSubstitution}, |
60 {GSUB_TYPE_CHANGING_CONTEXT, ParseChainingContextSubstitution}, | 60 {GSUB_TYPE_CHANGING_CONTEXT, ParseChainingContextSubstitution}, |
61 {GSUB_TYPE_EXTENSION_SUBSTITUTION, ParseExtensionSubstitution}, | 61 {GSUB_TYPE_EXTENSION_SUBSTITUTION, ParseExtensionSubstitution}, |
62 {GSUB_TYPE_REVERSE_CHAINING_CONTEXT_SINGLE, | 62 {GSUB_TYPE_REVERSE_CHAINING_CONTEXT_SINGLE, |
63 ParseReverseChainingContextSingleSubstitution} | 63 ParseReverseChainingContextSingleSubstitution} |
64 }; | 64 }; |
65 | 65 |
66 // TODO(bashi): Port Chromium's arraysize macro and use it instead of sizeof(). | |
67 const ots::LookupSubtableParser kGsubLookupSubtableParser = { | 66 const ots::LookupSubtableParser kGsubLookupSubtableParser = { |
68 sizeof(kGsubTypeParsers) / sizeof(kGsubTypeParsers[0]), | 67 arraysize(kGsubTypeParsers), |
69 GSUB_TYPE_EXTENSION_SUBSTITUTION, kGsubTypeParsers | 68 GSUB_TYPE_EXTENSION_SUBSTITUTION, kGsubTypeParsers |
70 }; | 69 }; |
71 | 70 |
72 // Lookup Type 1: | 71 // Lookup Type 1: |
73 // Single Substitution Subtable | 72 // Single Substitution Subtable |
74 bool ParseSingleSubstitution(const ots::OpenTypeFile *file, | 73 bool ParseSingleSubstitution(const ots::OpenTypeFile *file, |
75 const uint8_t *data, const size_t length) { | 74 const uint8_t *data, const size_t length) { |
76 ots::Buffer subtable(data, length); | 75 ots::Buffer subtable(data, length); |
77 | 76 |
78 uint16_t format = 0; | 77 uint16_t format = 0; |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 | 665 |
667 return true; | 666 return true; |
668 } | 667 } |
669 | 668 |
670 void ots_gsub_free(OpenTypeFile *file) { | 669 void ots_gsub_free(OpenTypeFile *file) { |
671 delete file->gsub; | 670 delete file->gsub; |
672 } | 671 } |
673 | 672 |
674 } // namespace ots | 673 } // namespace ots |
675 | 674 |
OLD | NEW |