LB Booster
« Font smoothing? »

Welcome Guest. Please Login or Register.
Apr 1st, 2018, 04:20am



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
We apologize Conforums does not have any export functions to migrate data.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

Thank you Conforums members.
Speed up Liberty BASIC programs by up to ten times!
Compile Liberty BASIC programs to compact, standalone executables!
Overcome many of Liberty BASIC's bugs and limitations!
LB Booster Resources
LB Booster documentation
LB Booster Home Page
LB Booster technical Wiki
Just BASIC forum
BBC BASIC Home Page
Liberty BASIC forum (the original)

« Previous Topic | Next Topic »
Pages: 1 2  Notify Send Topic Print
 hotthread  Author  Topic: Font smoothing?  (Read 1635 times)
Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Font smoothing?
« Thread started on: Jul 15th, 2015, 1:22pm »

When I print text into a graphics box the text is displayed with smoothing under Vista and Win8 (if the user has this feature enabled under the desktop settings).

Is there a way I can print text into a graphics box without the smoothing and without the user having to change their desktop settings?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #1 on: Jul 15th, 2015, 4:12pm »

on Jul 15th, 2015, 1:22pm, Monkfish wrote:
Is there a way I can print text into a graphics box without the smoothing and without the user having to change their desktop settings?

If by "smoothing" you mean antialiasing one way would be to create the font using the Windows API, which gives you full control (you could for example adapt code for printing text on a slope). But why would you want to reduce the text quality?

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #2 on: Jul 15th, 2015, 10:18pm »

Well I have to print the text into the graphics box at 8pt size and at this size the AA makes the characters look ugly and indistinct. I really need them to be nice and crisp like standard 8pt texts.

The setting that needs to be changed is under Windows Color & Appearance > Open Classic Appearance Properties > Effects > Use Following Method to Smooth Edges > (Clear or Standard). I need it set to Standard.
« Last Edit: Jul 15th, 2015, 10:22pm by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #3 on: Jul 15th, 2015, 10:51pm »

on Jul 15th, 2015, 10:18pm, Monkfish wrote:
Well I have to print the text into the graphics box at 8pt size and at this size the AA makes the characters look ugly and indistinct. I really need them to be nice and crisp like standard 8pt texts.

Here's a direct comparison (Arial, 8pt):

User Image

I actually prefer the antialiased version; I wouldn't call it "ugly and indistinct", but YMMV.

Richard.
User IP Logged

Rod
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 110
xx Re: Font smoothing?
« Reply #4 on: Jul 16th, 2015, 06:25am »

Perhaps the ugliness is more to do with the SIZE parameter since this has an influence over resolution. What pixel width is your drawing and what SIZE parameter are you using to print the image?
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #5 on: Jul 16th, 2015, 08:55am »

on Jul 16th, 2015, 06:25am, Rod wrote:
Perhaps the ugliness is more to do with the SIZE parameter since this has an influence over resolution. What pixel width is your drawing and what SIZE parameter are you using to print the image?

I didn't realise the OP was doing any (hardcopy) printing; his only reference was to "printing text into a graphics box". If indeed output to a printer is involved then that puts a quite different complexion on the issue.

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #6 on: Jul 16th, 2015, 2:55pm »

Well I am using 8pt Lucida Console which has characters 7*11 pixels in size. Here is what they look like on the screen and when magnified 2x. Yes I am printing it too.

https://www.dropbox.com/s/3b26v49xrq4quxp/hello%20world.gif?dl=0

Got the antialiased and non-antialiased the wrong way round but you see what I mean. Look at the "W" for example. Not sure how I insert images into these posts.
« Last Edit: Jul 16th, 2015, 3:00pm by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #7 on: Jul 16th, 2015, 8:43pm »

on Jul 16th, 2015, 2:55pm, Monkfish wrote:
Here is what they look like on the screen and when magnified 2x.

Was that created using LBB v3.00? What puzzles me is that several of the letters (including the W) appear to have been clipped, which is one reason why they look so ugly. But LBB is not supposed to clip characters printed to a graphics window.

Here is what I get with 8pt Lucida Console at 96 DPI (magnified 2x):

User Image

