🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.next.programmer
3 messages
3 total messages Started by Paul Hagstrom Mon, 07 Sep 1992 04:20
Why is my PostScript text upside down? Help! Help!
#801
Author: Paul Hagstrom
Date: Mon, 07 Sep 1992 04:20
32 lines
1718 bytes
Ok, I'm at a loss.. I've got a plotting program that I'm trying to write, and  
here's what's happening..

I am trying to draw a grid, and on that grid I am tryint to draw numbers.  So,  
what I do is this:

	PSmoveto(0,grid);
	sprintf(buffer,"(0.00,%f7.2)",grid);
	PSshow(buffer);
	
Easy enough.  Now, the problem is this: ALL OF THE TEXT IS UPSIDE DOWN!  It is  
reflected vertically from what it should be.  Now, of course, the first thing  
to think is: oh!  The coordinates must be flipped!  But, [self isFlipped]  
returns NO, and I never specifically tell it to setFlipped:YES, which,  
according to the documentation, I should have to do explicitly if the  
coordinates are to be flipped.

What can I do?  PSrotate(180.0) won't solve my problem because then I get  
numbers that a right-side-up, but backwards!  What I need to do is reflect them  
vertically, and I'm not sure how.  I don't want to flip the coordinates just to  
print the text (that seems unwise, and in the documentation, it is said that  
setFlipped: should only be called once -- preferably before drawing, like in an  
initialization routine) and then flip them back to continue with the program,  
do I?

Help!

Thanks to anyone who knows immediately what my problem is and can tell me..
--
schmotsignature.
Paul Hagstrom
(hagstrop@carleton.edu)
Re: Why is my PostScript text upside down? Help! Help!
#806
Author: Robert D. Nicholson
Date: Mon, 07 Sep 1992 09:01
138 lines
5459 bytes
Heres what my archived News OD had on this matter, all attempts to
mail the poster failed and I thought we should all see this.

Can't wait for those News/ftp archive CD's to come. :-)

From: gbol@rglnext.geol.vt.edu (Gregory Lampshire)
Subject: NXSplitView and displaying text using PSshow()---it's upside down!
Date: 2 May 92 18:06:48 GMT
Sender: usenet@vtserf.cc.vt.edu

I've been fiddling with NXSplitView by placing two views as subviews and  
then placing a label in the corner using PSshow() and PSmoveto().   
Unfortunately, the text comes out backward/upside down.  I thought that  
this was caused by the flipped orientation of the split view but the  
vertical placement of the text appears to be proper for the locations I am  
indicating, that is, the subviews of split view don't have flipped axes  
also.

How do I flip the text again? A code snippet is below.  The problem does  
not appear to be caused by the split view's flipped vertical axis since  
the subviews have properly oriented axes.  This method belongs to the  
subview class that are under the split view:


-drawSelf:(const NXRect*)rects :(int)rectCount
{
    NXRect aRect=rects[0];

    NXDrawGrayBezel(&aRect, NULL);
    NXSetColor(theColor);
    NXInsetRect(&aRect, RECESSWIDTH, RECESSWIDTH);
    NXRectFill(&aRect); 

    // add the text
    PSsetrgbcolor(1.0, 1.0, 1.0);
    PSmoveto(10.0,NX_HEIGHT(&aRect)-10.0);
    PSshow(label);

    return self;
}


Gregory Lampshire
Va Tech
Bradley Dept of EE
laural@vttcf.cc.vt.edu
gbol@rglnext.geol.vt.edu (NeXTmail welcome)

From: jayson@asw.com (Jayson Adams)
Subject: Re: NXSplitView and displaying text using PSshow()---it's upside down!
Date: 4 May 92 06:38:00 GMT
References: <3882@vtserf.cc.vt.edu>
Sender: jayson@asw.com

In article <3882@vtserf.cc.vt.edu> gbol@rglnext.geol.vt.edu (Gregory  
Lampshire) writes:
> 
> 
> I've been fiddling with NXSplitView by placing two views as subviews and  
> then placing a label in the corner using PSshow() and PSmoveto().   
> Unfortunately, the text comes out backward/upside down....
> 
> How do I flip the text again?
> 

