コード例 #1
0
 private int getLogicalColumn(int startLogicalColumn, int offset) {
   assert offset >= startOffset;
   assert offset <= endOffset;
   int currentStartOffset = startOffset;
   for (LineFragment fragment : fragments) {
     int currentEndOffset = currentStartOffset + fragment.getLength();
     startLogicalColumn =
         fragment.offsetToLogicalColumn(
             startLogicalColumn, Math.min(offset, currentEndOffset) - currentStartOffset);
     currentStartOffset = currentEndOffset;
     if (offset <= currentStartOffset) break;
   }
   return startLogicalColumn;
 }
コード例 #2
0
 // column is expected to be between startVisualColumn and endVisualColumn for this fragment
 int visualToLogicalColumn(int column) {
   int relativeLogicalColumn =
       delegate.visualToLogicalColumn(startX, getMinLogicalColumn(), column - startVisualColumn);
   return isRtl
       ? startLogicalColumn - relativeLogicalColumn
       : startLogicalColumn + relativeLogicalColumn;
 }
コード例 #3
0
 // column is expected to be between minLogicalColumn and maxLogicalColumn for this fragment
 int logicalToVisualColumn(int column) {
   return startVisualColumn
       + delegate.logicalToVisualColumn(
           startX,
           getMinLogicalColumn(),
           isRtl ? startLogicalColumn - column : column - startLogicalColumn);
 }
コード例 #4
0
 private BidiRun subRun(int targetStartOffset, int targetEndOffset) {
   assert targetStartOffset < endOffset;
   assert targetEndOffset > startOffset;
   if (targetStartOffset <= startOffset && targetEndOffset >= this.endOffset) {
     return this;
   }
   int start = Math.max(startOffset, targetStartOffset);
   int end = Math.min(endOffset, targetEndOffset);
   BidiRun run = new BidiRun(level, start, end);
   int offset = startOffset;
   for (LineFragment fragment : fragments) {
     if (end <= offset) break;
     int endOffset = offset + fragment.getLength();
     if (start < endOffset) {
       run.fragments.add(
           fragment.subFragment(
               Math.max(start, offset) - offset, Math.min(end, endOffset) - offset));
     }
     offset = endOffset;
   }
   return run;
 }
コード例 #5
0
 // columns are visual (relative to fragment's start)
 void draw(Graphics2D g, float x, float y, int startRelativeColumn, int endRelativeColumn) {
   delegate.draw(g, x, y, startRelativeColumn, endRelativeColumn);
 }
コード例 #6
0
 void draw(Graphics2D g, float x, float y) {
   delegate.draw(g, x, y, 0, getLength());
 }
コード例 #7
0
 // column is expected to be between startVisualColumn and endVisualColumn for this fragment
 float visualColumnToX(int column) {
   return delegate.visualColumnToX(startX, column - startVisualColumn);
 }
コード例 #8
0
 // x is expected to be between startX and endX for this fragment
 // returns array of two elements
 // - first one is visual column,
 // - second one is 1 if target location is closer to larger columns and 0 otherwise
 int[] xToVisualColumn(float x) {
   int[] column = delegate.xToVisualColumn(startX, x);
   column[0] += startVisualColumn;
   return column;
 }
コード例 #9
0
 // both startOffset and offset are expected to be between minOffset and maxOffset for this
 // fragment
 float offsetToX(float startX, int startOffset, int offset) {
   return delegate.offsetToX(startX, getRelativeOffset(startOffset), getRelativeOffset(offset));
 }
コード例 #10
0
 // offset is expected to be between minOffset and maxOffset for this fragment
 float offsetToX(int offset) {
   return delegate.offsetToX(startX, 0, getRelativeOffset(offset));
 }
コード例 #11
0
 float getEndX() {
   return delegate.offsetToX(startX, 0, getLength());
 }
コード例 #12
0
 int getVisualColumnCount() {
   return delegate.getVisualColumnCount(startX);
 }
コード例 #13
0
 int getLogicalColumnCount() {
   return isRtl ? getLength() : delegate.getLogicalColumnCount(getMinLogicalColumn());
 }
コード例 #14
0
 int getLength() {
   return delegate.getLength();
 }