This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 59753 - Add support for subpixel rendering introduced in JDK6
Summary: Add support for subpixel rendering introduced in JDK6
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 5.x
Hardware: All All
: P1 blocker (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
Depends on:
Blocks: 48376
  Show dependency tree
 
Reported: 2005-06-08 19:29 UTC by Roman Strobl
Modified: 2011-11-01 10:29 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments
No AA in editor (59.02 KB, image/png)
2005-06-08 19:29 UTC, Roman Strobl
Details
Normal AA in editor (71.83 KB, image/png)
2005-06-08 19:30 UTC, Roman Strobl
Details
Subpixel AA in editor (65.85 KB, image/png)
2005-06-08 19:30 UTC, Roman Strobl
Details
Editor build with subpixel AA instead of regular AA (771.50 KB, application/octet-stream)
2005-06-08 19:35 UTC, Roman Strobl
Details
Patch (24.02 KB, patch)
2005-08-03 16:51 UTC, _ tboudreau
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Strobl 2005-06-08 19:29:07 UTC
We need to add support for subpixel rendering introduced in Mustang build 39.
According to the discussion with Java team we should have the following options
in editor for antialiasing:

1) OFF
2) REGULAR (as now)
3) Use DESKTOP settings - and make this the default. 

The DESKTOP setting would take the Antialiasing settings from the OS. Right now
the JDK team is working on API which will give us these settings both on various
OSes. 

Depending on the OS settings, we will either use no hints, the regular AA hint
or the new subpixel rendering hint. I have tried to enable it in editor, it can
be done by replacing the current AA hint in org.n.m.e.options.BaseOptions.java with:

    textAntialiasingHintsMap.put(RenderingHints.KEY_TEXT_ANTIALIASING,
            RenderingHints.VALUE_TEXT_ANTIALIAS_LCD_HRGB);

I attach screenshots with no AA, regular AA and subpixel AA in editor.

I also attach a build of editor which forces the subpixel AA hint instead of
regular AA hint in editor. So once user activates AA with this build of editor,
the subpixel AA is used. This is not a solution, it was just created to show how
the subpixel rendering will look like in NetBeans.
Comment 1 Roman Strobl 2005-06-08 19:29:35 UTC
Created attachment 22560 [details]
No AA in editor
Comment 2 Roman Strobl 2005-06-08 19:30:00 UTC
Created attachment 22561 [details]
Normal AA in editor
Comment 3 Roman Strobl 2005-06-08 19:30:40 UTC
Created attachment 22562 [details]
Subpixel AA in editor
Comment 4 Roman Strobl 2005-06-08 19:35:04 UTC
Created attachment 22563 [details]
Editor build with subpixel AA instead of regular AA
Comment 5 _ tboudreau 2005-08-03 06:52:25 UTC
Phil Race on the JDK team gave me the secret:

Map hintsMap =
(Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"));
//NOI18N
graphics2d.addRenderingHints(hintsMap);

I'm attaching a patch that should fix this for every case I could find in the
source base (tabs, explorer, etc.).  It also fixes issue 48376, which is really
the same issue, but editor-specific.

Note it is not tested - this feature won't appear until Mustang b47, which is
due sometime this week.

I wasn't quite sure what to do in the case someone wants to explicitly turn
editor antialiasing *off* (not that you can really do this).  The patch for the
editor will look for VALUE_TEXT_ANTIALIASING_OFF in the saved rendering hints
map.  Currently that will never happen, but if someone wanted to make the
antialias action more intelligent, it could check the checkbox by default if the
platform supports antialiasing by default, and then put explicit no-antialiasing
hints into the map it saves if the user de-selects it.

(There are a few souls in the world who prefer non-antialiased text - see Joel
Spolsky's diatribes on the subject).
Comment 6 _ tboudreau 2005-08-03 16:51:31 UTC
Created attachment 23482 [details]
Patch
Comment 7 Miloslav Metelka 2005-08-04 09:25:06 UTC
Question for the editor part: Should not the FoldingToolTip and GlyphGutter use
the same algorithm like the EditorUI? Possibly that algorithm could be made a
static method.
BTW IMHO we should upgrade the option to three-state value (as suggested in
Roman's original note) in the future anyway.
Comment 8 Miloslav Metelka 2011-11-01 10:29:28 UTC
I hope this is no longer an issue. All the editor's code now applies system rendering hints i.e. some form of

    public void paint(Graphics g) {
        Map<?, ?> desktopHints = (Map<?, ?>) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"); //NOI18N
        ((Graphics2D)g).addRenderingHints(desktopHints);
        ...
    }

which I assume is the correct state. If not please reopen the issue.