java.awt.font.TextLayout#getCaretShapes ( )源码实例Demo

下面列出了java.awt.font.TextLayout#getCaretShapes ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

public static void main(String[] args) {
    Font font = new Font("Monospaced", Font.PLAIN, 12);
    String text = "\u0601";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bi.createGraphics();
    layout.draw(g2d, 50.0f, 50.0f);
    layout.getCaretShapes(0);
}
 
源代码2 项目: TencentKona-8   文件: NegativeGlyphIDException.java
public static void main(String[] args) {
    Font font = new Font("Monospaced", Font.PLAIN, 12);
    String text = "\u0601";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bi.createGraphics();
    layout.draw(g2d, 50.0f, 50.0f);
    layout.getCaretShapes(0);
}
 
源代码3 项目: openjdk-jdk8u   文件: NegativeGlyphIDException.java
public static void main(String[] args) {
    Font font = new Font("Monospaced", Font.PLAIN, 12);
    String text = "\u0601";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bi.createGraphics();
    layout.draw(g2d, 50.0f, 50.0f);
    layout.getCaretShapes(0);
}
 
public static void main(String[] args) {
    Font font = new Font("Monospaced", Font.PLAIN, 12);
    String text = "\u0601";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bi.createGraphics();
    layout.draw(g2d, 50.0f, 50.0f);
    layout.getCaretShapes(0);
}
 
源代码5 项目: ramus   文件: TextBounds.java
private int drawSels(Graphics2D g, int[][] found, int selIndex, int i,
                     TextLayout textLayout, float left, float fromY) {
    Shape[] start = null;
    while (selIndex < found.length) {
        if (in) {
            if (start == null)
                start = textLayout.getCaretShapes(0);
            Shape[] shapes;
            boolean b = false;
            if (found[selIndex][0] == i) {
                shapes = textLayout.getCaretShapes(found[selIndex][1]);
                selIndex++;
                in = false;
            } else {
                shapes = textLayout.getCaretShapes(texts.get(i).length());
                b = true;
            }
            Rectangle2D s = start[0].getBounds2D();
            Rectangle2D e = shapes[0].getBounds2D();
            Rectangle2D r = new Rectangle2D.Double(s.getMinX() + left,
                    s.getMinY() + fromY, e.getMaxX() - s.getMinX(),
                    e.getMaxY() - s.getMinY());
            g.draw(r);
            if (b)
                break;
        } else {
            if (found[selIndex][0] == i) {
                start = textLayout.getCaretShapes(found[selIndex][1]);
                selIndex++;
                in = true;
            } else
                break;
        }
    }
    return selIndex;
}
 
源代码6 项目: openjdk-jdk9   文件: MissingCodePointLayoutTest.java
public static void main(String[] args) {
    Font font = new Font("Tahoma", Font.PLAIN, 12);
    String text = "\ude00";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    layout.getCaretShapes(0);
}
 
源代码7 项目: jdk8u_jdk   文件: NegativeGlyphIDException.java
public static void main(String[] args) {
    Font font = new Font("Monospaced", Font.PLAIN, 12);
    String text = "\u0601";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2d = bi.createGraphics();
    layout.draw(g2d, 50.0f, 50.0f);
    layout.getCaretShapes(0);
}
 
源代码8 项目: jdk8u_jdk   文件: MissingCodePointLayoutTest.java
public static void main(String[] args) {
    Font font = new Font("Tahoma", Font.PLAIN, 12);
    String text = "\ude00";
    FontRenderContext frc = new FontRenderContext(null, false, false);
    TextLayout layout = new TextLayout(text, font, frc);
    layout.getCaretShapes(0);
}