View Issue Details

IDProjectCategoryView StatusLast Update
0004545JEDI VCL00 JVCL Componentspublic2009-10-03 14:18
ReporterArvidAssigned ToAHUser 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product VersionDaily / GIT 
Target VersionFixed in Version3.39 
Summary0004545: TJvLinkLabel: Wrong painting of highlighted links due to Anti-Aliasing
DescriptionWhen using TJvLinkLabel the links are not drawn correctly when hovering them with the mouse (hot, hover, clicked) on Systems using Anti-Aliasing / ClearType.

In TJvCustomLinkLabel.ActivateLinkNodeAtPos and TJvCustomLinkLabel.DeactivateActiveLinkNode the previous link state is simply overdrawn at the same position stored in the given LinkNode Rect.

LinkLabel's TextHandler is drawing using TextOut and the background is not erased before the output so drawing multiple times to the same position will create problems with antialiasing / half-transparent pixels.

The only solution is to erase the background before painting which will of course insufficient when using transparency.
Additional InformationTests done using D2006 on native Vista x32
TagsNo tags attached.

Relationships

has duplicate 0004723 resolvedobones ugly repaint over bold items with some fonts 

Activities

2008-10-21 00:50

 

Clipboard.zip (3,074 bytes)

obones

2008-12-22 04:45

administrator   ~0015142

Please provide the zipped sources of a sample application showing this.

Arvid

2008-12-22 05:29

reporter   ~0015149

Hi Olivier,

nice to receive some kind of feedback. Too bad I never received any reply in the newsgroups (posted 3 messages on 20.-22. Oct 2008) where I already provided a working fix...

Please see verification of this issue below (I currently have not installed JEDI):

- Steps to Reproduce -
Just drop a JvLinkLabel onto form and define a link (e.g. "<link=http://www.mozilla.org/MPL/MPL-1.1.html>MPL 1.1</link>"). Run on Windows having ClearType / Anti-Aliasing enabled (default on newer systems with XP or Vista) and see the result.

- Verification by original Author -
In the meantime I discovered that the contributors original source already included this as known issue. David Polberger's isolated JvLinkLabel version (available at Torry) states it in ReadMe.txt.

Polberger's source is 99% identical to the JVCL JvLinkLabel except for enhanced JVLinkLabel OnClick method (not related to this bug). I did a diff/compare to check this.

LinkLabel\Doc\ReadMe.txt
"Known Issues:
* Newer versions of Windows include font anti-aliasing (also called "font
smoothing"), which basically makes fonts look better, with fewer jagged edges.
It fools the human mind into thinking that it sees a smooth curve, for example,
by inserting gray pixels between the white background and black font (provided
that you use those colors). Font smoothing isn't available in all Windows
versions, and can be manually disabled. It usually only kicks in when you use
large-size fonts, and often when you use bold fonts.

Unfortunately, this creates problems for TJvLinkLabel. When you click a link, it
will turn red, and revert back to its old blue self when you let go of it
(provided that you use the default colors). TJvLinkLabel doesn't erase or
repaint the background, before it draws the link text in a new color. This works
fine when Windows doesn't use font smoothing when it draws the link text - if it
does, you won't get gray pixels between the black font and the white background,
they'll have a streak of blue or red in them, which looks awful.

Fortunately, you'll only see this problem if you use very large fonts, or make
your links bold. In most standard applications, there's little reason to do
either.

Of course, this is a genuine bug, and should be fixed. The fix isn't as trivial
as it sounds, as one must also consider transparent labels, where we may paint
on a complex background. It shouldn't take more than a day or two, though.
Please feel free to implement the fix, and send me the changes, so that I can
include it in the next release."

Best regards
Arvid

2009-01-17 04:38

 

JvLinkLabel.zip (24,439 bytes)

Arvid

2009-01-17 04:40

reporter   ~0015250

Hi Olivier,

attached the JvLinkLabel Demo from the JVCL MegaDemo. Hovering any text link in the right pane already shows the issue immediately.

Your system is required to be XP or Vista in order to show the problem with anti-aliasing.

Despite the obvious reason for the misbehaviour of the LinkLabel I've also reverified for D2009 and Vista x32 and x64.

Best regards
Arvid

obones

2009-07-08 15:17

administrator   ~0015783

Could you attach your proposed fix here?

2009-07-25 21:41

 

JvLinkLabel.pas (21,881 bytes)

Arvid

2009-07-25 21:48

reporter   ~0015892

Hi Olivier,

i attached my working copy which incorporates the fix (JvLinkLabel.pas).

Note: I am not using the complete JVCL, so my file contains many more differenced if you diff to the original version. Those changes are related to removing the needed dependiencies to other JVCL units, Unicode support for < D2009 and so on.

But the fix is simple: Instead of using a TGraphicControl for the descendant I use a TCustomControl to allow drawing the parent's background inside the paint method (see DrawTransparent).

The painting draws the parent background and does the textout. Invalidating is done when needed, e.g. on MouseLeave.

Probably it's possible to invalidate the transparent background area of the TGraphicControl JVCL uses too, but my approach was the quickest fix for me.

If you like the developer implementing the fix can contact me at winkelsdorf [at] gmail [dot] com.

Cheers,
Arvid

AHUser

2009-10-03 14:18

developer   ~0016227

Fixed in SVN.

Issue History

Date Modified Username Field Change
2008-10-21 00:50 Arvid New Issue
2008-10-21 00:50 Arvid File Added: Clipboard.zip
2008-10-22 01:31 obones Status new => acknowledged
2008-12-22 04:45 obones Note Added: 0015142
2008-12-22 04:45 obones Status acknowledged => feedback
2008-12-22 05:29 Arvid Note Added: 0015149
2009-01-17 04:38 Arvid File Added: JvLinkLabel.zip
2009-01-17 04:40 Arvid Note Added: 0015250
2009-04-29 14:36 obones Relationship added has duplicate 0004723
2009-07-06 14:06 obones Status feedback => acknowledged
2009-07-08 15:17 obones Note Added: 0015783
2009-07-08 15:17 obones Status acknowledged => feedback
2009-07-25 21:41 Arvid File Added: JvLinkLabel.pas
2009-07-25 21:48 Arvid Note Added: 0015892
2009-09-22 15:40 obones Status feedback => acknowledged
2009-10-03 14:18 AHUser Note Added: 0016227
2009-10-03 14:18 AHUser Status acknowledged => resolved
2009-10-03 14:18 AHUser Fixed in Version => Daily / SVN
2009-10-03 14:18 AHUser Resolution open => fixed
2009-10-03 14:18 AHUser Assigned To => AHUser