Java 类android.text.AndroidCharacter 实例源码

项目:GitHub    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    paint.getTextWidths(charArray, start, end, mWidths);
    final int N = end - start;
    for (int i = 0; i < N; i++)
        wideAttribute[i] = (byte) (((int) mWidths[i] != charWidth) ?
                AndroidCharacter.EAST_ASIAN_WIDTH_WIDE :
                AndroidCharacter.EAST_ASIAN_WIDTH_NARROW);
}
项目:connectbot    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    paint.getTextWidths(charArray, start, end, mWidths);
    final int N = end - start;
    for (int i = 0; i < N; i++)
        wideAttribute[i] = (byte) (((int)mWidths[i] != charWidth) ?
                AndroidCharacter.EAST_ASIAN_WIDTH_WIDE :
                AndroidCharacter.EAST_ASIAN_WIDTH_NARROW);
}
项目:JotaTextEditor    文件:TextUtils.java   
public void getChars(int start, int end, char[] dest, int destoff) {
    TextUtils.getChars(mSource, start + mStart, end + mStart,
                       dest, destoff);
    AndroidCharacter.mirror(dest, 0, end - start);

    int len = end - start;
    int n = (end - start) / 2;
    for (int i = 0; i < n; i++) {
        char tmp = dest[destoff + i];

        dest[destoff + i] = dest[destoff + len - i - 1];
        dest[destoff + len - i - 1] = tmp;
    }
}
项目:bVnc    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    paint.getTextWidths(charArray, start, end, mWidths);
    final int N = end - start;
    for (int i = 0; i < N; i++)
        wideAttribute[i] = (byte) (((int)mWidths[i] != charWidth) ?
                AndroidCharacter.EAST_ASIAN_WIDTH_WIDE :
                AndroidCharacter.EAST_ASIAN_WIDTH_NARROW);
}
项目:GitHub    文件:vt320.java   
/**
 * Put string at current cursor position. Moves cursor
 * according to the String. Does NOT wrap.
 * @param s character array
 * @param start place to start in array
 * @param len number of characters to process
 */
public void putString(char[] s, byte[] fullwidths, int start, int len) {
  if (len > 0) {
    //markLine(R, 1);
    int lastChar = -1;
    char c;
    boolean isWide = false;

    for (int i = 0; i < len; i++) {
      c = s[start + i];
      // Shortcut for my favorite ASCII
      if (c <= 0x7F) {
        if (lastChar != -1)
          putChar((char) lastChar, isWide, false);
        lastChar = c;
        isWide = false;
      } else if (!Character.isLowSurrogate(c) && !Character.isHighSurrogate(c)) {
        if (Character.getType(c) == Character.NON_SPACING_MARK) {
          if (lastChar != -1) {
            char nc = Precomposer.precompose((char) lastChar, c);
            putChar(nc, isWide, false);
            lastChar = -1;
          }
        } else {
          if (lastChar != -1)
            putChar((char) lastChar, isWide, false);
          lastChar = c;
          if (fullwidths != null) {
              final byte width = fullwidths[i];
              isWide = (width == AndroidCharacter.EAST_ASIAN_WIDTH_WIDE)
                  || (width == AndroidCharacter.EAST_ASIAN_WIDTH_FULL_WIDTH);
          }
        }
      }
    }

    if (lastChar != -1)
      putChar((char) lastChar, isWide, false);

    setCursorPosition(C, R);
    redraw();
  }
}
项目:GitHub    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    AndroidCharacter.getEastAsianWidths(charArray, start, end - start, wideAttribute);
}
项目:connectbot    文件:vt320.java   
/**
 * Put string at current cursor position. Moves cursor
 * according to the String. Does NOT wrap.
 * @param s character array
 * @param start place to start in array
 * @param len number of characters to process
 */
public void putString(char[] s, byte[] fullwidths, int start, int len) {
  if (len > 0) {
    //markLine(R, 1);
    int lastChar = -1;
    char c;
    boolean isWide = false;

    for (int i = 0; i < len; i++) {
      c = s[start + i];
      // Shortcut for my favorite ASCII
      if (c <= 0x7F) {
        if (lastChar != -1)
          putChar((char) lastChar, isWide, false);
        lastChar = c;
        isWide = false;
      } else if (!Character.isLowSurrogate(c) && !Character.isHighSurrogate(c)) {
        if (Character.getType(c) == Character.NON_SPACING_MARK) {
          if (lastChar != -1) {
            char nc = Precomposer.precompose((char) lastChar, c);
            putChar(nc, isWide, false);
            lastChar = -1;
          }
        } else {
          if (lastChar != -1)
            putChar((char) lastChar, isWide, false);
          lastChar = c;
          if (fullwidths != null) {
              final byte width = fullwidths[i];
              isWide = (width == AndroidCharacter.EAST_ASIAN_WIDTH_WIDE)
                  || (width == AndroidCharacter.EAST_ASIAN_WIDTH_FULL_WIDTH);
          }
        }
      }
    }

    if (lastChar != -1)
      putChar((char) lastChar, isWide, false);

    setCursorPosition(C, R);
    redraw();
  }
}
项目:connectbot    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    AndroidCharacter.getEastAsianWidths(charArray, start, end - start, wideAttribute);
}
项目:AndLinux    文件:AndroidCharacterCompat.java   
public static int getEastAsianWidth(char c) {
    return AndroidCharacter.getEastAsianWidth(c);
}
项目:crepl    文件:AndroidCharacterCompat.java   
public static int getEastAsianWidth(char c) {
    return AndroidCharacter.getEastAsianWidth(c);
}
项目:JotaTextEditor    文件:TextUtils.java   
public char charAt(int off) {
    return AndroidCharacter.getMirror(mSource.charAt(mEnd - 1 - off));
}
项目:bVnc    文件:EastAsianWidth.java   
@Override
public void measure(char[] charArray, int start, int end,
        byte[] wideAttribute, Paint paint, int charWidth) {
    AndroidCharacter.getEastAsianWidths(charArray, start, end - start, wideAttribute);
}
项目:Ansole    文件:AndroidCharacterCompat.java   
public static int getEastAsianWidth(char c) {
    return AndroidCharacter.getEastAsianWidth(c);
}