[ to the real mcclim-devel address, this time ]
Hi,
Find attached a preliminary patch to deal with the fact that, in general, glyphs from fonts are not constrained to draw only to the right of the cursor position.
This patch does not correct any of the assumptions about horizontal left-to-right rendering or single-line rendering. However, it attempts to cater for all cases which are currently functional, for the CLX backend (both with ordinary X fonts and with the experimental Freetype bindings). It is probably fairly tricky to trigger problems without this patch using the ordinary X fonts, but using the Bitstream Vera family of fonts in climacs for a little while tends to degrade the display as incremental-redisplay fails to erase the entirety of glyphs (because the bounding rectangle is wrong).
It works by introducing a new internal function, TEXT-BOUNDING-RECTANGLE*, which is somewhat analogous to TEXT-SIZE and STREAM-STRING-WIDTH, only capable of dealing with non-zero offsets. TEXT-BOUNDING-RECTANGLE* returns the coordinates of a bounding rectangle that would bound the output of DRAW-TEXT* at position 0 0 and with :ALIGN-X and ALIGN-Y taking their default values. It is entirely possible that I have miscalculated some of the other cases in DEF-GRECORDING DRAW-TEXT: caveat user.
With this patch, I was no longer able to trigger disastrous redraw effects on simple climacs editing operations; previously, entering " ___" on a line, putting point at the start of the line and then hitting the space bar a few times would leave a trail of pixels as the output records for almost all the text would move (on my display here, with my freetype options, the #_ character has an active pixel at -1).
The real test case for this is the tablature editor, which is using a font designed such that the centres of characters are at (0,0); unfortunately, I'm not in a position to run it right now, but with luck we'll be able to test this tomorrow (and extend this work to the Postscript backend: maintainers of other backends should chime in at this point to indicate whether this solution is acceptable and implementable :-).
Cheers,
Christophe
Christophe Rhodes csr21@cam.ac.uk writes:
Find attached a preliminary patch to deal with the fact that, in general, glyphs from fonts are not constrained to draw only to the right of the cursor position.
A revised patch is attached, which is still not commit-worthy but fixes the opposite-problem as well: glyphs which draw beyond their advance width. (Thanks to Dave Murray aka JQS for testing).
The current plan is for us here at Goldsmiths to perform a little more testing and extend it to the PostScript backend. I suppose that the logical thing to do is to call TEXT-BOUNDING-RECTANGLE* a backend function and require backends to implement it for their backend-medium.
This imposes a maintenance burden on those interested in the OpenGL and beagle backends, but I hope not a terrible one. I note, from the screenshot at http://www.bloodandcoffee.net/campbell/climacs-beagle-porn.png for example, that there seem to be similar redraw artifacts in the beagle backend in any case, so it could well be that an implementation of text-bounding-rectangle* there clears those up. (Is anyone out there using the OpenGL backend?)
Cheers,
Christophe
Christophe Rhodes csr21@cam.ac.uk writes:
Christophe Rhodes csr21@cam.ac.uk writes:
Find attached a preliminary patch to deal with the fact that, in general, glyphs from fonts are not constrained to draw only to the right of the cursor position.
A revised patch is attached, which is still not commit-worthy but fixes the opposite-problem as well: glyphs which draw beyond their advance width. (Thanks to Dave Murray aka JQS for testing).
The current plan is for us here at Goldsmiths to perform a little more testing and extend it to the PostScript backend. I suppose that the logical thing to do is to call TEXT-BOUNDING-RECTANGLE* a backend function and require backends to implement it for their backend-medium.
Well, for what it's worth, we did this, I performed some light testing (using clim-demo::postscript-test), and I've committed our work so far.
This imposes a maintenance burden on those interested in the OpenGL and beagle backends, but I hope not a terrible one. I note, from the screenshot at http://www.bloodandcoffee.net/campbell/climacs-beagle-porn.png for example, that there seem to be similar redraw artifacts in the beagle backend in any case, so it could well be that an implementation of text-bounding-rectangle* there clears those up. (Is anyone out there using the OpenGL backend?)
This remains true: the beagle, OpenGL (and CLX with #+unicode, if that's not dead code) backends are currently broken. Sorry. To fix them, the function climi::text-bounding-rectangle* needs to be implemented, which should return the bounding-rectangle of a draw-text command at 0,0 with :x-align :left and :y-align :baseline. (If all else fails, this can be faked with a call to TEXT-SIZE, with the caveat that then redraw artifacts as in the above screenshot will remain.)
Cheers,
Christophe
Christophe Rhodes wrote:
[snip]
Well, for what it's worth, we did this, I performed some light testing (using clim-demo::postscript-test), and I've committed our work so far.
When i update, I don't get the new changes to Backends/CLX/medium.lisp.
The other files in the patch seems ok, just missing medium.lisp.
[goblin:~/lisp/libraries/mcclim/Backends/CLX]$cvs upd ? clim-extensions.fasl ? frame-manager.fasl ? graft.fasl ? image.fasl ? keysymdef.fasl ? keysyms-common.fasl ? keysyms.fasl ? medium.fasl ? package.fasl ? port.fasl cvs server: Updating . [goblin:~/lisp/libraries/mcclim/Backends/CLX]$cvs status medium.lisp =================================================================== File: medium.lisp Status: Up-to-date
Working revision: 1.66 Repository revision: 1.66 /project/mcclim/cvsroot/mcclim/Backends/CLX/medium.lisp,v Sticky Tag: (none) Sticky Date: (none) Sticky Options: (none)
[goblin:~/lisp/libraries/mcclim/Backends/CLX]$grep "text-bounding-rec" * [goblin:~/lisp/libraries/mcclim/Backends/CLX]$
Peter Mechlenborg metch@daimi.au.dk writes:
Christophe Rhodes wrote:
[snip]
Well, for what it's worth, we did this, I performed some light testing (using clim-demo::postscript-test), and I've committed our work so far.
When i update, I don't get the new changes to Backends/CLX/medium.lisp.
The other files in the patch seems ok, just missing medium.lisp.
Whoops. I've committed it now. Sorry.
Cheers,
Christophe