diff --git a/src/calibre/ebooks/pdf/html_writer.py b/src/calibre/ebooks/pdf/html_writer.py index d42188de83..e73964c877 100644 --- a/src/calibre/ebooks/pdf/html_writer.py +++ b/src/calibre/ebooks/pdf/html_writer.py @@ -840,7 +840,7 @@ def convert(opf_path, opts, metadata=None, output_path=None, log=default_log, co merge_fonts(pdf_doc) num_removed = dedup_type3_fonts(pdf_doc) if num_removed: - log('Removed', num_removed, 'unused Type3 glyphs') + log('Removed', num_removed, 'duplicated Type3 glyphs') # TODO: Support for mathematics diff --git a/src/calibre/utils/podofo/fonts.cpp b/src/calibre/utils/podofo/fonts.cpp index f12a0b46a9..cc9b59707b 100644 --- a/src/calibre/utils/podofo/fonts.cpp +++ b/src/calibre/utils/podofo/fonts.cpp @@ -359,30 +359,28 @@ merge_fonts(PDFDoc *self, PyObject *args) { class CharProc { char *buf; pdf_long sz; PdfReference ref; - std::size_t precomputed_hash; CharProc( const CharProc & ) ; CharProc & operator=( const CharProc & ) ; public: - CharProc(const PdfReference &reference, const PdfObject *o) : buf(NULL), sz(0), ref(reference), precomputed_hash(0) { + CharProc(const PdfReference &reference, const PdfObject *o) : buf(NULL), sz(0), ref(reference) { const PdfStream *stream = o->GetStream(); stream->GetFilteredCopy(&buf, &sz); - precomputed_hash = std::hash()(sz); } CharProc(CharProc &&other) noexcept : - buf(other.buf), sz(other.sz), ref(other.ref), precomputed_hash(other.precomputed_hash) { + buf(other.buf), sz(other.sz), ref(other.ref) { other.buf = NULL; } CharProc& operator=(CharProc &&other) noexcept { if (buf) podofo_free(buf); - buf = other.buf; other.buf = NULL; sz = other.sz; ref = other.ref; precomputed_hash = other.precomputed_hash; + buf = other.buf; other.buf = NULL; sz = other.sz; ref = other.ref; return *this; } ~CharProc() noexcept { if (buf) podofo_free(buf); buf = NULL; } bool operator==(const CharProc &other) const noexcept { return other.sz == sz && memcmp(buf, other.buf, sz) == 0; } - std::size_t hash() const noexcept { return precomputed_hash; } + std::size_t hash() const noexcept { return sz; } const PdfReference& reference() const noexcept { return ref; } };