AutoHotkey Community

It is currently May 26th, 2012, 5:04 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: force font antialiasing
PostPosted: February 21st, 2009, 5:13 am 
Offline

Joined: February 8th, 2009, 5:52 pm
Posts: 47
Is it possible to force a text control to be antialiased or not (regardless
of the global preference set in the windows control panel) ?

I know for a fact that this kind of application specific setting is supported by Windows. But don't know how to achieve it in AHK.

I couldn't find anything about this in the help file. Perhaps through a windows gdi funcition call or something?

Any ideas?

thanks!


Last edited by firace on February 25th, 2009, 5:28 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 21st, 2009, 6:21 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7502
Location: Australia
lazygeek wrote:
I know for a fact that this kind of application specific setting is supported by Windows.
If you know it is supported, why ask if it is possible?

In actual fact, there is no application-specific setting. However, it can be controlled per-font via the fdwQuality parameter of CreateFont when the font is created.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2009, 5:26 pm 
Offline

Joined: February 8th, 2009, 5:52 pm
Posts: 47
Hi, thanks but I think I need some more help with this.
Not too familiar with dll calls from ahk...

Let's take the below code, for example.
What would be the simplest way to force the text to be antialiased (regardless of the Windows preferences)?

Code:
gui, font, s14 bold, Courier
gui, add, text,, hello world!
gui, show


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2009, 6:03 pm 
Online
User avatar

Joined: December 26th, 2005, 4:40 pm
Posts: 8776
Code:
Gui, Add, Text, w450 h60 hwndText1 0x201, Anti-Aliased
Gui, Add, Text, w450 h60 hwndText2 0x201, Non Anti-Aliased

nHeight    :=  50
fnWeight   := 700 ; FW_BOLD
fdwCharSet := 0x1 ; DEFAULT_CHARSET
lpszFace := "Courier New"
ANTIALIASED_QUALITY := 0x4
NONANTIALIASED_QUALITY := 0x3


hFont1 := DllCall( "CreateFont", Int,nHeight, Int,0, Int,0, Int,0, UInt,fnWeight, Int,0
,Int,0, Int,0, UInt,fdwCharSet, Int,0, Int,0, Int,ANTIALIASED_QUALITY, Int,0, Str,lpszFace )

hFont2 := DllCall( "CreateFont", Int,nHeight, Int,0, Int,0, Int,0, UInt,fnWeight, Int,0
,Int,0, Int,0, UInt,fdwCharSet, Int,0, Int,0, Int,NONANTIALIASED_QUALITY, Int,0, Str,lpszFace )

SendMessage, 0x30, hFont1, 1,, ahk_id %Text1%
SendMessage, 0x30, hFont2, 1,, ahk_id %Text2%

Gui, Show,, Anti-Alias Demo


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 25th, 2009, 6:24 pm 
Offline

Joined: February 8th, 2009, 5:52 pm
Posts: 47
Whoa! Fantastic. Thanks so much, SKAN.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, Miguel, rbrtryn, SifJar, SKAN and 57 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group