Commit 5048bec5 authored by Oliver Sander's avatar Oliver Sander

Bugfix: Do not disregard Ref::gen when using Ref as a cache key

According to Leonard Rosenthol's book, the 'gen' field of a
reference is almost always zero.  However, this doesn't mean that
it can be ignored when comparing two Refs.

Incidentally, this patch also makes use of the recently introduced
Ref::operator<, which allows to replace the small custom class
ArthurFontID by a std::pair.
parent 7e9b6f1d
......@@ -220,20 +220,8 @@ private:
ArthurType3Font* m_currentType3Font;
std::stack<ArthurType3Font*> m_type3FontStack;
// Identify a font by its 'Ref' and its font size
struct ArthurFontID
{
Ref ref;
double fontSize;
bool operator<(const ArthurFontID& other) const
{
return (ref.num < other.ref.num)
|| ((ref.num == other.ref.num) && (fontSize < other.fontSize));
}
};
// Cache all fonts
using ArthurFontID = std::pair<Ref,double>;
std::map<ArthurFontID,std::unique_ptr<QRawFont> > m_rawFontCache;
std::map<ArthurFontID,std::unique_ptr<ArthurType3Font> > m_type3FontCache;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment