OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkData.h" | 8 #include "SkData.h" |
9 #include "SkPDFFont.h" | 9 #include "SkPDFFont.h" |
10 #include "SkPDFTypes.h" | 10 #include "SkPDFTypes.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 buffer.getOffset())); | 142 buffer.getOffset())); |
143 | 143 |
144 glyphToUnicode.reset(); | 144 glyphToUnicode.reset(); |
145 glyphsInSubset.reset(); | 145 glyphsInSubset.reset(); |
146 SkPDFGlyphSet subset2; | 146 SkPDFGlyphSet subset2; |
147 | 147 |
148 // Test mapping: | 148 // Test mapping: |
149 // I n s t a l | 149 // I n s t a l |
150 // Glyph id 2c 51 56 57 44 4f | 150 // Glyph id 2c 51 56 57 44 4f |
151 // Unicode 49 6e 73 74 61 6c | 151 // Unicode 49 6e 73 74 61 6c |
152 for (size_t i = 0; i < 100; ++i) { | 152 for (SkUnichar i = 0; i < 100; ++i) { |
153 glyphToUnicode.push(i + 29); | 153 glyphToUnicode.push(i + 29); |
154 } | 154 } |
155 | 155 |
156 glyphsInSubset.push(0x2C); | 156 glyphsInSubset.push(0x2C); |
157 glyphsInSubset.push(0x44); | 157 glyphsInSubset.push(0x44); |
158 glyphsInSubset.push(0x4F); | 158 glyphsInSubset.push(0x4F); |
159 glyphsInSubset.push(0x51); | 159 glyphsInSubset.push(0x51); |
160 glyphsInSubset.push(0x56); | 160 glyphsInSubset.push(0x56); |
161 glyphsInSubset.push(0x57); | 161 glyphsInSubset.push(0x57); |
162 | 162 |
163 SkDynamicMemoryWStream buffer2; | 163 SkDynamicMemoryWStream buffer2; |
164 subset2.set(glyphsInSubset.begin(), glyphsInSubset.count()); | 164 subset2.set(glyphsInSubset.begin(), glyphsInSubset.count()); |
165 append_cmap_sections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff); | 165 append_cmap_sections(glyphToUnicode, &subset2, &buffer2, true, 0, 0xffff); |
166 | 166 |
167 char expectedResult2[] = | 167 char expectedResult2[] = |
168 "4 beginbfchar\n\ | 168 "4 beginbfchar\n\ |
169 <002C> <0049>\n\ | 169 <002C> <0049>\n\ |
170 <0044> <0061>\n\ | 170 <0044> <0061>\n\ |
171 <004F> <006C>\n\ | 171 <004F> <006C>\n\ |
172 <0051> <006E>\n\ | 172 <0051> <006E>\n\ |
173 endbfchar\n\ | 173 endbfchar\n\ |
174 1 beginbfrange\n\ | 174 1 beginbfrange\n\ |
175 <0056> <0057> <0073>\n\ | 175 <0056> <0057> <0073>\n\ |
176 endbfrange\n"; | 176 endbfrange\n"; |
177 | 177 |
178 REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, | 178 REPORTER_ASSERT(reporter, stream_equals(buffer2, 0, expectedResult2, |
179 buffer2.getOffset())); | 179 buffer2.getOffset())); |
180 } | 180 } |
OLD | NEW |