ClearType and vector text rendering.

Post bugreports for the Windows version here
User avatar
❤x1
User
User
Posts: 49
Joined: Thu Jan 10, 2019 5:56 pm

ClearType and vector text rendering.

Post by ❤x1 »

Hello o/

On Windows, PureBasic seems to render text using ClearType, except in one case :
Image
As you can see, when drawing text using DrawVectorParagraph, everything works as expected, but with DrawVectorText, colors are lost.

It might not seem all that important, but it's bad enough that a user with slight visual impairment can't use my software and asked if this was remediable.

Code for the comparison above :

Code: Select all

If OpenWindow(0, 0, 0, 400, 470, "Font rendering", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
	CanvasGadget(0, 0, 0, 400, 470, #PB_Canvas_Container)
	LoadFont(0, "Arial", 20, #PB_Font_HighQuality)
	
	If StartVectorDrawing(CanvasVectorOutput(0))
		VectorFont(FontID(0))
		
		MovePathCursor(10, 9)
		DrawVectorText(~"VectorText:\nThe quick brown fox\njumps over the lazy dog")
		
		MovePathCursor(10, 120)
		DrawVectorParagraph(~"VectorParagraph:\nThe quick brown fox\njumps over the lazy dog",400, 200)
		StopVectorDrawing()
		
		StartDrawing(CanvasOutput(0))
		DrawingMode(#PB_2DDrawing_Transparent)
		FrontColor($000000)
		
		DrawingFont(FontID(0))
		DrawText(10, 230, "RasterText:")
		DrawText(10, 263, "The quick brown fox")
		DrawText(10, 296, "jumps over the lazy dog")
		StopDrawing()
		
		TextGadget(1, 10, 345, 400, 200, ~"TextGadget:\nThe quick brown fox\njumps over the lazy dog")
		SetGadgetColor(1, #PB_Gadget_BackColor, $FFFFFF)
		SetGadgetColor(1, #PB_Gadget_FrontColor, $000000)
		SetGadgetFont(1, FontID(0))
	EndIf
	
	Repeat
		Event = WaitWindowEvent()
	Until Event = #PB_Event_CloseWindow
EndIf
User avatar
STARGÅTE
Addict
Addict
Posts: 2228
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: ClearType and vector text rendering.

Post by STARGÅTE »

I reported a similar issue:
DrawVectorText(), DrawVectorParagraph() is different res

Especially, the different render widths are terrible when I try to render a bounding boxes.
However, I think it is related to GDI+ used here on windows.
Don't know, if PureBasic can change the right settings.
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
User avatar
❤x1
User
User
Posts: 49
Joined: Thu Jan 10, 2019 5:56 pm

Re: ClearType and vector text rendering.

Post by ❤x1 »

STARGÅTE wrote: Wed Apr 12, 2023 7:03 pm However, I think it is related to GDI+ used here on windows.
I think I can make an educated guess here : DrawVectorText is a simple wrapper of AddPathText + fillpath and that's why the colors are lost.

I tried to keep the issue focused on colors because I hope the fix is reasonably simple, but it sure gets worse once you take the shape into account.
Vector text is ignoring user settings and render the text the same everywhere.
Here is a comparison with my ClearType settings re-enabled :
Image
DrawText cut the end of some characters and is a bit bold, but it's closer to what it's supposed to be. The TextGadget renders everything properly tough.
Post Reply