[comp.windows.x] A wish for R5

vojta@powdermilk.berkeley.edu (Paul Vojta) (05/09/91)

I hope it's not too late to suggest something, but it would be very helpful
(at least for xdvi and the like) to have another X call for putting bitmaps.
Quoting from the man page for XDrawString,

	"the drawable is only modified where the font character
	 has a bit set to 1."

What I am suggesting would be an XDrawBitmap() call to provide the same
functionality for drawing bitmaps.

Or, allowing clients to download fonts would also suffice for this purpose.

--Paul Vojta, vojta@math.berkeley.edu

mouse@lightning.mcrcim.mcgill.EDU (der Mouse) (05/09/91)

> [I]t would be very helpful ([...]) to have another X call for putting
> bitmaps.  Quoting from the man page for XDrawString,

>	"the drawable is only modified where the font character
>	 has a bit set to 1."

> What I am suggesting would be an XDrawBitmap() call to provide the
> same functionality for drawing bitmaps.

You can get this effect by setting the bitmap as the clip-mask in a GC
and doing a FillRectangle operation.  You can get a similar effect
(with, unfortunately, more potential for visual anomalies) by doing two
CopyPlane operations with appropriate values in the GCs:

#1: foreground=0, background=~0, function=GXand
#2: foreground=desired fg, background=0, function=GXor

However, this second way may be faster, because many servers'
implementation of clip-masks is grossly inefficient when the clip-mask
does not decompose neatly into rectangles (and most font glyphs don't).

If your pixel values satisfy one of the relationships

	(fg & bg) == bg
	(fg & bg) == fg

then you can get away with using just one CopyPlane operation.  (This
seems like a special case, but I would guess, and it is a guess, that
it's common enough to be worth checking for.  Certainly every 1-bit
display qualifies.)

> Or, allowing clients to download fonts would also suffice for this
> purpose.

I got the impression from Jim Getty's talk at the X conference last
January that R5 will contain much-improved font mechanisms that are
capable of addressing this desire.  I certainly hope so.

					der Mouse

			old: mcgill-vision!mouse
			new: mouse@larry.mcrcim.mcgill.edu

john@acorn.co.uk (John Bowler) (05/09/91)

In article <1991May8.234851.576@agate.berkeley.edu> vojta@powdermilk.berkeley.edu (Paul Vojta) writes:
>I hope it's not too late to suggest something, but it would be very helpful
>(at least for xdvi and the like) to have another X call for putting bitmaps.
>Quoting from the man page for XDrawString,
>
>	"the drawable is only modified where the font character
>	 has a bit set to 1."
>
>What I am suggesting would be an XDrawBitmap() call to provide the same
>functionality for drawing bitmaps.

Use XCopyPlane twice with the bitmap as the source.  The first time use the
raster op GXandInverted (sp?) with a foreground pixel value of ~0 (all bits
set) and a background of 0 to clear destination pixels (effectively using
the bitmap as an inverted mask).  The second time use GXor and set the
foreground to the desired pixel value, leave the background as 1.

If the foreground value is 0 (no bits set) omit the second step.  If the
foreground value is ~0 (all bits set) omit the first step.  If using a plane
mask just consider the set bits in the plane mask when working out this
optimisation.

>Or, allowing clients to download fonts would also suffice for this purpose.

And be more efficient when the operation really does correspond to a set of
glyphs... as in xdvi.  IMHO it would also be better than using font servers;
part of the problem for an application installing a font is dealing with
the services which do the installation (currently a font compiler and a font
path set operation, but possibly in the future a font server).  A protocol
extension is probably no more complex than the extensions to handle the font
server (in both the X server and for a new font server ``protocol''), and
could be very easy to use:-

	fontid = CreateFont(name,type)
	for-all-characters
		DefineCharacter(fontid,index,size_etc,bits)
	CompleteFont(fontid)
	<use the font>
	DestroyFont(fontid)

John Bowler (jbowler@acorn.co.uk)

marbru@auto-trol.com (Martin Brunecky) (05/10/91)

In article <6922@acorn.co.uk> john@acorn.co.uk (John Bowler) writes:
>In article <1991May8.234851.576@agate.berkeley.edu> vojta@powdermilk.berkeley.edu (Paul Vojta) writes:
>>I hope it's not too late to suggest something, but it would be very helpful
>>(at least for xdvi and the like) to have another X call for putting bitmaps.
>
>Use XCopyPlane twice with the bitmap as the source.  The first time use the
>....
   I'd try to use area fill with the "font" bitmap as a STIPPLE MASK
   - it would be a single drawing op, though the efficiency depends
     upon the server .....

>>Or, allowing clients to download fonts would also suffice for this purpose.
>
>And be more efficient when the operation really does correspond to a set of
>glyphs... as in xdvi.  IMHO it would also be better than using font servers;
>part of the problem for an application installing a font is dealing with
>the services which do the installation (currently a font compiler and a font
>path set operation, but possibly in the future a font server).  A protocol
>extension is probably no more complex than the extensions to handle the font
>server (in both the X server and for a new font server ``protocol''), and
>could be very easy to use:-
>
    Yep, I asked for this one so many times .... but I was always told
    that the "font server" will cure all my needs (and more).
    I don't buy it. IMHO the font server will create about as many
    problems as it will solve (though I am not oposed to the font
    server concept, I think the font downloading extension is still needed).



-- 
=*= Opinions presented here are solely of my own and not those of Auto-trol =*=
Martin Brunecky                      marbru%auto-trol@sunpeaks.central.sun.com
(303) 252-2499                       (better avoid:  marbru@auto-trol.COM )
Auto-trol Technology Corp. 12500 North Washington St., Denver, CO 80241-2404