Examples of CodepointIterator


Examples of org.apache.abdera.i18n.text.CodepointIterator

    }

    @Test
    public void testCodepointIterator() throws Exception {
        String s = "abcdefghijklmnop";
        CodepointIterator ci = CodepointIterator.forCharSequence(s);
        while (ci.hasNext())
            ci.next();
    }
View Full Code Here

Examples of org.apache.abdera.i18n.text.CodepointIterator

  }
 
  @Test
  public void testCodepointIterator() throws Exception {
    String s = "abcdefghijklmnop";
    CodepointIterator ci = CodepointIterator.forCharSequence(s);
    while(ci.hasNext()) ci.next();
  }
View Full Code Here

Examples of org.apache.abdera.util.io.CodepointIterator

    String source,
    Form form,
    StringBuffer buf)
      throws IOException {
      StringBuffer internal = new StringBuffer();
      CodepointIterator ci = CodepointIterator.forCharSequence(source);
      boolean canonical = form.isCanonical();
      while (ci.hasNext()) {
        int c = ci.next();
        internal.setLength(0);
        ucd.decompose(c, canonical, internal);
        CodepointIterator ii = CodepointIterator.forCharSequence(internal);
        while(ii.hasNext()) {
          int ch = ii.next();
          int i = findInsertionPoint(ucd, buf, ch);
          buf.insert(i,CharUtils.toString(ch));
        }
      }
   
View Full Code Here

Examples of org.apache.abdera.util.io.CodepointIterator

  public static StringBuffer encode(
    char[] chars,
    boolean[] case_flags)
      throws IOException {
    StringBuffer buf = new StringBuffer();
    CodepointIterator ci = CodepointIterator.forCharArray(chars);
    int n, delta, h, b, bias, m, q, k, t;
    n = initial_n;
    delta = 0;
    bias = initial_bias;
    int i = -1;
    while (ci.hasNext()) {
      i = ci.next();
      if (basic(i)) {
        if (case_flags != null) {
        } else {
          buf.append((char)i);
        }
      }
    }
    h = b = buf.length();
    if (b > 0) buf.append((char)delimiter);
    while (h < chars.length) {
      ci.position(0);
      i = -1;
      m = Integer.MAX_VALUE;
      while(ci.hasNext()) {
        i = ci.next();
        if (i >= n && i < m) m = i;
      }
      if (m - n > (Integer.MAX_VALUE - delta) / (h + 1))
        throw new IOException("Overflow");
      delta += (m-n) * (h+1);
      n = m;
      ci.position(0);
      i = -1;
      while (ci.hasNext()) {
        i = ci.next();
        if (i < n) {
          if (++delta == 0) throw new IOException("Overflow");
        }
        if (i == n) {
          for (q = delta, k = base;; k+= base) {
            t = k <= bias ? tmin : k >= bias + tmax ? tmax : k - bias;
            if (q < t) break;
            buf.append((char)encode_digit(t+(q-t)%(base-t),false));
            q = (q-t) / (base-t);
          }
          buf.append((char)encode_digit(
            q, (case_flags!=null)?case_flags[ci.position()-1]:false));
          bias = adapt(delta,h+1,h==b);
          delta=0;
          ++h;
        }
      }
View Full Code Here

Examples of org.apache.abdera.util.io.CodepointIterator

  public static String prep(String s, boolean allowunassigned) {
    NameprepCodepointIterator r = null;
    try {
      StringBuffer buf = new StringBuffer();
      CodepointIterator ci = CodepointIterator.forCharSequence(s);
      r = new NameprepCodepointIterator(ci,allowunassigned);
      while(r.hasNext()) {
        int i = r.next();
        if (i != -1)
        buf.append((char)i);
View Full Code Here

Examples of sun.text.CodePointIterator

                if (font.canDisplayUpTo(text, start, limit) != -1) {
                    return null;
                }
            } else {
                FontResolver resolver = FontResolver.getInstance();
                CodePointIterator iter = CodePointIterator.create(text, start, limit);
                int fontIndex = resolver.nextFontRunIndex(iter);
                if (iter.charIndex() == limit) {
                    font = resolver.getFont(fontIndex, attributes);
                }
            }
        }
View Full Code Here

Examples of sun.text.CodePointIterator

     * font runs for each.
     */
    private void addFonts(char[] chars, Map attributes, int start, int limit) {
   
        FontResolver resolver = FontResolver.getInstance();
  CodePointIterator iter = CodePointIterator.create(chars, start, limit);
  for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
      int fontIndex = resolver.nextFontRunIndex(iter);
            addFont(resolver.getFont(fontIndex, attributes), runStart);
        }
    }
View Full Code Here

Examples of sun.text.CodePointIterator

     * @param start the start of the range of characters to test
     * @param limit the limit of the range of characters to test
     * @return true if the range of characters requires bidi analysis
     */
    public static boolean requiresBidi(char[] text, int start, int limit) {
  CodePointIterator cpi = CodePointIterator.create(text, start, limit);
  for (int cp = cpi.next(); cp != CodePointIterator.DONE; cp = cpi.next()) {
      if (cp > 0x0590) {
    int dc = nativeGetDirectionCode(cp);
    if ((RMASK & (1 << dc)) != 0) {
        return true;
    }
View Full Code Here

Examples of sun.text.CodePointIterator

     */
    private void addFonts(char[] chars, Map<? extends Attribute, ?> attributes,
                          int start, int limit) {

        FontResolver resolver = FontResolver.getInstance();
        CodePointIterator iter = CodePointIterator.create(chars, start, limit);
        for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
            int fontIndex = resolver.nextFontRunIndex(iter);
            addFont(resolver.getFont(fontIndex, attributes), runStart);
        }
    }
View Full Code Here

Examples of sun.text.CodePointIterator

     * font runs for each.
     */
    private void addFonts(char[] chars, Map attributes, int start, int limit) {

        FontResolver resolver = FontResolver.getInstance();
        CodePointIterator iter = CodePointIterator.create(chars, start, limit);
        for (int runStart = iter.charIndex(); runStart < limit; runStart = iter.charIndex()) {
            int fontIndex = resolver.nextFontRunIndex(iter);
            addFont(resolver.getFont(fontIndex, attributes), runStart);
        }
    }
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.