BBC BASIC for Windows
Programming >> User Interface >> Points vs Pixels
http://bb4w.conforums.com/index.cgi?board=ui&action=display&num=1435240687

Points vs Pixels
Post by hellomike on Jun 25th, 2015, 1:58pm

Hi,

For PRINT output I want some fancier font. Unfortunately the font doesn't really come out fine.
Code:
      VDU 23,22,512;512;16,16,16,0
      *FONT Courier New,10,B
      PRINT "The Quick Brown Fox Jumps Over The Lazy Dog"
      END
 

Some characters slightly overlap.

I guess it has something to do with my incorrect choice of points or pixels or both.

Strangely enough, after the program ends and I start typing in the same output window, the effect is not there....

What extra do I need to do/consider?
I hope it is not related to my videocard/driver.

Thanks

Mike
Re: Points vs Pixels
Post by rtr2 on Jun 25th, 2015, 3:55pm

on Jun 25th, 2015, 1:58pm, hellomike wrote:
What extra do I need to do/consider?

Kerning perhaps? This is a complicated area, as has been discussed before (I can't remember whether here or at the Yahoo group). How (and whether) kerning is actioned depends on the version of Windows, on the API call(s) used and on the plotting mode.

Things you can try are to use the VDU 5 mode (plot text at graphics coordinates), or to explicitly set the text background colour to transparent using an API call, or to change the character spacing (again using an API call). You may find relevant information by searching this forum and the Yahoo group for posts mentioning kerning.

Finally I would point out that ClearType can affect this - so maybe try turning it off - as can the automatic scaling applied with high DPI values in recent versions of Windows, which again you can try disabling.

As I said, it's a complex area!

Richard.

Re: Points vs Pixels
Post by rtr2 on Jun 25th, 2015, 5:57pm

on Jun 25th, 2015, 3:55pm, g4bau wrote:
Things you can try are to use the VDU 5 mode

Code:
      VDU 23,22,512;512;16,16,16,0
      *FONT Courier New,10,B
      VDU 5,30
      PRINT "The Quick Brown Fox Jumps Over The Lazy Dog"
      END 

Quote:
or to explicitly set the text background colour to transparent

Code:
      VDU 23,22,512;512;16,16,16,0
      *FONT Courier New,10,B
      TRANSPARENT = 1
      SYS "SetBkMode", @memhdc%, TRANSPARENT
      PRINT "The Quick Brown Fox Jumps Over The Lazy Dog"
      END 

Quote:
or to change the character spacing

Code:
      VDU 23,22,512;512;16,16,16,0
      *FONT Courier New,10,B
      SYS "SetTextCharacterExtra", @memhdc%, 1
      PRINT "The Quick Brown Fox Jumps Over The Lazy Dog"
      END 

Richard.

Re: Points vs Pixels
Post by hellomike on Jun 27th, 2015, 11:01am

Thanks for the replies.

Adding the line:

Code:
 SYS "SetBkMode", @memhdc%, 1 


Seems to solve the issue.

Indeed pretty complex stuff. How I miss the simple RISC OS and its PRM.

Thanks again.

Mike