|
Post by flotul on Feb 2, 2019 9:40:56 GMT -5
Hi there,
Is there any way to make text appear vertically for, i.e., charts?
Rog'
|
|
|
Post by tenochtitlanuk on Feb 2, 2019 12:46:36 GMT -5
This may give you some ideas- but note it is much harder if you actually want the LETTERS turned sideways!
nomainwin
WindowWidth = 400 WindowHeight = 400
open "Graphics" for graphics_nsb as #wg
#wg "trapclose [quit]"
#wg "fill lightgray ; backcolor lightgray"
for i =1 to 10 call verticalText "Example",_ ' Desired text int( 20 +360 *rnd( 1)), int( 20 +160 *rnd( 1)),_ ' Position "Courier_New bold",_ ' Font 8 +int( 20 *rnd( 1)),_ ' Font size randCol$() ' Font colour next i
#wg "flush"
wait
[quit] close #wg end
function randCol$() R =int( 256 *rnd( 1)) R$ =str$( R) G$ ="120" B$ =str$( 256 -R) randCol$ =R$ +" " +G$ +" " +B$ end function
sub verticalText text$, xPos, yPos, fontName$, fontSize, colour$ #wg "color "; colour$ #wg "font "; fontName$; " "; fontSize
for j =1 to len( text$) #wg "up ; goto "; xPos; " "; yPos +fontSize *1.5 *( j -1); " ; down" #wg "\"; mid$( text$, j, 1); next j end sub
|
|
|
Post by tenochtitlanuk on Feb 2, 2019 15:48:41 GMT -5
Written for fun some time ago- calling the sub in various ways...
|
|
|
Post by mknarr on Feb 3, 2019 10:32:08 GMT -5
I do it on a graph but the window is a graphic window. I could post code if necessary.
|
|
|
Post by flotul on Feb 6, 2019 13:19:11 GMT -5
Thanks, I'll give it a try with the "hori-vertical" text like in post #2 ;-)
|
|
|
Post by jkintn on Feb 7, 2019 15:47:14 GMT -5
In a graphics window, print the text horizontally, determine the pixel locations of a rectangle that enclose the just-printed text, determine a rectangular block of pixels to place the text vertically, read the horizontal box (pixel by pixel) and, successively, color the appropriate pixel in the vertical box. I needed the forum to instruct me as to how to determine the color (R,G,B) of an individual pixel. It worked for my purpose, but was slow and a task in subscript accountability. The original horizontal rectangle can be back-ground colored as you read through the pixel locations (simultaneously filling the vertical rectangle with the text turned 90 degrees upright). This gave me a label for the vertical axis in a Y vs X plot. There are likely easier ways to accomplish the task. You might find a routine to print text at any angle you choose (I remember seeing that somewhere).
|
|