On Fri, Dec 01, 2006 at 04:12:25PM -0000, [EMAIL PROTECTED] wrote:
> +int GuiFontMetrics::ascent(char_type c) const
> +{
> + unsigned short val = static_cast<unsigned short>(c);
> + if (metrics_cache_[val].ascent == -1000)
> + fillCache(val);
> +
> + return metrics_cache_[val].ascent;
> +}
How does that work with characters outside the 16 bit range?
> +#ifdef USE_LYX_FONTCACHE
> + /// fill in \c metrics_cache_ at specified value.
> + void fillCache(unsigned short val) const;
> /// Cache of char widths
> - mutable int widthcache_[65536];
> + /** This cache adds 20Mo of memory to the LyX executable when
> + * loading UserGuide.lyx which contains a good number of fonts. If
> + * this turns out to be too much, we can switch to a \c QHash based
> + * solution.
> + **/
> + mutable CharMetrics metrics_cache_[65536];
20Mb is too expensive in my opinion. WHy don't we restrict the cache to
the ascii range?
> Modified: lyx-devel/trunk/src/dimension.h
> URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/dimension.h?rev=16124
> ==============================================================================
> --- lyx-devel/trunk/src/dimension.h (original)
> +++ lyx-devel/trunk/src/dimension.h Fri Dec 1 17:12:24 2006
> @@ -12,6 +12,7 @@
> #ifndef DIMENSION_H
> #define DIMENSION_H
>
> +#include "support/types.h"
>
> namespace lyx {
I am not too happy with additional includes in the basic headers.
> @@ -25,6 +26,8 @@
> /// initialize data
> Dimension(int w, int a, int d) : wid(w), asc(a), des(d) {}
>
> + Dimension(LyXFont const & font, char_type c) { set(font, c); }
What is wrong with the standalon function we used earlier
(mathed_char_dim or such, name could be changed, of course)
> Modified: lyx-devel/trunk/src/rowpainter.C
> URL: http://www.lyx.org/trac/file/lyx-devel/trunk/src/rowpainter.C?rev=16124
> ==============================================================================
> --- lyx-devel/trunk/src/rowpainter.C (original)
> +++ lyx-devel/trunk/src/rowpainter.C Fri Dec 1 17:12:24 2006
> @@ -949,7 +949,7 @@
> rp.paintChangeBar();
> if (rit == rb)
> rp.paintFirst();
> - rp.paintText();
> + rp.paintText();
> if (rit + 1 == re)
> rp.paintLast();
Why that?
Andre'