Printing text tracking problem


I have a customer that is running my app on a SurfacePro. The app prints reports using “graphics.drawString(string, x, y)” leaving the last 2 optional parameters to default.

But the text tracking is horrible… the letters are almost unreadable as the spacing between them is too tight. The blank between words is almost non-existant.

I do not have a SurfacePro to test on but am seeing the same issues on Win 10… but not as nearly as bad.

I have tried different fonts and some are better than others but none are very good… except mono-space fonts.

Any suggestions how I might fix this?


What version of Xojo are you using?
What font are you seeing the problem with?
Are you drawing directly onto the graphics object returned by OpenPrinterDialog/OpenPrinter ?
Do you see it when printing to “Microsoft Print to PDF” in Windows 10?
Could you provide a little code sample showing the problem as I can’t replicate it here?

Is Graphics.CharacterSpacing getting changed? Set a breakpoint at the drawstring call and inspect the Graphics object.

Thanks for your responses

It seems I am going to have to add an option for SurfacePro users to modify the CharacterSpacing. 0 is just too tight.

0 looks fine on the Mac and is OK (not great) on Win10 but really bad on a SurfacePro.

It seems to be all fonts but the smaller the size the worse it gets.

Here is some test code I used to play around with it:

dim p as Graphics
p = OpenPrinterDialog()
p.TextSize= 9

p.CharacterSpacing = 0
p.DrawString(“0 this is a test of the emergency broadcast system this is only a test!”, 5, 30)

p.CharacterSpacing = 5
p.DrawString(“5 this is a test of the emergency broadcast system this is only a test!”, 5, 60)

p.CharacterSpacing = 10
p.DrawString(“10 this is a test of the emergency broadcast system this is only a test!”, 5, 90)

Your code looks fine on my Win10 machine. I’ve tried your code with the font size set all the way down to 1 and there are no issues. The whole point of fonts is that they can scale and retain their proportions.

I can’t believe for a minute that every SurfacePro developer would have to tweak code for that platform when dealing with fonts, there’s probably another reason for the problem.


Thanks for your efforts… I have asked the customer’s IT department to make sure the fonts are properly installed.

Oh, they are non-standard fonts? What type are they?

No… but the customer is a University and sometimes the IT department pre-configures all the machines… I just do not know what they might have done… but would be surprised if they did mess with the standard fonts.