X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Ffrontends%2Fqt4%2FGuiFontMetrics.h;h=3f50dfe5d29902d0516e2b27c3ca2ec32fa4d4e4;hb=28be7d552f62cc02fa86d7f79201d089bfb2d7b5;hp=1e813f6af180534ec80687ee151a2ca36c6a1b4d;hpb=b26b90ae0e2a967c1d6bb05619c09e8408336e6b;p=lyx.git diff --git a/src/frontends/qt4/GuiFontMetrics.h b/src/frontends/qt4/GuiFontMetrics.h index 1e813f6af1..3f50dfe5d2 100644 --- a/src/frontends/qt4/GuiFontMetrics.h +++ b/src/frontends/qt4/GuiFontMetrics.h @@ -14,13 +14,15 @@ #include "frontends/FontMetrics.h" +#include "support/Cache.h" #include "support/docstring.h" -#include -#include #include #include #include +#include + +#include namespace lyx { namespace frontend { @@ -56,13 +58,25 @@ public: int & ascent, int & descent) const; virtual void buttonText(docstring const & str, + const int offset, int & width, int & ascent, int & descent) const; + + int countExpanders(docstring const & str) const; /// int width(QString const & str) const; + /// Return a pointer to a cached QTextLayout object + std::shared_ptr + getTextLayout(docstring const & s, bool const rtl, + double const wordspacing) const; + private: + + std::pair breakAt_helper(docstring const & s, int const x, + bool const rtl, bool const force) const; + /// The font QFont font_; @@ -71,9 +85,12 @@ private: /// Cache of char widths mutable QHash width_cache_; - /// Cache of string widths - mutable QCache strwidth_cache_; + mutable Cache strwidth_cache_; + /// Cache for breakAt + mutable Cache> breakat_cache_; + /// Cache for QTextLayout + mutable Cache> qtextlayout_cache_; struct AscendDescend { int ascent; @@ -86,6 +103,7 @@ private: /// Cache of char right bearings mutable QHash rbearing_cache_; + }; } // namespace frontend