unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Tom Seddon <emacs@tomseddon.plus.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 6364@debbugs.gnu.org
Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW	fails.
Date: Tue, 26 Nov 2013 19:39:37 +0000	[thread overview]
Message-ID: <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> (raw)
In-Reply-To: <83pppn9hjm.fsf@gnu.org>

On 26 Nov 2013, at 17:52, Eli Zaretskii <eliz@gnu.org> wrote:

>> From: Tom Seddon <emacs@tomseddon.plus.com>
>> Date: Tue, 26 Nov 2013 00:35:05 +0000
>> 
>> Please find below a patch to improve the poor scrolling performance when using bitmap fonts. #14721 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14721) and and 14307 (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=14307) may also be affected. The patch has been tested against emacs 24.3. It applied cleanly to git head (22687e54e0e4d7c73c098417478574a55393fe2c) but I haven't built it.
>> 
>> Performance with particularly long lines is still rather poor, but general responsiveness is much improved. (Once the buffer is fontified, emacs can now usually keep up if I hold down PgUp, PgDn, C-s, etc.)
> 
> Thanks, but can you please provide a reproducible test case, including
> the font where the slow scrolling happens?  I don't see any fonts
> named in these bug reports.

Certainly. I've uploaded some test cases to http://www.tomseddon.plus.com/.emacs/bug6364.tar.gz.

To reproduce:

0. visit Control Panel, Keyboard, Speed tab, and move the Repeat rate slider all the way to "Fast". Click OK.

1. unpack bug6364.tar.gz somewhere

2. install fixed.fon (its name in the fonts list will be "fixed")

3. start shell and change to folder containing contents of bug6364.tar.gz

4. start emacs: emacs -Q -l start-ok.el. You should see emacs load a file, set Courier New (a truetype font) as the display font, and put point at the end of the file. Once it's loaded, hold PgUp. Note adequate scrolling responsiveness.

5. start emacs: emacs -Q -l start-slow.el. You should see emacs load again, but this time with fixed.fon (a bitmap font). Once again, once it's loaded, hold PgUp. On my PC, once it gets to about 94% of the way through the file, the screen just stops updating. Once you stop holding the key, after a brief pause, emacs catches up again.

With my patch, both cases are pretty much the same.

Try also the other included file, 16384. This doesn't have any .el files associated with it I'm afraid as it was just a quick thing I made to see what performance with longer lines was like. It's 16,384 lines of 700-odd chars each. It's supposed to be viewed with fixed.fon, and truncate-lines off. Start emacs with emacs -Q 16384, then shift+click on the buffer to select the font.

Without my patch, at the top of the file, moving the cursor downwards from screen line to screen line is responsive, but moving it upwards is terribly slow; with my patch, at the top of the file, moving the cursor in either direction is responsive.

With or without my patch, cursor responsiveness moving upwards is poor towards the end of the file.

> 
>> (I settled on GetCharABCWidthsFloatW because it works for bitmap fonts and TrueType fonts alike. But the key thing is simply not to create a DC each time w32font_text_extents is called, so there are various other functions that could be called instead if preferred.)
> 
> Are there other possibilities to fix this, without using
> GetCharABCWidthsFloatW?  The problem with that function is that it is
> not available on Windows 9X (in the unicows.dll library), so this
> problem will be left unsolved on those systems.

I couldn't find a good list when I was writing the code so I just went by DUMPBIN /EXPORTS and spotted it as export #158. (Don't ask me why I've got any copies at all on my Windows 7 PC! - I expect some program installed it just in case.)

I've found an official (if outdated-looking) list now. So if GetCharABCWidthsFloatW ends up your only objection, I'll update the code to use a function from the official list. 

Thanks,

--Tom






  reply	other threads:[~2013-11-26 19:39 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-06 18:39 bug#6364: Windows: Emacs 23 slow with long lines and raster fonts bogossian
2013-11-26  0:35 ` bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails Tom Seddon
2013-11-26 17:52   ` Eli Zaretskii
2013-11-26 19:39     ` Tom Seddon [this message]
2013-11-26 20:20       ` Eli Zaretskii
2013-11-26 20:30         ` Tom Seddon
2013-11-26 20:48           ` Eli Zaretskii
2013-11-26 21:50             ` Tom Seddon
2013-11-26 21:53               ` Tom Seddon
2013-11-29 11:05               ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com \
    --to=emacs@tomseddon.plus.com \
    --cc=6364@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).