The characters are not clipped in this case. huh

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #8 on: Jul 17th, 2015, 11:21am »

The word "clipped" got me thinking. Yes, I expect they are clipped, because I am drawing them with a 7 pixel spacing (as they should be) but the antialiasing seems to overlap from one character to the next, so when I print the following character it clips the previous one. I expect I can change the print options to merge with what is already there.

Anyway, for reasons to long to explain, I need the characters without antialiasing and ideally without the user needing to change their windows settings. Is there no easy way?

I suppose I could create a copy of the standard character set and copy each character into position using the drawbmp command?

Your characters still look different to mine. I'm using the statement:

print #main.gfx, "font Lucida_Console 0 11"

I need the characters to be 7x11

Yes I am using version 3.0
« Last Edit: Jul 17th, 2015, 11:29am by Monkfish » User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #9 on: Jul 17th, 2015, 1:10pm »

on Jul 17th, 2015, 11:21am, Monkfish wrote:
Your characters still look different to mine. I'm using the statement:
print #main.gfx, "font Lucida_Console 0 11"

Ah, you said you were drawing 8pt text so that's what I specified in my program.

Quote:
I need the characters to be 7x11

So why don't you explicitly specify a width of 7 pixels rather than allowing Windows to choose the width (which may be 7 pixels, but there's no guarantee):

Code:
print #main.gfx, "font Lucida_Console 7 11" 

Quote:
Is there no easy way?

Well, as I said, the most straightforward way is to call the CreateFont API directly - I would class that as relatively easy, and it's the method I used to create the bitmap I uploaded. Here's my program, adapted to force the cell width and height; if it doesn't give identical results to yours now I'm mystified:

Code:
    open "Test" for graphics as #w
    #w "font Lucida_Console 7 11"
    #w "\\Hello World! (antialiased)"

    calldll #gdi32, "CreateFontA", 11 as long, 7 as long, _
      0 as long, 0 as long, 400 as long, 0 as long, 0 as long, _
      0 as long, 0 as long, 0 as long, 0 as long, _
      _NONANTIALIASED_QUALITY as long, 0 as long, _
      "Lucida Console" as ptr, hf as ulong

    hw = hwnd(#w)
    calldll #user32, "GetDC", hw as ulong, hdc as ulong
    calldll #gdi32, "SelectObject", hdc as ulong, hf as ulong, _
      oldhf as ulong
    calldll #gdi32, "DeleteObject", oldhf as ulong, ret as long

    #w "\Hello World! (non-antialiased)"

    #w "getbmp bitmap 0 0 210 24"
    bmpsave "bitmap", "C:\temp\lbbaa.bmp"
    wait 

Richard.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #10 on: Jul 17th, 2015, 2:58pm »

Thanks Richard, I'll give it a whirl. smiley
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #11 on: Jul 17th, 2015, 7:48pm »

I would like to make a donation Richard for all the help you have given me and all your efforts with LBB. Does that $6.99 at the bottom go to you?
User IP Logged

RobM
Junior Member
ImageImage


member is offline

Avatar




PM


Posts: 91
xx Re: Font smoothing?
« Reply #12 on: Jul 17th, 2015, 8:24pm »

on Jul 17th, 2015, 7:48pm, Monkfish wrote:
... Does that $6.99 at the bottom go to you?


No, that goes directly to Conforums, this forum's host.
User IP Logged

Monkfish
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 104
xx Re: Font smoothing?
« Reply #13 on: Jul 17th, 2015, 8:48pm »

I'm sure that conforums are very deserving too smiley
User IP Logged

Richard Russell
Administrator
ImageImageImageImageImage


member is offline

Avatar




Homepage PM


Posts: 1348
xx Re: Font smoothing?
« Reply #14 on: Jul 17th, 2015, 8:54pm »

on Jul 17th, 2015, 1:10pm, Richard Russell wrote:
Here's my program...

Something to be aware of if you care about LB 4.04 compatibility: my program works but seemingly only once; thereafter the 'native' font selection seems to be broken. Perhaps it's necessary to select the original font back before exit; I don't know (and TBH I don't really care, since it works fine in LBB as is).

Richard.
User IP Logged

Pages: 1 2  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls