qpdf-compress 0.6.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/font_subset.h CHANGED
@@ -3,15 +3,25 @@
3
3
  #include <cstddef>
4
4
  #include <cstdint>
5
5
  #include <set>
6
+ #include <string>
6
7
  #include <vector>
7
8
 
8
- // subset a TrueType font binary (TTF), keeping only the specified glyph IDs.
9
- // glyph 0 (.notdef) is always retained. returns true on success.
10
- bool subsetTrueTypeFont(const uint8_t *data, size_t size,
11
- const std::set<uint16_t> &usedGlyphIds,
12
- std::vector<uint8_t> &output);
9
+ // subset a font binary (TrueType or CFF/OpenType), keeping only the specified
10
+ // glyph IDs. glyph 0 (.notdef) is always retained.
11
+ // when preserveCmap is false, the cmap table may be subset or dropped (suitable
12
+ // for CID fonts where PDF viewers use /CIDToGIDMap instead).
13
+ // returns true on success.
14
+ bool subsetFont(const uint8_t *data, size_t size,
15
+ const std::set<uint16_t> &usedGlyphIds,
16
+ std::vector<uint8_t> &output, bool preserveCmap = true);
13
17
 
14
- // map character codes to glyph IDs using the font's cmap table.
15
- // returns a set of glyph IDs that correspond to the given character codes.
18
+ // map Unicode code points to glyph IDs using HarfBuzz's cmap lookup.
19
+ // returns a set of glyph IDs that correspond to the given Unicode code points.
16
20
  std::set<uint16_t> mapCodesToGlyphIds(const uint8_t *data, size_t size,
17
21
  const std::set<uint16_t> &charCodes);
22
+
23
+ // map glyph names (e.g. "germandbls", "Adieresis") to glyph IDs using
24
+ // HarfBuzz. returns a set of glyph IDs for the given glyph names.
25
+ std::set<uint16_t>
26
+ mapGlyphNamesToGlyphIds(const uint8_t *data, size_t size,
27
+ const std::vector<std::string> &names);