157 {
158 int glyphOffset = 0;
159 if (!multiByteGlyphs) {
160 glyphOffset = firstGlyphID - 1;
161 }
162
163 std::vector<BFChar> bfcharEntries;
164 std::vector<BFRange> bfrangeEntries;
165
166 BFRange currentRangeEntry = {0, 0, 0};
167 bool rangeEmpty = true;
168 const int limit = (
int)lastGlyphID + 1 - glyphOffset;
169
170 for (int i = firstGlyphID - glyphOffset; i < limit + 1; ++i) {
172 bool inSubset = i < limit && (subset ==
nullptr || subset->
has(gid));
173 if (!rangeEmpty) {
174
175
176
177 bool inRange =
178 i == currentRangeEntry.fEnd + 1 &&
179 i >> 8 == currentRangeEntry.fStart >> 8 &&
180 i < limit &&
181 glyphToUnicode[gid] ==
182 currentRangeEntry.fUnicode + i - currentRangeEntry.fStart;
183 if (!inSubset || !inRange) {
184 if (currentRangeEntry.fEnd > currentRangeEntry.fStart) {
185 bfrangeEntries.push_back(currentRangeEntry);
186 } else {
187 bfcharEntries.push_back({currentRangeEntry.fStart, currentRangeEntry.fUnicode});
188 }
189 rangeEmpty = true;
190 }
191 }
192 if (inSubset) {
193 currentRangeEntry.fEnd = i;
194 if (rangeEmpty) {
195 currentRangeEntry.fStart = i;
196 currentRangeEntry.fUnicode = glyphToUnicode[gid];
197 rangeEmpty = false;
198 }
199 }
200 }
201
202
203
206}
static void append_bfrange_section(const std::vector< BFRange > &bfrange, bool multiByte, SkDynamicMemoryWStream *cmap)
static void append_bfchar_section(const std::vector< BFChar > &bfchar, bool multiByte, SkDynamicMemoryWStream *cmap)
Type::kYUV Type::kRGBA() int(0.7 *637)
bool has(SkGlyphID gid) const