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 48376 - Use platform default for antialiasing
Summary: Use platform default for antialiasing
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 4.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@editor
URL:
Keywords:
Depends on: 59753
Blocks:
  Show dependency tree
 
Reported: 2004-09-02 14:40 UTC by _ tboudreau
Modified: 2007-11-05 13:42 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description _ tboudreau 2004-09-02 14:40:47 UTC
It would be nice if, if the rest of the UI is 
antialiased, if the editor would be too, if the 
user hasn't set a value for it.

I am using the following algorithm in the rest 
of the IDE, which works:

    public static final boolean antialias = 
Boolean.getBoolean(
        "nb.cellrenderer.antialiasing") 
|| //NOI18N
        ("GTK".equals(UIManager.getLookAndFeel
().getID()) && //NOI18N
        gtkShouldAntialias()) || 
        Boolean.getBoolean ("swing.aatext") 
|| //NOI18N
        "Aqua".equals(UIManager.getLookAndFeel
().getID()); 
    
    
    private static final boolean 
gtkShouldAntialias() {
        Object o = Toolkit.getDefaultToolkit
().getDesktopProperty
("gnome.Xft/Antialias"); //NOI18N
        return new Integer(1).equals(o);
    }
Comment 1 Miloslav Metelka 2004-09-02 18:03:48 UTC
Yes but IMHO then we need to change the current checkbox to a
three-state listbox for the Editor Settings->Text Antialiasing node as
well. Otherwise the user would not be able to force the editor to not
be antialiased. Is that true?
Comment 2 _ tboudreau 2004-09-02 20:46:30 UTC
Yup.  Note that the default Boolean property editor should treat null as the indeterminate 
state.
 
Comment 3 Miloslav Metelka 2004-09-03 13:01:33 UTC
Yes but I suppose that once you click the property editor then you
have either Boolean.TRUE or FALSE but there is no way to restore the
"null" system-default-state. This could be seen as deficiency i.e.
it's not a true three-state checkbox. Or do you think that it would
suffice here?
Comment 4 _ tboudreau 2005-08-03 07:15:55 UTC
See my comments in issue 59753, re the checkbox.  The patch there should fix
this issue too (can't test it until Mustang b47 is out this week).

What you could do is basically, determine if the platform defaults include
antialiasing, and store hints with/without it.  We can do a negative test to see
if the default for antialiasing is on, without having the 1.6 values:

Map pdefaults =
(Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"));

boolean defaultAntialiased = pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING)
!= null && pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING) !=
RenderingHints.VALUE_ANTIALIAS_OFF;

The patch is written so that if the platform defaults agree with the stored
defaults that antialiasing is on, then the platform defaults are used;  if they
disagree then the stored defaults are used.

The only thing the patch doesn't do that should be done is to make the state of
the checkbox true if the stored setting is null, in the case that the platform
default hints exist and contain a non-OFF value for text antialiasing.
Comment 5 _ tboudreau 2005-08-03 07:16:50 UTC
See my comments in issue 59753, re the checkbox.  The patch there should fix
this issue too (can't test it until Mustang b47 is out this week).

What you could do is basically, determine if the platform defaults include
antialiasing, and store hints with/without it.  We can do a negative test to see
if the default for antialiasing is on, without having the 1.6 values:

Map pdefaults =
(Map)(Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints"));

boolean defaultAntialiased = pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING)
!= null && pdefaults.get(RenderingHints.KEY_TEXT_ANTIALIASING) !=
RenderingHints.VALUE_ANTIALIAS_OFF;

The patch is written so that if the platform defaults agree with the stored
defaults that antialiasing is on, then the platform defaults are used;  if they
disagree then the stored defaults are used.

The only thing the patch doesn't do that should be done is to make the state of
the checkbox true if the stored setting is null, in the case that the platform
default hints exist and contain a non-OFF value for text antialiasing.
Comment 6 _ tboudreau 2005-08-24 08:57:05 UTC
Checking in editor/libsrc/org/netbeans/editor/EditorUI.java;
/cvs/editor/libsrc/org/netbeans/editor/EditorUI.java,v  <--  EditorUI.java
new revision: 1.76; previous revision: 1.75
done
Checking in editor/libsrc/org/netbeans/editor/FoldingToolTip.java;
/cvs/editor/libsrc/org/netbeans/editor/FoldingToolTip.java,v  <--  FoldingToolTi
p.java
new revision: 1.8; previous revision: 1.7
done
Checking in editor/libsrc/org/netbeans/editor/GlyphGutter.java;
/cvs/editor/libsrc/org/netbeans/editor/GlyphGutter.java,v  <--  GlyphGutter.java

new revision: 1.48; previous revision: 1.47
done
Checking in editor/src/org/netbeans/modules/editor/options/BaseOptions.java;
/cvs/editor/src/org/netbeans/modules/editor/options/BaseOptions.java,v  <--  Bas
eOptions.java
new revision: 1.105; previous revision: 1.104
done
Checking in openide/awt/src/org/openide/awt/HtmlLabelUI.java;
/cvs/openide/awt/src/org/openide/awt/HtmlLabelUI.java,v  <--  HtmlLabelUI.java
new revision: 1.4; previous revision: 1.3
done
Checking in openide/loaders/src/org/openide/awt/Toolbar.java;
/cvs/openide/loaders/src/org/openide/awt/Toolbar.java,v  <--  Toolbar.java
new revision: 1.34; previous revision: 1.33
done
Checking in core/swing/plaf/src/org/netbeans/swing/plaf/aqua/DropShadowBorder.ja
va;
/cvs/core/swing/plaf/src/org/netbeans/swing/plaf/aqua/DropShadowBorder.java,v  <
--  DropShadowBorder.java
new revision: 1.4; previous revision: 1.3
done
Checking in core/swing/plaf/src/org/netbeans/swing/plaf/util/UIUtils.java;
/cvs/core/swing/plaf/src/org/netbeans/swing/plaf/util/UIUtils.java,v  <--  UIUti
ls.java
new revision: 1.6; previous revision: 1.5
done
Checking in java/navigation/src/org/netbeans/modules/java/navigation/strings/Wei
ghtedStringPainterImpl.java;
/cvs/java/navigation/src/org/netbeans/modules/java/navigation/strings/WeightedSt
ringPainterImpl.java,v  <--  WeightedStringPainterImpl.java
new revision: 1.3; previous revision: 1.2
done