Package org.jfree.fonts.encoding

Examples of org.jfree.fonts.encoding.ByteStream


    else if ((buffer.getLength() * 2) < textLength)
    {
      buffer.ensureSize(textLength * 2);
    }

    final ByteStream target = new ByteStream(buffer, textLength);
    final int[] sourceArray = text.getData();
    final int endPos = text.getCursor();
    for (int i = text.getOffset(); i < endPos; i++)
    {
      final int sourceItem = sourceArray[i];
      if (sourceItem < 0 || sourceItem > MAX_CHAR)
      {
        continue;
      }

      if (sourceItem <= 0xFFFF)
      {
        if (sourceItem >= 0xD800 && sourceItem <= 0xDFFF)
        {
          // this is an error condition. We ignore it for now ..
          continue;
        }

        target.put((byte) ((sourceItem & 0xff00) >> 8));
        target.put((byte) (sourceItem & 0xff));
      }
      else
      {
        // compute the weird replacement mode chars ..
        final int derivedSourceItem = sourceItem - 0x10000;
        final int highWord = 0xD800 | ((derivedSourceItem & 0xFFC00) >> 10);
        target.put((byte) ((highWord & 0xff00) >> 8));
        target.put((byte) (highWord & 0xff));

        final int lowWord = 0xDC00 | (derivedSourceItem & 0x3FF);
        target.put((byte) ((lowWord & 0xff00) >> 8));
        target.put((byte) (lowWord & 0xff));
      }
    }

    target.close();
    return buffer;
  }
View Full Code Here


      buffer.ensureSize(textLength / 2);
    }


    final int[] targetData = buffer.getData();
    final ByteStream sourceBuffer = new ByteStream(text, 10);

    // this construct gives us an even number ...
    int position = buffer.getOffset();
    while (sourceBuffer.getReadSize() >= 2)
    {
      final int highByte = (sourceBuffer.get() & 0xff);
      final int lowByte = (sourceBuffer.get() & 0xff);

      if ((highByte & 0xFC) == 0xD8)
      {
        if (sourceBuffer.getReadSize() < 2)
        {
          // we reached the end of the parsable stream ...
          // this is an error condition
          // Log.debug("Reached the end ..");
          break;
        }

        final int highByteL = (sourceBuffer.get() & 0xff);
        final int lowByteL = (sourceBuffer.get() & 0xff);


        if ((highByteL & 0xFC) == 0xDC)
        {
          // decode the extended CodePoint ...
View Full Code Here

      buffer.ensureSize(textLength / 2);
    }


    final int[] targetData = buffer.getData();
    final ByteStream sourceBuffer = new ByteStream(text, 10);

    // this construct gives us an even number ...
    int position = buffer.getOffset();
    while (sourceBuffer.getReadSize() >= 2)
    {
      final int highByte = (sourceBuffer.get() & 0xff);
      final int lowByte = (sourceBuffer.get() & 0xff);

      if ((highByte & 0xFC) == 0xD8)
      {
        if (sourceBuffer.getReadSize() < 2)
        {
          // we reached the end of the parsable stream ...
          // this is an error condition
          // Log.debug("Reached the end ..");
          break;
        }

        final int highByteL = (sourceBuffer.get() & 0xff);
        final int lowByteL = (sourceBuffer.get() & 0xff);


        if ((highByteL & 0xFC) == 0xDC)
        {
          // decode the extended CodePoint ...
View Full Code Here

    else if ((buffer.getLength() * 2) < textLength)
    {
      buffer.ensureSize(textLength * 2);
    }

    final ByteStream target = new ByteStream(buffer, textLength);
    final int[] sourceArray = text.getData();
    final int endPos = text.getCursor();
    for (int i = text.getOffset(); i < endPos; i++)
    {
      final int sourceItem = sourceArray[i];
      if (sourceItem < 0 || sourceItem > MAX_CHAR)
      {
        continue;
      }

      if (sourceItem <= 0xFFFF)
      {
        if (sourceItem >= 0xD800 && sourceItem <= 0xDFFF)
        {
          // this is an error condition. We ignore it for now ..
          continue;
        }

        target.put((byte) ((sourceItem & 0xff00) >> 8));
        target.put((byte) (sourceItem & 0xff));
      }
      else
      {
        // compute the weird replacement mode chars ..
        final int derivedSourceItem = sourceItem - 0x10000;
        final int highWord = 0xD800 | ((derivedSourceItem & 0xFFC00) >> 10);
        target.put((byte) ((highWord & 0xff00) >> 8));
        target.put((byte) (highWord & 0xff));

        final int lowWord = 0xDC00 | (derivedSourceItem & 0x3FF);
        target.put((byte) ((lowWord & 0xff00) >> 8));
        target.put((byte) (lowWord & 0xff));
      }
    }

    target.close();
    return buffer;
  }
View Full Code Here

TOP

Related Classes of org.jfree.fonts.encoding.ByteStream

Copyright © 2018 www.massapicom. 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.