You should do your text drawing with a TextFieldCell or a Text object.   
It's a little slower because of clipping (although I suppose you could  
turn that off), but a lot less hassle and you get other benefits (e.g.  
your app will draw Kanji glyphs when run on a Kanji system, whereas apps  
that issue raw PostScript to generate text will not "just work").

__jayson

From: drew@fnbc.com (Drew Davidson)
Subject: Re: NXSplitView and displaying text using PSshow()---it's upside down!
Date: 4 May 92 18:40:10 GMT
References: <3882@vtserf.cc.vt.edu>
Sender: news@fnbc.com

In article <3882@vtserf.cc.vt.edu> gbol@rglnext.geol.vt.edu (Gregory Lampshire) 
 
writes:
> 
> 
> I've been fiddling with NXSplitView by placing two views as subviews and  
> then placing a label in the corner using PSshow() and PSmoveto().   
> Unfortunately, the text comes out backward/upside down.  I thought that  
> this was caused by the flipped orientation of the split view but the  
> vertical placement of the text appears to be proper for the locations I am  
> indicating, that is, the subviews of split view don't have flipped axes  
> also.
> 
> How do I flip the text again? A code snippet is below.  The problem does  
> not appear to be caused by the split view's flipped vertical axis since  
> the subviews have properly oriented axes.  This method belongs to the  
> subview class that are under the split view:
> 
> 
> -drawSelf:(const NXRect*)rects :(int)rectCount
> {
>   NXRect aRect=rects[0];
> 
>   NXDrawGrayBezel(&aRect, NULL);
>   NXSetColor(theColor);
>   NXInsetRect(&aRect, RECESSWIDTH, RECESSWIDTH);
>   NXRectFill(&aRect); 
> 
>   // add the text
>   PSsetrgbcolor(1.0, 1.0, 1.0);
>   PSmoveto(10.0,NX_HEIGHT(&aRect)-10.0);
# ifdef GLEN_REID
# define FONT_NAME      "Lithos-Bold"
# else
# define FONT_NAME      "Helvetica"
# endif
        font = [Font newFont:FONT_NAME
                        size:10
                      matrix:NX_IDENTITYMATRIX];
        [font set];
>   PSshow(label);
> 
>   return self;
> }
> 

This is crude because the font should be newFont'd somewhere else, but you  
should get he idea.  The fontMatrix can be the identity (for non-flipped views  
like yours) or NX_FLIPPEDMATRIX for flipped views.  Have fun!

--
+--------------------------------+------------------------------------------+
|        Drew  Davidson          | "Whining is anger coming through a small |
|         Software Guy           |  opening."                               |
| First National Bank of Chicago |            - Stuart Smalley              |
|     drew@fnbc.com  (NeXTmail)  |              Caring Nurturer             |
+--------------------------------+------------------------------------------+

You can also you PSselectfont if you insist on using PSShow
Re: Why is my PostScript text upside down? Help! Help!
#886
Author: Glenn Reid
Date: Wed, 09 Sep 1992 10:32
34 lines
1554 bytes
Paul Hagstrom writes

> Easy enough.  Now, the problem is this: ALL OF THE TEXT IS UPSIDE DOWN!  It  
is  
> reflected vertically from what it should be.  Now, of course, the first  
thing  
> to think is: oh!  The coordinates must be flipped!  But, [self isFlipped]  
> returns NO, and I never specifically tell it to setFlipped:YES, which,  
> according to the documentation, I should have to do explicitly if the  
> coordinates are to be flipped.

If your text is flipped but the rest of it is okay (which you don't say
explicitly, but which seems to be the case), then you can fix it by
asking for your font differently.

If you use the Font object (which you should) there are two ways to get a
new font:

  myFont = [Font newFont:"Helvetica" size:24.0];

  myFont = [Font newFont:"Helvetica" size:24.0 matrix:NX_FLIPPEDMATRIX];

Take your pick.  Use whichever you're not using at the moment :-)

Then just

  [myFont set];
  PSmoveto ( 10.0, 10.0 );
  PSshow("Hello world");

--
 Glenn Reid        		NeXTmail: glenn@rightbrain.com
 RightBrain Software		415-326-2974 (NeXTfax 326-2977)
 Palo Alto, California
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads