JDK-4806229 : Applets running on Netscape 7 on Solaris does not display fonts correctly
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.4.1_01
  • Priority: P1
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_8
  • CPU: sparc
  • Submitted: 2003-01-22
  • Updated: 2003-03-04
  • Resolved: 2003-03-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other Other
1.4.1_03 03Fixed 1.4.2Fixed
Description
Running Netscape 7.0 on Solaris 8. 

The font size does not take effect when the label component is added to applet in its init() method. However, they work when the components are added in the start() method. 

This works fine on Netscape 6.x on Solaris and in Netscape 7 on windows . Only Netscape 7 on Solaris seems to have the problem.



To Reproduce:
==========================

import java.applet.Applet;
import java.awt.*;
import java.awt.event.*;


public final class Sample extends Applet
{
        Label lbl;
        TextField txt;

        public void addMyComps()
        {
                this.add(lbl);
        }

    public void init()
    {
                lbl = new Label("ABCDEFGHIJ");
                lbl.setFont(Font.decode("Dialog-bold-25"));

                String sTemp = super.getParameter("ADD_IN_INIT");
                if ( (null != sTemp) && (sTemp.equals("YES")) )
{
                        System.out.println("Adding comps in Init");
                        addMyComps();
                }
        }

    public void start()
    {
                String sTemp = super.getParameter("ADD_IN_START");
                if ( (null != sTemp) && (sTemp.equals("YES")) )
                {
                        System.out.println("Adding comps in Start");
                        addMyComps();
                }
        }

    public void stop()
    {
                System.out.println("In Stop()");
    }
}



###@###.### 2003-02-03

Comments
CONVERTED DATA BugTraq+ Release Management Values COMMIT TO FIX: 1.4.1_03 mantis-beta tiger FIXED IN: 1.4.1_03 mantis-beta tiger INTEGRATED IN: 1.4.1_03 mantis-b18 mantis-beta tiger
14-06-2004

WORK AROUND Add the components in the start() method of the applet. This however may not always be feasible as customer has to go back and change a lot of code that was working fine in Netscape6 & IE . Also, various other bugs were fixed in Netscape7 which forces them to use 7.0 as their recommended Netscape client.
11-06-2004

EVALUATION Submitter, please indicate if this also occurs in Java 1.4.2 latest builds. ###@###.### 2003-02-10 Hi, I tested the nightly build 1.4.2-beta-b15. The problem still occurs. /net/koori.sfbay/p/jdk01/jdk/1.4.2/beta/b15/binaries/solaris-sparc/jre/plugin/sparc/ns610/libjavaplugin_oji.so Thanks, Anitha ###@###.### 2003-02-11 Though the direct trigger of this bug is the change we made for #4654261, it is not the real root cause, it just exposes an motif font handling problem which has been in MComponentPeer.java's setFont() for years. In MComponentPeer.java's setFont(), the current code tries to fix a problem caused by it's native pSetFont() implementation which recursively set all it's motif children with the same font, but the code is incomplete, it does not correctly handle the children components that are children of some direct children which do not have different font. The suggested fix below should solve the problem, but I did not pay much attention to optimize it. --- MComponentPeer.java 2003 *************** *** 270,275 **** --- 270,278 ---- Font rightFont = children[i].getFont(); if (!f.equals(rightFont)) { peer.setFont(rightFont); + } else + if (children[i] instanceof Container) { + peer.setFont(f); } } } ###@###.### 2003-02-11 Commit to fix in Mantis (open escalation). ###@###.### 2003-02-11 Commiting to fix this in the 1.4.1_03 update release. Note: the problem is not applicable to any pre-1.4.1 releases. ###@###.### 2003-02-12 ###@###.### 2003-02-12
12-02-2003