Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

My rendering problem -- update



Some of you suggested that my terminal emulator rendering issue is from a problem with the Mac 1.4 JVM rendering fonts that had been AffineTransform-ed. I can now confirm that with a simple "one-class wonder." The source code below effectively duplicates the rendering problem of the emulator:
package Test30MR05;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class Test30MR05 extends JPanel {
    protected Image bufferImage;
    protected Graphics bgr; // back graphics
    protected Font font;
    protected Font tallFont;
  public Test30MR05() {
    Dimension size = new Dimension(500,500);
    setPreferredSize(size);
    setMinimumSize(size);
    setMaximumSize(size);
    setBackground(Color.blue);
    font = new Font("Serif", Font.PLAIN, 16);
    tallFont = font.deriveFont(AffineTransform.getScaleInstance(1.0, 1.6));
    }
  public void setup(){
    bufferImage = createImage(500,500);
    bgr = bufferImage.getGraphics();
    bgr.setColor(Color.red);
    bgr.fillRect(0,0,500,500);
    bgr.setColor(Color.white);
    bgr.drawLine(250,0,250,500);
    bgr.drawLine(0,250,500,250);
    bgr.setFont(font);
    bgr.drawString("I like spam. This is normal.",251,249);
    bgr.drawLine(0,300,500,300);
    bgr.setFont(tallFont);
    bgr.drawString("I like spam. This is taller.", 251, 299);
  }
  public void paint(Graphics g) {
    if (bufferImage != null)
      g.drawImage(bufferImage, 0, 0, null);
  }
  public static void main(String[] args) {
    Test30MR05 foo = new Test30MR05();
    JFrame frame = new JFrame();
    frame.getContentPane().add(foo);
    frame.pack();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    foo.setup();
    frame.setVisible(true);
  }
}
Later today, I hope to have a ZIP file with the above, in source, class, and jar, with WinDoze and MacOS-X screen shots, on my web site. Anybody here know about the any workarounds for the Affine bug?
-- JHHL
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden


This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.