[fa.info-mac] quickdraw glitch when drawing text in srcCopy mode

info-mac@uw-beaver (info-mac) (07/17/84)

From: Bill Croft <croft@safe>
Date: Sat, 14 Jul 84 17:52:08 edt
From: winkler@harvard.ARPA (Dan Winkler)

The DrawChar and DrawString procedures draw
several extra spaces after the char or string they're supposed to
draw when the TextMode is something
other than srcOr, like srcCopy, and the background is something other
than white, like gray.  Here is a short program that demonstrates the
problem:

#include "mac/quickdraw.h"

struct QDVar QDVar ;

main()
{
     int delay ;

     QD = & QDVar ; InitGraf( & thePort ) ; InitFonts() ; InitWindows() ;  

     FillRect(&thePort->portBits.bounds, &(QD->gray));  TextMode ( srcCopy ) ;

     MoveTo ( 50, 50 ) ; DrawChar ('A') ;
     MoveTo ( 50, 70 ) ; DrawString ("Test") ;

     for ( delay = 0 ; delay < 100000 ; delay ++ ) ; ExitToShell() ;
}

From: winkler@harvard.ARPA (Dan Winkler)
Subject: the answer

I took this question directly to the man who should know.  "Sorry about
that" said Bill Atkinson.  I told him it was ok.

SrcCopy is not a fully supported mode for text, he explained, because
of problems that arise with kerning and italics.  For example, in the
string "Jeff", the tail of the first f could curve under and clobber
the corner of the e.  So if you want to draw text in copy mode, you
should erase the rectangle that bounds it and then draw it using or
mode.  But text drawing using or mode is so highly optimized in
QuickDraw, he said, that this is still about as fast as a fully
supported copy mode could ever be.  The amount of white space you see
after a character is, by the way, just the amount you need to account
for the worst possible slant of an italic character.

Dan.