Java Code Examples for java.awt.font.TextLayout.getNextLeftHit()

The following are Jave code examples for showing how to use getNextLeftHit() of the java.awt.font.TextLayout class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: OpenJSharp   File: TextMeasureTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TLExContext tlctx = (TLExContext)ctx;
    TextLayout tl = tlctx.tl;
    TextHitInfo[] hits = tlctx.hits;
    TextHitInfo hit;
    do {
        for (int i = 0; i < hits.length; ++i) {
            hit = tl.getNextLeftHit(hits[i]);
        }
    } while (--numReps >= 0);
}
 
Example 2
Project: jdk8u-jdk   File: TextMeasureTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TLExContext tlctx = (TLExContext)ctx;
    TextLayout tl = tlctx.tl;
    TextHitInfo[] hits = tlctx.hits;
    TextHitInfo hit;
    do {
        for (int i = 0; i < hits.length; ++i) {
            hit = tl.getNextLeftHit(hits[i]);
        }
    } while (--numReps >= 0);
}
 
Example 3
Project: openjdk-jdk10   File: TextMeasureTests.java   View Source Code Vote up 5 votes
public void runTest(Object ctx, int numReps) {
    TLExContext tlctx = (TLExContext)ctx;
    TextLayout tl = tlctx.tl;
    TextHitInfo[] hits = tlctx.hits;
    TextHitInfo hit;
    do {
        for (int i = 0; i < hits.length; ++i) {
            hit = tl.getNextLeftHit(hits[i]);
        }
    } while (--numReps >= 0);
}
 
Example 4
Project: openjdk-jdk10   File: HitTest.java   View Source Code Vote up 5 votes
public static void main(String args[]) {
   String s = new String(new int[]{0x1d400, 0x61}, 0, 2);
   Font font = new Font("Dialog", Font.PLAIN, 12);
   FontRenderContext frc = new FontRenderContext(null, false, false);
   TextLayout tl = new TextLayout(s, font, frc);
   TextHitInfo currHit = TextHitInfo.beforeOffset(3);
   TextHitInfo prevHit = tl.getNextLeftHit(currHit);
   System.out.println("index=" + prevHit.getCharIndex()+
                      " leading edge=" + prevHit.isLeadingEdge());
   if (prevHit.getCharIndex() != 2) {
       throw new RuntimeException("Expected 2 for hit index");
   }
}