Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!sdd.hp.com!think.com!mintaka!electron!andru From: andru@electron.lcs.mit.edu (Andrew Myers) Newsgroups: comp.sys.sgi Subject: Re: disappearing text? Message-ID: <1991May7.214610.6728@mintaka.lcs.mit.edu> Date: 7 May 91 21:46:10 GMT References: <1171@gistdev.gist.com> <1991May7.193349.16623@neon.Stanford.EDU> Sender: news@mintaka.lcs.mit.edu Distribution: comp Organization: MIT Laboratory for Computer Science Lines: 55 In article <1991May7.193349.16623@neon.Stanford.EDU> loan@neon.Stanford.EDU (James P. Loan) writes: >In article <1171@gistdev.gist.com> dan@gistdev.gist.com (Dan Schreiber) writes: >> I'm having a very strange problem with printing out text strings >>to a graphics window. The problem is that part of a text string is >>missing, or sometimes the whole string, after drawing the window. It happens >>rarely enough to be non-reproducible, but often enough to be concerned about >>it. > >Excuse the me-tooism, but I thought I should mention that I have been >having *exactly* the same problem, also on a PI (3.3.1). This should One thing to remember about imaging character strings is that character strings are subject to "gross clipping". If the transformed location of the start of the string is outside the current viewport, the entire string will be clipped! This happens because the character string has point size as far as the transformation engines are concerned. To avoid this problem, you can use "fine clipping" via the scrmask() call. That is, set your viewport to be larger than the current window, and use scrmask() to do the actual clipping. Here is an example: getsize(&sx,&sy); viewport(-MARGIN, sx - 1 + MARGIN, -MARGIN, sy - 1 + MARGIN); scrmask(0, sx - 1, 0, sy - 1); ortho2(-0.5 - MARGIN, sx - 0.5 + MARGIN, -0.5 - MARGIN, sy - 0.5 + MARGIN); __ screenmask, window borders / -------------/------- | / | --- | ------------- | __ viewport | | | | | / | | | | |/ sy | | | | | | | | | | | | |<->| MARGIN --- | ------------- | | MARGIN | --------------------- |---- sx ---| Where you can adjust MARGIN to allow character strings to start as far outside the current viewport as you like. A value of 64 is usually satisfactory. Note that viewport() always resets the current screenmask, so you have to call scrmask() afterwards. Note also that viewport() and scrmask() take pixel indices, whereas ortho2() supplies world coordinates for the edges of the viewport(). Hence the MARGINs in the ortho2 call. This allows points to be transformed into the entire viewport area, but only made visible if they fall within the screenmask. Andrew