DrawVectorText(), DrawVectorParagraph() is different result

Just starting out? Need help? Post your questions and find answers here.
damn
New User
New User
Posts: 9
Joined: Wed Mar 07, 2018 11:12 am

DrawVectorText(), DrawVectorParagraph() is different result

Post by damn »

Hi all.

I'm having a trouble on use DrawVectorText() and DrawVectorParagraph() for drawing some text on CanvasGadget. On attached screenshot you can see different quality at result ("Push the button..." and following text paragraph). If use DrawVectorParagraph() - quality is fine, but if use DrawVectorText() - quality is very bad. Text is too smooth and blurred and looking terrible.

Anybody know, how to fix this? I can use only DrawVectorParagraph() for drawing single or multiline strings, but this is bad practics i think.

PB 5.60, Win 10 Pro x64

Image
damn
New User
New User
Posts: 9
Joined: Wed Mar 07, 2018 11:12 am

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by damn »

Simple code for tests

Code: Select all

EnableExplicit

Enumeration
	#window
	#canvas
	#font
EndEnumeration

Define string.s = "The quick brown fox jumped over the lazy doc"

If OpenWindow(#window, 0, 0, 320, 240, "Test window", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
	
	CanvasGadget(#canvas, 0, 0, 320, 240)
	
	LoadFont(#font, "Consolas", 14)
	
	If StartVectorDrawing(CanvasVectorOutput(#canvas))
		
		VectorFont(FontID(#font), 14)
		VectorSourceColor(RGBA(0, 0, 0, 255))
		
		MovePathCursor(5, 5)
		DrawVectorText(string.s)
		
		MovePathCursor(5, 30)
		DrawVectorParagraph(string.s, 320, 205)
		
		StopVectorDrawing()

	EndIf
	
	Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow

EndIf
Phantomas
User
User
Posts: 96
Joined: Wed Jul 01, 2009 12:59 pm

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by Phantomas »

Windows 7 x64 confirm:
Image
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by walbus »

Very interesting,
it look, its a additional interpolation
I think, self you can here make nothing
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by Demivec »

Try adding 0.5 to the test coordinates for DrawVectorText().
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by walbus »

Yeah, that fixes it....
srod
PureBasic Expert
PureBasic Expert
Posts: 10589
Joined: Wed Oct 29, 2003 4:35 pm
Location: Beyond the pale...

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by srod »

Not fixed here; Win 7, PB 5.62x64.
I may look like a mule, but I'm not a complete ass.
RASHAD
PureBasic Expert
PureBasic Expert
Posts: 4946
Joined: Sun Apr 12, 2009 6:27 am

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by RASHAD »

Maybe it is related to ResetCoordinates() bug
http://www.purebasic.fr/english/viewtop ... vector+lib

Try

Code: Select all

     ResetCoordinates()
      MovePathCursor(5, 5)
      DrawVectorText(string.s)
      
      MovePathCursor(5, 30)
      DrawVectorParagraph(string.s, 320, 205)
Egypt my love
walbus
Addict
Addict
Posts: 929
Joined: Sat Mar 02, 2013 9:17 am

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by walbus »

I have tested on 561 / 562 Win10 x64

It doesn't matter, it's not okay
User avatar
STARGÅTE
Addict
Addict
Posts: 2227
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: DrawVectorText(), DrawVectorParagraph() is different res

Post by STARGÅTE »

I have to push this topic, because similar problems occur in different ways through different operating systems:

There are obvious quality issues under Windows 10 with the DrawVectorText() function.
Further the way how kerning is used is different in DrawVectorText(), AddPathText() and DrawVectorParagraph() as well as on different operating systems:

Windows 7:
Image

Windows 10:
Image

Ubuntu:
Image

As you can see, kerning is active under Ubuntu for all drawings, kerning is non-active under Windows7 for all drawings, but on Windows 10, kerning is active only in AddPathText().
Further the quality of DrawVectorText() under Windows 10 is worse compared to other OS or other drawing techniques.

It seems like, PureBasic uses in some cases only the default properties for drawings, but I think in some cases PureBasic have to force flags for properties like anti-aliasing, kerning or compositing quality to result in same results in all cases.

Code: Select all

Enumeration
	#Window
	#Gadget
	#Font
EndEnumeration


LoadFont(#Font, "DejaVu Sans", 32, #PB_Font_HighQuality)
OpenWindow(#Window, 0, 0, 1150, 180, "Vector Canvas Gadget", #PB_Window_MaximizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
CanvasGadget(#Gadget, 0, 0, WindowWidth(#Window), WindowHeight(#Window), #PB_Canvas_Keyboard)

If StartVectorDrawing(CanvasVectorOutput(#Gadget))
	VectorSourceColor($FF202020)
	FillVectorOutput()
	VectorSourceColor($FF0080FF)
	VectorFont(FontID(#Font), 12)
	MovePathCursor(5, 5)
	DrawVectorParagraph("DrawVectorText:", 300, 20)
	MovePathCursor(5, 60)
	DrawVectorParagraph("AddPathText:", 300, 20)
	MovePathCursor(5, 115)
	DrawVectorParagraph("DrawVectorParagraph:", 300, 20)
	VectorSourceColor($FFE0E0E0)
	VectorFont(FontID(#Font), 14)
	MovePathCursor(20, 20)
	DrawVectorText("AVAVAVAVAVAVAV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.")
	MovePathCursor(20, 40)
	DrawVectorText("AAAAAAAVVVVVVV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.")
	MovePathCursor(20, 75)
	AddPathText("AVAVAVAVAVAVAV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.")
	FillPath()
	MovePathCursor(20, 95)
	AddPathText("AAAAAAAVVVVVVV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.")
	FillPath()
	MovePathCursor(20, 130)
	DrawVectorParagraph("AVAVAVAVAVAVAV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.", 1200, 200)
	MovePathCursor(20, 150)
	DrawVectorParagraph("AAAAAAAVVVVVVV Du kannst den Anzeigebereich mit gedrückter Mittelmaustaste verschieben und mit dem Mausrad den Ausschnitt vergrößern/verkleiner.", 1200, 200)
	StopVectorDrawing()
EndIf

Repeat
	Select WaitWindowEvent()
		Case #PB_Event_CloseWindow
			Break
	EndSelect
ForEver

End
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
Rinzwind
Enthusiast
Enthusiast
Posts: 679
Joined: Wed Mar 11, 2009 4:06 pm
Location: NL

Re: DrawVectorText(), DrawVectorParagraph() is different result

Post by Rinzwind »

Is this getting attention? Guess not, but it should.
User avatar
skywalk
Addict
Addict
Posts: 4211
Joined: Wed Dec 23, 2009 10:14 pm
Location: Boston, MA

Re: DrawVectorText(), DrawVectorParagraph() is different result

Post by skywalk »

Yeah, I just build paragraphs the hard way. This is an old problem.
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Post Reply