Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

workaround for stringshape print bug (Real Studio getting started Mailinglist archive)

Back to the thread list
Previous thread: Re: Windows KeyCodes
Next thread: making a rect visible to show focus


RB Database   -   tom.russell transport.alstom.com
  workaround for stringshape print bug   -   GAmoore aol.com
   Re: workaround for stringshape print bug   -   Paul Rehill
    Re: workaround for stringshape print bug   -   GAmoore aol.com
     Re: workaround for stringshape print bug   -   Paul Rehill

workaround for stringshape print bug
Date: 01.02.06 05:22 (Wed, 1 Feb 2006 04:22:51 EST)
From: GAmoore aol.com
I came up with this rough example which seems to be a workaround for the
print bug where rotated text in stringshapes prints all black. However, its pretty
inefficient - and noticably slow for larger bugger sizes. Does anyone have a
better idea?
Greg

//(g is passed in as a graphic object, p is a buffer)
dim p as Picture
dim xw, yh as integer
xw = 200
yh = 40
p = NewPicture( xw, yh, Screen(0).Depth)
If p <> Nil then
t = "FGRBK" // these characters are chosen because they are not
symmetrical
p.Graphics.TextSize = 21
p.Graphics.ForeColor = &cffFF00
p.Graphics.FillRect 0,0,p.Width,p.Height
p.Graphics.ForeColor = &cFF0000
p.Graphics.DrawString t, 15, 20
end if
// now loop pixel by pixel to transpose the graphic (note i,j in opposite
orders)
for i = 0 to xw -1
for j = 0 to yh-1
g.DrawPicture p, 200 + j, 200 - i, 1, 1,i, j, 1, 1
next
next
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: workaround for stringshape print bug
Date: 01.02.06 10:32 (Wed, 1 Feb 2006 20:32:18 +1100)
From: Paul Rehill
Did you look up that thread I dated in my reply 11 hours ago. I found it a
month ago when I needed to label a y-axis vertically and the rotated text
printed as a black rectangle. Joe's solution there solves this problem.

Sub DrawVerticalString(g As graphics, Text1 As String, XPos As Integer, YPos
As Integer, iScale As Integer=1)
Dim StrSh as New StringShape
Dim p as picture
Dim h, w As Integer
StrSh.Text=Text1
StrSh.TextFont="Times New Roman"
StrSh.TextSize=app.DefFontSize*iScale
StrSh.Rotation=ToRad(270)
StrSh.FillColor=RGB(0,0,255)
g.TextFont=StrSh.TextFont
g.TextSize=StrSh.TextSize
h=g.stringWidth(StrSh.Text)
w=g.textHeight
p=newPicture(w,h,32)
p.graphics.DrawObject StrSh, 3*iScale+w/2, h/2
g.DrawPicture p, XPos-2*iScale-w/2, YPos-h/2
End Sub

I have some custom variables/functions in there that are irrelevant but I'm
sure you'll be able to work out what's relevant.

On 2/1/06, <email address removed> <<email address removed>> wrote:

> I came up with this rough example which seems to be a workaround for the
> print bug where rotated text in stringshapes prints all black. However,
> its pretty
> inefficient - and noticably slow for larger bugger sizes. Does anyone have
> a
> better idea?
> Greg
>
> //(g is passed in as a graphic object, p is a buffer)
> dim p as Picture
> dim xw, yh as integer
> xw = 200
> yh = 40
> p = NewPicture( xw, yh, Screen(0).Depth)
> If p <> Nil then
> t = "FGRBK" // these characters are chosen because they are not
> symmetrical
> p.Graphics.TextSize = 21
> p.Graphics.ForeColor = &cffFF00
> p.Graphics.FillRect 0,0,p.Width,p.Height
> p.Graphics.ForeColor = &cFF0000
> p.Graphics.DrawString t, 15, 20
> end if
> // now loop pixel by pixel to transpose the graphic (note i,j in
> opposite
> orders)
> for i = 0 to xw -1
> for j = 0 to yh-1
> g.DrawPicture p, 200 + j, 200 - i, 1, 1,i, j, 1, 1
> next
> next
> _______________________________________________
>
> --
> Paul Rehill
> mathsteacher.com.au
> RB 5.5.5 Mac Pro, Mac OS 10.3.6
> RB 5.5.5 Win Standard, Win XP SP2
> Plugins used: MBS
> RealBasic resources: RB Developer, Matt Neuburg's RB book
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: workaround for stringshape print bug
Date: 01.02.06 12:47 (Wed, 1 Feb 2006 11:47:37 EST)
From: GAmoore aol.com
Thanks Paul, but how does this solve the problem? It still relies on the
stringshape. (My method did not.) Is it the fact that you're drawing to a buffer
then to the main graphic?
Greg

> Sub DrawVerticalString(g As graphics, Text1 As String, XPos As Integer,
> YPos
> As Integer, iScale As Integer=3D1)
>   Dim StrSh as New StringShape
>   Dim p as picture
>   Dim h, w As Integer
>   StrSh.Text=3DText1
>   StrSh.TextFont=3D"Times New Roman"
>   StrSh.TextSize=3Dapp.DefFontSize*iScale
>   StrSh.Rotation=3DToRad(270)
>   StrSh.FillColor=3DRGB(0,0,255)
>   g.TextFont=3DStrSh.TextFont
>   g.TextSize=3DStrSh.TextSize
>   h=3Dg.stringWidth(StrSh.Text)
>   w=3Dg.textHeight
>   p=3DnewPicture(w,h,32)
>   p.graphics.DrawObject StrSh, 3*iScale+w/2, h/2
>   g.DrawPicture p, XPos-2*iScale-w/2, YPos-h/2
> End Sub
>
>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Re: workaround for stringshape print bug
Date: 01.02.06 21:13 (Thu, 2 Feb 2006 07:13:21 +1100)
From: Paul Rehill
Yes, the buffer solves the problem. There is discussion about it in the
Rotated Text thread from Dec 2004.

On 2/2/06, <email address removed> <<email address removed>> wrote:
>
> Thanks Paul, but how does this solve the problem? It still relies on the
> stringshape. (My method did not.) Is it the fact that you're drawing to a
> buffer
> then to the main graphic?
> Greg
>
> > Sub DrawVerticalString(g As graphics, Text1 As String, XPos As Integer,
> > YPos
> > As Integer, iScale As Integer=3D1)
> > Dim StrSh as New StringShape
> > Dim p as picture
> > Dim h, w As Integer
> > StrSh.Text=3DText1
> > StrSh.TextFont=3D"Times New Roman"
> > StrSh.TextSize=3Dapp.DefFontSize*iScale
> > StrSh.Rotation=3DToRad(270)
> > StrSh.FillColor=3DRGB(0,0,255)
> > g.TextFont=3DStrSh.TextFont
> > g.TextSize=3DStrSh.TextSize
> > h=3Dg.stringWidth(StrSh.Text)
> > w=3Dg.textHeight
> > p=3DnewPicture(w,h,32)
> > p.graphics.DrawObject StrSh, 3*iScale+w/2, h/2
> > g.DrawPicture p, XPos-2*iScale-w/2, YPos-h/2
> > End Sub
>
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>