Page 1 of 1

DrawVectorText(), DrawVectorParagraph() is different result

Posted: Wed Mar 07, 2018 11:25 am
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

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

Posted: Wed Mar 07, 2018 12:17 pm
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

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

Posted: Wed Mar 07, 2018 12:28 pm
by Phantomas
Windows 7 x64 confirm:
Image

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

Posted: Wed Mar 07, 2018 12:34 pm
by walbus
Very interesting,
it look, its a additional interpolation
I think, self you can here make nothing

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

Posted: Wed Mar 07, 2018 4:02 pm
by Demivec
Try adding 0.5 to the test coordinates for DrawVectorText().

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

Posted: Wed Mar 07, 2018 4:10 pm
by walbus
Yeah, that fixes it....

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

Posted: Thu Mar 08, 2018 9:28 am
by srod
Not fixed here; Win 7, PB 5.62x64.

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

Posted: Thu Mar 08, 2018 1:13 pm
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)

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

Posted: Thu Mar 08, 2018 1:35 pm
by walbus
I have tested on 561 / 562 Win10 x64

It doesn't matter, it's not okay

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

Posted: Sun Mar 14, 2021 4:12 pm
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

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

Posted: Fri Apr 15, 2022 8:25 am
by Rinzwind
Is this getting attention? Guess not, but it should.

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

Posted: Fri Apr 15, 2022 12:07 pm
by skywalk
Yeah, I just build paragraphs the hard way. This is an old problem.