108 for (
size_t i = 0; i < bfrange.size(); i += 100) {
113 for (
int j = 0; j <
count; ++j) {
115 write_glyph(cmap, multiByte, bfrange[i + j].fStart);
155 bool multiByteGlyphs,
159 if (!multiByteGlyphs) {
160 glyphOffset = firstGlyphID - 1;
163 std::vector<BFChar> bfcharEntries;
164 std::vector<BFRange> bfrangeEntries;
166 BFRange currentRangeEntry = {0, 0, 0};
167 bool rangeEmpty =
true;
168 const int limit = (
int)lastGlyphID + 1 - glyphOffset;
170 for (
int i = firstGlyphID - glyphOffset; i < limit + 1; ++i) {
172 bool inSubset = i < limit && (subset ==
nullptr || subset->
has(gid));
178 i == currentRangeEntry.fEnd + 1 &&
179 i >> 8 == currentRangeEntry.fStart >> 8 &&
181 glyphToUnicode[gid] ==
182 currentRangeEntry.fUnicode + i - currentRangeEntry.fStart;
183 if (!inSubset || !inRange) {
184 if (currentRangeEntry.fEnd > currentRangeEntry.fStart) {
185 bfrangeEntries.push_back(currentRangeEntry);
187 bfcharEntries.push_back({currentRangeEntry.fStart, currentRangeEntry.fUnicode});
193 currentRangeEntry.fEnd = i;
195 currentRangeEntry.fStart = i;
196 currentRangeEntry.fUnicode = glyphToUnicode[gid];
std::unique_ptr< SkStreamAsset > SkPDFMakeToUnicodeCmap(const SkUnichar *glyphToUnicode, const SkPDFGlyphUse *subset, bool multiByteGlyphs, SkGlyphID firstGlyphID, SkGlyphID lastGlyphID)
void SkPDFAppendCmapSections(const SkUnichar *glyphToUnicode, const SkPDFGlyphUse *subset, SkDynamicMemoryWStream *cmap, bool multiByteGlyphs, SkGlyphID firstGlyphID, SkGlyphID lastGlyphID)