| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "post.h" | 5 #include "post.h" |
| 6 | 6 |
| 7 #include "maxp.h" | 7 #include "maxp.h" |
| 8 | 8 |
| 9 // post - PostScript | 9 // post - PostScript |
| 10 // http://www.microsoft.com/opentype/otspec/post.htm | 10 // http://www.microsoft.com/opentype/otspec/post.htm |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 if (num_glyphs != file->maxp->num_glyphs) { | 69 if (num_glyphs != file->maxp->num_glyphs) { |
| 70 // Note: Fixedsys500c.ttf seems to have inconsistent num_glyphs values. | 70 // Note: Fixedsys500c.ttf seems to have inconsistent num_glyphs values. |
| 71 return OTS_FAILURE(); | 71 return OTS_FAILURE(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 post->glyph_name_index.resize(num_glyphs); | 74 post->glyph_name_index.resize(num_glyphs); |
| 75 for (unsigned i = 0; i < num_glyphs; ++i) { | 75 for (unsigned i = 0; i < num_glyphs; ++i) { |
| 76 if (!table.ReadU16(&post->glyph_name_index[i])) { | 76 if (!table.ReadU16(&post->glyph_name_index[i])) { |
| 77 return OTS_FAILURE(); | 77 return OTS_FAILURE(); |
| 78 } | 78 } |
| 79 if (post->glyph_name_index[i] >= 32768) { | 79 // Note: A strict interpretation of the specification requires name indexes |
| 80 // Note: droid_arialuni.ttf fails this test. | 80 // are less than 32768. This, however, excludes fonts like unifont.ttf |
| 81 return OTS_FAILURE(); // reserved area. | 81 // which cover all of unicode. |
| 82 } | |
| 83 } | 82 } |
| 84 | 83 |
| 85 // Now we have an array of Pascal strings. We have to check that they are all | 84 // Now we have an array of Pascal strings. We have to check that they are all |
| 86 // valid and read them in. | 85 // valid and read them in. |
| 87 const size_t strings_offset = table.offset(); | 86 const size_t strings_offset = table.offset(); |
| 88 const uint8_t *strings = data + strings_offset; | 87 const uint8_t *strings = data + strings_offset; |
| 89 const uint8_t *strings_end = data + length; | 88 const uint8_t *strings_end = data + length; |
| 90 | 89 |
| 91 for (;;) { | 90 for (;;) { |
| 92 if (strings == strings_end) break; | 91 if (strings == strings_end) break; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 } | 171 } |
| 173 | 172 |
| 174 return true; | 173 return true; |
| 175 } | 174 } |
| 176 | 175 |
| 177 void ots_post_free(OpenTypeFile *file) { | 176 void ots_post_free(OpenTypeFile *file) { |
| 178 delete file->post; | 177 delete file->post; |
| 179 } | 178 } |
| 180 | 179 |
| 181 } // namespace ots | 180 } // namespace ots |
| OLD | NEW |