home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #20 / NN_1992_20.iso / spool / comp / sys / next / programm / 6029 < prev    next >
Encoding:
Text File  |  1992-09-08  |  5.2 KB  |  152 lines

  1. Newsgroups: comp.sys.next.programmer
  2. Path: sparky!uunet!munnari.oz.au!bruce.cs.monash.edu.au!monu6!ede978e
  3. From: ede978e@monu6.cc.monash.edu.au (Robert D. Nicholson)
  4. Subject: Re: Why is my PostScript text upside down? Help! Help!
  5. Message-ID: <1992Sep7.090125.27930@monu6.cc.monash.edu.au>
  6. Organization: Monash University, Caulfield Campus
  7. References: <lalm3pINNpm5@news.bbn.com>
  8. Date: Mon, 7 Sep 1992 09:01:25 GMT
  9. Lines: 141
  10.  
  11. Heres what my archived News OD had on this matter, all attempts to
  12. mail the poster failed and I thought we should all see this.
  13.  
  14. Can't wait for those News/ftp archive CD's to come. :-)
  15.  
  16. From: gbol@rglnext.geol.vt.edu (Gregory Lampshire)
  17. Subject: NXSplitView and displaying text using PSshow()---it's upside down!
  18. Date: 2 May 92 18:06:48 GMT
  19. Sender: usenet@vtserf.cc.vt.edu
  20.  
  21. I've been fiddling with NXSplitView by placing two views as subviews and  
  22. then placing a label in the corner using PSshow() and PSmoveto().   
  23. Unfortunately, the text comes out backward/upside down.  I thought that  
  24. this was caused by the flipped orientation of the split view but the  
  25. vertical placement of the text appears to be proper for the locations I am  
  26. indicating, that is, the subviews of split view don't have flipped axes  
  27. also.
  28.  
  29. How do I flip the text again? A code snippet is below.  The problem does  
  30. not appear to be caused by the split view's flipped vertical axis since  
  31. the subviews have properly oriented axes.  This method belongs to the  
  32. subview class that are under the split view:
  33.  
  34.  
  35. -drawSelf:(const NXRect*)rects :(int)rectCount
  36. {
  37.     NXRect aRect=rects[0];
  38.  
  39.     NXDrawGrayBezel(&aRect, NULL);
  40.     NXSetColor(theColor);
  41.     NXInsetRect(&aRect, RECESSWIDTH, RECESSWIDTH);
  42.     NXRectFill(&aRect); 
  43.  
  44.     // add the text
  45.     PSsetrgbcolor(1.0, 1.0, 1.0);
  46.     PSmoveto(10.0,NX_HEIGHT(&aRect)-10.0);
  47.     PSshow(label);
  48.  
  49.     return self;
  50. }
  51.  
  52.  
  53. Gregory Lampshire
  54. Va Tech
  55. Bradley Dept of EE
  56. laural@vttcf.cc.vt.edu
  57. gbol@rglnext.geol.vt.edu (NeXTmail welcome)
  58.  
  59. From: jayson@asw.com (Jayson Adams)
  60. Subject: Re: NXSplitView and displaying text using PSshow()---it's upside down!
  61. Date: 4 May 92 06:38:00 GMT
  62. References: <3882@vtserf.cc.vt.edu>
  63. Sender: jayson@asw.com
  64.  
  65. In article <3882@vtserf.cc.vt.edu> gbol@rglnext.geol.vt.edu (Gregory  
  66. Lampshire) writes:
  67. > I've been fiddling with NXSplitView by placing two views as subviews and  
  68. > then placing a label in the corner using PSshow() and PSmoveto().   
  69. > Unfortunately, the text comes out backward/upside down....
  70. > How do I flip the text again?
  71.  
  72. You should do your text drawing with a TextFieldCell or a Text object.   
  73. It's a little slower because of clipping (although I suppose you could  
  74. turn that off), but a lot less hassle and you get other benefits (e.g.  
  75. your app will draw Kanji glyphs when run on a Kanji system, whereas apps  
  76. that issue raw PostScript to generate text will not "just work").
  77.  
  78. __jayson
  79.  
  80. From: drew@fnbc.com (Drew Davidson)
  81. Subject: Re: NXSplitView and displaying text using PSshow()---it's upside down!
  82. Date: 4 May 92 18:40:10 GMT
  83. References: <3882@vtserf.cc.vt.edu>
  84. Sender: news@fnbc.com
  85.  
  86. In article <3882@vtserf.cc.vt.edu> gbol@rglnext.geol.vt.edu (Gregory Lampshire) 
  87.  
  88. writes:
  89. > I've been fiddling with NXSplitView by placing two views as subviews and  
  90. > then placing a label in the corner using PSshow() and PSmoveto().   
  91. > Unfortunately, the text comes out backward/upside down.  I thought that  
  92. > this was caused by the flipped orientation of the split view but the  
  93. > vertical placement of the text appears to be proper for the locations I am  
  94. > indicating, that is, the subviews of split view don't have flipped axes  
  95. > also.
  96. > How do I flip the text again? A code snippet is below.  The problem does  
  97. > not appear to be caused by the split view's flipped vertical axis since  
  98. > the subviews have properly oriented axes.  This method belongs to the  
  99. > subview class that are under the split view:
  100. > -drawSelf:(const NXRect*)rects :(int)rectCount
  101. > {
  102. >   NXRect aRect=rects[0];
  103. >   NXDrawGrayBezel(&aRect, NULL);
  104. >   NXSetColor(theColor);
  105. >   NXInsetRect(&aRect, RECESSWIDTH, RECESSWIDTH);
  106. >   NXRectFill(&aRect); 
  107. >   // add the text
  108. >   PSsetrgbcolor(1.0, 1.0, 1.0);
  109. >   PSmoveto(10.0,NX_HEIGHT(&aRect)-10.0);
  110. # ifdef GLEN_REID
  111. # define FONT_NAME      "Lithos-Bold"
  112. # else
  113. # define FONT_NAME      "Helvetica"
  114. # endif
  115.         font = [Font newFont:FONT_NAME
  116.                         size:10
  117.                       matrix:NX_IDENTITYMATRIX];
  118.         [font set];
  119. >   PSshow(label);
  120. >   return self;
  121. > }
  122.  
  123. This is crude because the font should be newFont'd somewhere else, but you  
  124. should get he idea.  The fontMatrix can be the identity (for non-flipped views  
  125. like yours) or NX_FLIPPEDMATRIX for flipped views.  Have fun!
  126.  
  127. --
  128. +--------------------------------+------------------------------------------+
  129. |        Drew  Davidson          | "Whining is anger coming through a small |
  130. |         Software Guy           |  opening."                               |
  131. | First National Bank of Chicago |            - Stuart Smalley              |
  132. |     drew@fnbc.com  (NeXTmail)  |              Caring Nurturer             |
  133. +--------------------------------+------------------------------------------+
  134.  
  135. You can also you PSselectfont if you insist on using PSShow
  136.  
  137.  
  138.  
  139.