< prev index next >

modules/graphics/src/main/java/com/sun/javafx/text/PrismTextLayout.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 42,52 **** import com.sun.javafx.geom.RoundRectangle2D; import com.sun.javafx.geom.Shape; import com.sun.javafx.geom.transform.BaseTransform; import com.sun.javafx.geom.transform.Translate2D; import com.sun.javafx.scene.text.GlyphList; - import com.sun.javafx.scene.text.HitInfo; import com.sun.javafx.scene.text.TextLayout; import com.sun.javafx.scene.text.TextSpan; import java.text.Bidi; import java.text.BreakIterator; import java.util.ArrayList; --- 42,51 ----
*** 405,420 **** result[0] = new MoveTo(lineX, lineY); result[1] = new LineTo(lineX, lineY + lineHeight); return result; } ! public HitInfo getHitInfo(float x, float y) { ensureLayout(); - HitInfo info = new HitInfo(); int lineIndex = getLineIndex(y); if (lineIndex >= getLineCount()) { ! info.setCharIndex(getCharCount()); } else { if (isMirrored()) { x = getMirroringWidth() - x; } TextLine line = lines[lineIndex]; --- 404,421 ---- result[0] = new MoveTo(lineX, lineY); result[1] = new LineTo(lineX, lineY + lineHeight); return result; } ! public Hit getHitInfo(float x, float y) { ! int charIndex = -1; ! boolean leading = false; ! ensureLayout(); int lineIndex = getLineIndex(y); if (lineIndex >= getLineCount()) { ! charIndex = getCharCount(); } else { if (isMirrored()) { x = getMirroringWidth() - x; } TextLine line = lines[lineIndex];
*** 431,449 **** x -= run.getWidth(); } } if (run != null) { int[] trailing = new int[1]; ! info.setCharIndex(run.getStart() + run.getOffsetAtX(x, trailing)); ! info.setLeading(trailing[0] == 0); } else { //empty line, set to line break leading ! info.setCharIndex(line.getStart()); ! info.setLeading(true); } } ! return info; } public PathElement[] getRange(int start, int end, int type, float x, float y) { ensureLayout(); --- 432,450 ---- x -= run.getWidth(); } } if (run != null) { int[] trailing = new int[1]; ! charIndex = run.getStart() + run.getOffsetAtX(x, trailing); ! leading = (trailing[0] == 0); } else { //empty line, set to line break leading ! charIndex = line.getStart(); ! leading = true; } } ! return new Hit(charIndex, -1, leading); } public PathElement[] getRange(int start, int end, int type, float x, float y) { ensureLayout();
< prev index next >