emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

calculation of text extents [Re: Memory leak]


From: Kenichi Handa
Subject: calculation of text extents [Re: Memory leak]
Date: Sat, 24 May 2008 11:30:40 +0900
User-agent: SEMI/1.14.3 (Ushinoya) FLIM/1.14.2 (Yagi-Nishiguchi) APEL/10.2 Emacs/23.0.60 (i686-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO)

In article <address@hidden>, Jason Rumney <address@hidden> writes:

> A while ago I noticed w32font_open being called multiple times for the 
> same font, so I suspect that we may be overlooking the font cache in 
> places and reopening fonts when we could be reusing an existing font.

With the recent fix of font-cache handling, I think the
number of calling `open' callback of a font-backend for the
same font is reduced.  Can you confirm that?

> There is another similar problem when we get text extents - each redraw 
> cycle can call w32font_text_extents a number of times for the same 
> glyph_string (from compute_glyph_string_overhangs, left_overwriting and 
> right_overwriting in quick succession in draw_glyphs, with nested 
> compute_overhangs_and_x within some of the if statements that cause 
> extra calls for preceding and following glyph_strings if there is 
> overhang, which there often is with antialising enabled). Perhaps this 
> operation is cheap with the X font backends, but on Windows it is 
> expensive (even with caching of metrics), and I suspect this is a major 
> cause of the slowdown reported by Windows users.

It seems that we can reduce the number of calling
`text_extents' callback by recording lbearing and rbearing
in struct glyph; which grows the size of that structure from
the current 32-byte to 36-byte.  I'm not sure how much that
change impacts the memory usage of Emacs, but isn't it worth
trying?

---
Kenichi Handa
address@hidden




reply via email to

[Prev in Thread] Current Thread [Next in Thread]