| 460 | } |
| 461 | |
| 462 | std::string PDFDocumentImpl::nextFontSubsetTag() { |
| 463 | // PDF 32000-1:2008 Section 9.6.4 FontSubsets "The tag shall consist of six uppercase letters" |
| 464 | // "followed by a plus sign" "different subsets in the same PDF file shall have different tags." |
| 465 | // There are 26^6 or 308,915,776 possible values. So start in range then increment and mod. |
| 466 | uint32_t thisFontSubsetTag = nextFontSubsetTag_; |
| 467 | nextFontSubsetTag_ = (nextFontSubsetTag_ + 1u) % 308915776u; |
| 468 | |
| 469 | std::string subsetTag(7, ' '); |
| 470 | char* subsetTagData = subsetTag.data(); |
| 471 | for (size_t i = 0; i < 6; ++i) { |
| 472 | subsetTagData[i] = 'A' + (thisFontSubsetTag % 26); |
| 473 | thisFontSubsetTag /= 26; |
| 474 | } |
| 475 | subsetTagData[6] = '+'; |
| 476 | return subsetTag; |
| 477 | } |
| 478 | |
| 479 | PDFIndirectReference PDFDocumentImpl::emit(const PDFObject& object, PDFIndirectReference ref) { |
| 480 | object.emitObject(this->beginObject(ref)); |