Lisp HUG Maillist Archive

Minor query?

I have an application that wants to display text on a graphics output pane. I want to produce the +/- symbol, which in the ASCII set on Windows is character code 177(?). This works just fine on Windows. But on OS X, LW balks at the translation across the FLI, stating that it isn't an ASCII code (maybe so...). 

So, how can I make these extended symbols appear in an output pane? I'm using a COCOA call across the FLI so that I can have text at arbitrary angles, instead of always horizontal. But in this case, I only need horizontal text. So perhaps CAPI has a way already. But in any event it must be calling COCOA, and so I'm asking how you do that character translation across the FLI and manage to avoid the error condition?

Dr. David McClain
Chief Technical Officer
Refined Audiometrics Laboratory
4391 N. Camino Ferreo
Tucson, AZ  85750

email: dbm@refined-audiometrics.com
phone: 1.520.390.3995
web: http://refined-audiometrics.com



Re: Minor query?

Unable to parse email body. Email id is 10793

Re: Minor query?


On Dec 10, 2010, at 8:20 PM, David McClain wrote:

> Rather, I draw a normal horizontal text into an offscreen buffer, then transpose it in memory before transferring to the output pane.

Can't you do the same in cocoa capi using an offscreen pane with a 90 degree rotated graphics-transform, gp:make-image-from-port (from the original output pane), gp:draw-image (which should then be rotated 90 degrees into the offscreen pane), gp:draw-string (to the offscreen), and gp:draw-image along with with-graphics-transform (to copy the 90 degree rotated result back to the original ouput pane the right way up)?

It's not clear from the docs, but doesn't gp:draw-image support rotation under cocoa? I know it supports scaling (the docs say so)- and I've been using it do do supersampled drawing to work around the integer coordinate constraint of gp:draw-polygon.

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro@me.com






Re: Minor query?


On Dec 11, 2010, at 10:24 AM, David McClain wrote:

> GP does support rotations for geometric objects, but not text strings.

I was not suggesting that you can draw the text string rotated - as you say, you can't.

Rather, I was suggesting that you:

1. use gp:make-image-from-port to capture your port contents (or a rectangular portion thereof large enough to display your intended vertical string, calculated using gp:get-font-height and gp:get-font-width and the length of the string).

2. use a transform (rotated 90 degrees clockwise) to draw this copied image  into an offscreen pane.

3. draw the normal, unrotated string into the offscreen pane on top of your 90 degree rotated copied pane contents.

4. use gp:make-image-from-port again, this time to copy the contents of the offscreen port.

5. draw the resulting image into the original pane using an inverse transform (rotated 90 degrees counter-clockwise), which should result in a vertical string. 


If capi under cocoa supports graphics state transforms with rotation for gp:draw-image this should work.

warmest regards,

Ralph

Raffael Cavallaro
raffaelcavallaro@me.com






Re: Minor query?


On Dec 11, 2010, at 11:55 PM, David McClain wrote:

> Yes, that was my first approach some several years ago. It looks quite inferior in the presence of vector-based Display PDF.

Right - I've been working around this by doing supersampling. Not as clean as the native cocoa drawing, but generally usable, especially if you do 4x supersampling. Of course 4x capi supersampling is kind of slow...

warmest regards,

Ralph


Raffael Cavallaro
raffaelcavallaro@me.com






Updated at: 2020-12-10 08:38 UTC