Jump to content

[SOLVED] Font Smoothing


Recommended Posts

Hi guys, do any of you found a solution for this?

http://img228.imageshack.us/i/problemev.jpg/

I made a GUI with an image based background, and created a transparent listview on top of the picture.

Now, as you can see, the text has a white border (looked jagged). I did try use value 5 for quality option in GUICtrlSetFont (cleartype) but still no luck.

This is the excerpt of my code. I don't include the background image in this example, just a transparent GUI...but it still can reproduce my problem.

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <GuiListView.au3>

$width  = 990
$height = 163

; I just create a GUI with a transparent background
$viewGUI = GUICreate('', $width, $height, -1, -1, $WS_POPUP, $WS_EX_LAYERED)
GUISetBkColor(0xABCDEF)     ; anything with this color will be transparent
_WinAPI_SetLayeredWindowAttributes($viewGUI, 0xABCDEF, 255)
GUISetState(@SW_SHOW)

$viewTable = GUICtrlCreateListView('', 0, 0, $width, $height, Default, $LVS_EX_FULLROWSELECT)
GUICtrlSetBkColor($viewTable, 0xABCDEF)     ; anything with this color will be transparent
GUICtrlSetFont($viewTable, 14, 550, Default, "Arial", 5)    ; 5 for cleartype, but not helping
GUICtrlSetColor($viewTable, 0xFF0000)       ; use the red color to make the white border more obvious

; just ignore the floating point, I use it to divide the column according to %
_GUICtrlListView_InsertColumn($viewTable, 0, "Date", $width * 0.12, 2)
_GUICtrlListView_InsertColumn($viewTable, 1, "Item1", $width * 0.12, 2)
_GUICtrlListView_InsertColumn($viewTable, 2, "Item2", $width * 0.25, 2)
_GUICtrlListView_InsertColumn($viewTable, 3, "Item3", $width * 0.20, 2)
_GUICtrlListView_InsertColumn($viewTable, 4, "Item4", $width * 0.15, 2)
_GUICtrlListView_InsertColumn($viewTable, 5, "Item5", $width * 0.163, 2)

insertData()    ; try load 1 sample

Do
    $msg = GUIGetMsg()
Until $msg = $GUI_EVENT_CLOSE

Func insertData()
    _GUICtrlListView_AddItem($viewTable, "03/04/2011", 0)
    _GUICtrlListView_AddSubItem($viewTable, 0, "Sample Data 1", 1)
    _GUICtrlListView_AddSubItem($viewTable, 0, "Sample Data 2", 2)
    _GUICtrlListView_AddSubItem($viewTable, 0, "Sample Data 3", 3)
    _GUICtrlListView_AddSubItem($viewTable, 0, "Sample Data 4", 4)
    _GUICtrlListView_AddSubItem($viewTable, 0, "Sample Data 5", 5)
EndFunc

I've been searching a method to smooth the text a bit, but didn't find the same problem.

Thanks all.

Best regards,

slayerz

Edited by slayerz

AUTOIT[sup] I'm lovin' it![/sup]

Link to comment
Share on other sites

I can get the label to display clearly using the image overlay technique (using grey.gif) but it's not working for listview. Any other ideas?

system font smoothing is the problem, cleartype may already be set in your OS's display properties.

use the $NONANTIALIASED_QUALITY parameter,

this will prevent the transparency mask colour bleeding through.

;#include <FontConstants.au3>
Global Const $NONANTIALIASED_QUALITY = 3
GUICtrlSetFont($viewTable, 14, 550, Default, "Arial", $NONANTIALIASED_QUALITY)

I see fascists...

Link to comment
Share on other sites

Woww!!! Rover, its working. I've been trying so hard using some image overlay, but never thought to test the quality value 1 by 1. Thanks rover, problem solved. :)

Edited by slayerz

AUTOIT[sup] I'm lovin' it![/sup]

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...