Article View: comp.sys.next.programmer
Article #806Re: Why is my PostScript text upside down? Help! Help!
From: Robert D. Nicholson
Date: Mon, 07 Sep 1992 09:01
Date: Mon, 07 Sep 1992 09:01
138 lines
5459 bytes
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
Technical Details
Message-ID:
<1992Sep7.090125.27930@monu6.cc.monash.edu.au>Path:
arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978eReferences:
<lalm3pINNpm5@news.bbn.com>Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978e From: ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson) Subject: Re: Why is my PostScript text upside down? Help! Help! Message-ID: <1992Sep7.090125.27930@monu6.cc.monash.edu.au> Organization: Monash University, Caulfield Campus References: <lalm3pINNpm5@news.bbn.com> Date: Mon, 7 Sep 1992 09:01:25 GMT Lines: 141