Hi,

Does the ligature works in Java 2 ?
I'm using the jdk1.2.2 RC4 on Linux.

Here is an exemple...
Any help ?

---

import javax.swing.*;
import java.text.*;
import java.awt.font.*;
import java.awt.*;
import java.awt.geom.*;
import java.util.*;

public class LigatureTest extends JComponent {

    static FontRenderContext ctx = new FontRenderContext(null, true, true);

    public void paint(Graphics g) {
        paint((Graphics2D) g);
    }

    public void paint(Graphics2D g2d) {
        g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
                             RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.transform(AffineTransform.getTranslateInstance(10f, 100f));

        Font font = new Font("sans-serif", Font.PLAIN, 64);
        GlyphVector glyphs = font.createGlyphVector(ctx, "fiifiifiifii");
        g2d.setStroke(new BasicStroke(1f));
        for (int i=0; i < glyphs.getNumGlyphs(); ++i) {
            Shape glyph = glyphs.getGlyphOutline(i);
            float x = (float) glyphs.getGlyphPosition(i).getX();
            float y = (float) glyphs.getGlyphPosition(i).getY();
            AffineTransform t = AffineTransform.getTranslateInstance(x, y);
            glyph = t.createTransformedShape(glyph);

            GlyphMetrics metrics = glyphs.getGlyphMetrics(i);
            System.out.println(metrics.isLigature());
            g2d.setPaint(Color.white);
            g2d.fill(glyph);
            g2d.setPaint(Color.black);
            g2d.draw(glyph);
        }
    }

    public Dimension getPreferredSize() {
        return new Dimension(800, 400);
    }

    public static void main(String [] args) {
        JFrame f = new JFrame("LigatureTest");
        f.getContentPane().add(new LigatureTest(), BorderLayout.CENTER);
        f.pack();
        f.show();
    }
}

--
Thierry Kormann
email: [EMAIL PROTECTED]  http://www.inria.fr/koala/tkormann/
Koala/Dyade/Bull @ INRIA - Sophia Antipolis

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to