From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tom Seddon Newsgroups: gmane.emacs.bugs Subject: bug#6364: [PATCH] Use GetCharABCWidthsFloatW if GetGlyphOutlineW fails. Date: Tue, 26 Nov 2013 19:39:37 +0000 Message-ID: <3E4E896E-71DC-402F-A572-E65A4AB621FA@tomseddon.plus.com> References: <8CCD3BEBEE756DD-DB8-DFB9@web-mmc-m08.sysops.aol.com> <713BA87B-E38A-4777-B054-E136A7C96EF9@tomseddon.plus.com> <83pppn9hjm.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1385494819 20547 80.91.229.3 (26 Nov 2013 19:40:19 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 26 Nov 2013 19:40:19 +0000 (UTC) Cc: 6364@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Nov 26 20:40:23 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VlOUf-0003ZL-WE for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Nov 2013 20:40:22 +0100 Original-Received: from localhost ([::1]:60661 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlOUf-0000wI-Lk for geb-bug-gnu-emacs@m.gmane.org; Tue, 26 Nov 2013 14:40:21 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlOUX-0000w1-LV for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2013 14:40:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VlOUS-0003hR-BL for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2013 14:40:13 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VlOUS-0003hI-8X for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2013 14:40:08 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VlOUM-0006r9-62 for bug-gnu-emacs@gnu.org; Tue, 26 Nov 2013 14:40:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Tom Seddon Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Nov 2013 19:40:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 6364 X-GNU-PR-Package: emacs,w32 X-GNU-PR-Keywords: patch Original-Received: via spool by 6364-submit@debbugs.gnu.org id=B6364.138549478726327 (code B ref 6364); Tue, 26 Nov 2013 19:40:02 +0000 Original-Received: (at 6364) by debbugs.gnu.org; 26 Nov 2013 19:39:47 +0000 Original-Received: from localhost ([127.0.0.1]:46381 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlOU6-0006qY-Eq for submit@debbugs.gnu.org; Tue, 26 Nov 2013 14:39:46 -0500 Original-Received: from caiajhbdcaid.dreamhost.com ([208.97.132.83]:45303 helo=homiemail-a85.g.dreamhost.com) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VlOU4-0006qP-1g for 6364@debbugs.gnu.org; Tue, 26 Nov 2013 14:39:45 -0500 Original-Received: from homiemail-a85.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTP id EEFF8BC04A; Tue, 26 Nov 2013 11:39:42 -0800 (PST) Original-Received: from [192.168.1.101] (tomseddon.plus.com [212.159.116.120]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: tom@ouro.ltd.uk) by homiemail-a85.g.dreamhost.com (Postfix) with ESMTPSA id 5C252BC047; Tue, 26 Nov 2013 11:39:40 -0800 (PST) In-Reply-To: <83pppn9hjm.fsf@gnu.org> X-Mailer: Apple Mail (2.1822) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81007 Archived-At: On 26 Nov 2013, at 17:52, Eli Zaretskii wrote: >> From: Tom Seddon >> Date: Tue, 26 Nov 2013 00:35:05 +0000 >>=20 >> Please find below a patch to improve the poor scrolling performance = when using bitmap fonts. #14721 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14721) and and 14307 = (http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D14307) 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. >>=20 >> 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.) >=20 > 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. >=20 >> (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.) >=20 > 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.=20 Thanks, --Tom