DrawVectorText() can also multiline output

Just starting out? Need help? Post your questions and find answers here.
Mesa
Enthusiast
Enthusiast
Posts: 349
Joined: Fri Feb 24, 2012 10:19 am

[Done]DrawVectorText() can also multiline output

Post by Mesa »

Done.
Freak gave the answer.
Only single-line text is supported everywhere. If it works on some OS you cannot rely on it because this may change in the future.
M.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: DrawVectorText() can also multiline output

Post by Saki »

I see no solution in this statement.

If it works differently than the manual says, one of them is wrong, but not both are right.



.
地球上の平和
Mesa
Enthusiast
Enthusiast
Posts: 349
Joined: Fri Feb 24, 2012 10:19 am

Re: DrawVectorText() can also multiline output

Post by Mesa »

Do you want me to change the sentence ?
Remarks

This function draws single lines of text only. Multiple calls must be made to draw multiple lines. Use VectorTextWidth() and VectorTextHeight() to determine the dimensions of the text to draw in order to properly align the text with other content.

The DrawVectorParagraph() function can be used to draw a larger block of text with automatic layout such as line breaks. This function is more suited for drawing multiline text.
by
Remarks

This function draws single lines of text only. Multiple calls must be made to draw multiple lines because line feed (#LF$, chr(10)) and carriage return (#CR$, chr(13)) will not be taken into account.

The DrawVectorParagraph() function can be used to draw a larger block of text with automatic layout such as line breaks. This function is more suited for drawing multiline text.
I think it's redundant but is that what you want?

M.
M.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: DrawVectorText() can also multiline output

Post by Saki »

It is the same with VectorParagraphHeight()

There it can be really annoying because the text heights are calculated differently.

But it does not matter, you can handle it.
But you have to know it then.

It will probably not change anyway.

Best Regards Saki
地球上の平和
Mesa
Enthusiast
Enthusiast
Posts: 349
Joined: Fri Feb 24, 2012 10:19 am

Re: DrawVectorText() can also multiline output

Post by Mesa »

Ok, no change.
Done.
User avatar
Saki
Addict
Addict
Posts: 830
Joined: Sun Apr 05, 2020 11:28 am
Location: Pandora

Re: DrawVectorText() can also multiline output

Post by Saki »

Here look how fatal this can be.

Code: Select all

EnableExplicit
; Windows
Define font_ID=LoadFont(#PB_Any, "", 11)
Define image_ID=CreateImage(#PB_Any, 16, 16)
Define text$="aaa"+#LF$+"bbbb"+#LF$+"ccccc"+#LF$+"dddddd"+#LF$+"eeeeeee"
text$+text$+text$+text$+text$+text$+text$+text$+text$+text$
StartVectorDrawing(ImageVectorOutput(image_ID))
VectorFont(FontID(font_ID))
Debug "Text width "+VectorTextWidth(text$)
Debug "Text height false "+Str(VectorTextHeight(text$)*CountString(text$, #LF$)+1)
Debug "Text height ok "+Str(VectorTextHeight(" ")*CountString(text$, #LF$)+1)
StopVectorDrawing()
地球上の平和
Post Reply