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/CHANGELOG.md +15 -0
- package/binding.gyp +24 -9
- package/package.json +3 -2
- package/scripts/download-harfbuzz.mjs +166 -0
- package/scripts/download-mozjpeg.mjs +1 -0
- package/scripts/download-qpdf.mjs +8 -1
- package/scripts/install.mjs +1 -0
- package/src/content.cc +291 -0
- package/src/content.h +6 -0
- package/src/encoding_tables.h +42 -0
- package/src/font_subset.cc +128 -425
- package/src/font_subset.h +17 -7
- package/src/fonts.cc +1209 -0
- package/src/fonts.h +5 -0
- package/src/hash_utils.h +15 -0
- package/src/images.cc +156 -132
- package/src/images.h +20 -2
- package/src/jpeg.cc +6 -0
- package/src/jpeg.h +1 -0
- package/src/optimize.h +5 -13
- package/src/qpdf_addon.cc +137 -55
- package/src/strip.cc +391 -0
- package/src/strip.h +9 -0
- package/src/structure.cc +346 -0
- package/src/structure.h +7 -0
- package/src/optimize.cc +0 -1048
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
|
|
9
|
-
// glyph 0 (.notdef) is always retained.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
|
15
|
-
// returns a set of glyph IDs that correspond to the given
|
|
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);
|