JDK-6320281 : Type1 hinting support is missing
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2005-09-06
  • Updated: 2010-04-04
  • Resolved: 2005-09-19
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.
JDK 6
6 b53Fixed
Related Reports
Relates :  
Description
At the moment java font rasterizer only supports hinting for Truetype fonts.
However, Type1 fonts are commonplace on Solaris/Linux platforms and they 
often look not very good without hinting. 

To reproduce one may use following test 
(cour.pfa font is required, results are saved to new.png file):

import java.io.*;
import java.util.*;
import java.awt.*;
import java.awt.image.*;
import javax.imageio.*;

public class Visual {

 private static void tryFont(String fontFile, String testStr, float sz1, float sz2) {
  try {
    System.err.println("Testing "+fontFile);

    Font f = Font.createFont(Font.TYPE1_FONT, new FileInputStream(fontFile));

    BufferedImage bi = new BufferedImage(1000, 400, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = (Graphics2D) bi.getGraphics();
    g2.setColor(Color.WHITE);
    g2.setFont(f);

    int off = 10;

    for(float sz=sz1; sz < sz2; sz+=1.0) {
      off += (int) sz+5;
      f = f.deriveFont(Font.PLAIN, sz);
      g2.setFont(f);
      g2.drawString(""+sz+" "+testStr, 10, off); 
    } 

    ImageIO.write(bi, "png", new File("new.png"));
    
    System.err.println("Test done");
   } catch (Exception e) {
     System.err.println("Failed to test "+fontFile+" because of " + e);
   }
 }

 public static void main(String[] args) {
     tryFont("cour.pfa", "0123456789 abcdefghijklmnopqrstxyz ABCDEFGHIJKLMNOPQRSTXYZ !\"()[]/\\%$#@^&*-+=_", 7, 20);
 }
}

Comments
EVALUATION Some basic support for type1 hints was implemented (enabled by default for all type1 fonts). At the moment following hint functionality is supported: - hstem/vstem - dotsection - BlueValues/OtherBlues - type1 hint replacements Obviously, hinting support is not complete and need to be enhanced further but this will be tracked under separate bug ids.
12-09-2005