Examples of TextHitInfo


Examples of java.awt.font.TextHitInfo

                originalCaret = caret;
                // Sets composed text caret
                exchangeCaret(originalCaret, composedTextCaret);
            }

            TextHitInfo caretPos = e.getCaret();
            if (caretPos != null) {
                int index = caretPos.getInsertionIndex();
                dot += index;
                if (index == 0) {
                    // Scroll the component if needed so that the composed text
                    // becomes visible.
                    try {
View Full Code Here

Examples of java.awt.font.TextHitInfo

    if ((mnemonicIndex >= 0) && (mnemonicIndex < paintText.length()))
    {
      TextLayout layout = new TextLayout(as.getIterator(),
                                         g2.getFontRenderContext());

      TextHitInfo leading = TextHitInfo.leading(mnemonicIndex);
      TextHitInfo trailing = TextHitInfo.trailing(mnemonicIndex);

      Rectangle r =
        layout.getVisualHighlightShape(leading, trailing).getBounds();

      // draw a horizontal line under the specified character to indicate
View Full Code Here

Examples of java.awt.font.TextHitInfo

        Point2D p = new Point2D.Float(x, y);
        try {
        transform.inverseTransform(p, p);
        } catch (java.awt.geom.NoninvertibleTransformException nite) {;}
        TextHitInfo hit = layout.hitTestChar((float) p.getX(),
                                             (float) p.getY());
        // put this in to be consistent with GlyphLayout
        if (hit.getCharIndex() == -1) {
            return null;
        }
        return new TextHit(hit.getCharIndex(), hit.isLeadingEdge());
    }
View Full Code Here

Examples of java.awt.font.TextHitInfo

            }
        }

        ACIText aText = new ACIText( text, 0, totalChars, committedChars );
        int composedCharLength = totalChars - committedChars;
        TextHitInfo caret=null,visiblePosition=null;
        switch( composedCharLength ) {
            case 0:
                break;
            case 1:
                visiblePosition = caret = ZERO_TRAILING_HIT_INFO;
View Full Code Here

Examples of java.awt.font.TextHitInfo

        public void init(TestEnvironment env, Result results) {
            super.init(env, results);

            ArrayList list = new ArrayList(text.length() * 2 + 2);
            TextHitInfo hit = TextHitInfo.trailing(-1);
            do {
                list.add(hit);
                hit = tl.getNextRightHit(hit);
            } while (hit != null);
            hits = (TextHitInfo[])list.toArray(new TextHitInfo[list.size()]);
View Full Code Here

Examples of java.awt.font.TextHitInfo

        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);
View Full Code Here

Examples of java.awt.font.TextHitInfo

        public void runTest(Object ctx, int numReps) {
            TLExContext tlctx = (TLExContext)ctx;
            TextLayout tl = tlctx.tl;
            int numhits = tlctx.hits.length;
            Rectangle2D lb = tlctx.lb;
            TextHitInfo hit;
            for (int i = 0; i <= numhits; ++i) {
                float x = (float)(lb.getMinX() + lb.getWidth() * i / numhits);
                float y = (float)(lb.getMinY() + lb.getHeight() * i / numhits);
                hit = tl.hitTestChar(x, y, lb);
            }
View Full Code Here

Examples of java.awt.font.TextHitInfo

                    }
                    InputMethodRequests imr = client.getInputMethodRequests();
                    if (imr != null) {
                        if (IMManager.belowTheSpot()) {
                            // position window below the spot:
                            TextHitInfo offset = TextHitInfo.leading(0);
                            Rectangle textLoc = imr.getTextLocation(offset);
                            setLocationBelow(textLoc);                          
                        } else {
                            client.dispatchEvent(ime);
                            return;
View Full Code Here

Examples of java.awt.font.TextHitInfo

        if (visual == breaker.getCharCount()) {
            return null;
        }

        TextHitInfo newInfo;

        while(visual <= breaker.getCharCount()) {
            visual++;
            newInfo = getHitInfoFromVisual(visual);

            if (newInfo.getCharIndex() >= breaker.logical2segment.length) {
                return newInfo;
            }

            if (hitInfo.getCharIndex() >= 0) { // Don't check for leftmost info
                if (
                        breaker.logical2segment[newInfo.getCharIndex()] !=
                        breaker.logical2segment[hitInfo.getCharIndex()]
                ) {
                    return newInfo; // We crossed segment boundary
                }
            }

            TextRunSegment seg = breaker.runSegments.get(breaker.logical2segment[newInfo
                    .getCharIndex()]);
            if (!seg.charHasZeroAdvance(newInfo.getCharIndex())) {
                return newInfo;
            }
        }

        return null;
View Full Code Here

Examples of java.awt.font.TextHitInfo

        if (visual == 0) {
            return null;
        }

        TextHitInfo newInfo;

        while(visual >= 0) {
            visual--;
            newInfo = getHitInfoFromVisual(visual);

            if (newInfo.getCharIndex() < 0) {
                return newInfo;
            }

            // Don't check for rightmost info
            if (hitInfo.getCharIndex() < breaker.logical2segment.length) {
                if (
                        breaker.logical2segment[newInfo.getCharIndex()] !=
                        breaker.logical2segment[hitInfo.getCharIndex()]
                ) {
                    return newInfo; // We crossed segment boundary
                }
            }

            TextRunSegment seg = breaker.runSegments.get(breaker.logical2segment[newInfo
                    .getCharIndex()]);
            if (!seg.charHasZeroAdvance(newInfo.getCharIndex())) {
                return newInfo;
            }
        }

        return null;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.