Package org.jpedal.utils.repositories

Examples of org.jpedal.utils.repositories.Vector_Int


      //total number of items
      itemsInTable = itemsInTable + itemCount[i];

      //reset other values
      currentItem[i] = 0;
      rowContents[i] = new Vector_Int(20);
    }

    //now work through and split any overlapping items until all done
    while (true) {
View Full Code Here


            default:
      throw new PdfException("Illegal value "+mode+"for currentWritingMode");
    }
   
    //holds line we're working on
    Vector_Int current_line;
   
        for (int j = 0; j < itemCount; j++) { //for all items

            int c=items[j],id = -1, i,last = c;
        float smallest_gap = -1, gap, yMidPt;

        if(!isUsed[c] && this.writingMode[c]==mode) {

          //reset pointer and add this element
          current_line = new Vector_Int(20);
          current_line.addElement(c);
          lineY2.addElement((int) f_y2[c]);

                //look for items along same line (already sorted into order left to right)
                while (true) {   //look for a match
                    for (int ii = 0; ii < itemCount; ii++) {

              i = items[ii];

                        if (!isUsed[i] && i!=c && writingMode[c]==mode && ((f_x1[i] > f_x1[c] && mode!=PdfData.VERTICAL_TOP_TO_BOTTOM)||(f_x1[i] < f_x1[c] && mode==PdfData.VERTICAL_TOP_TO_BOTTOM))) { //see if on right

                            gap = (f_x1[i] - f_x2[c]);

                if(mode==PdfData.HORIZONTAL_RIGHT_TO_LEFT || mode==PdfData.VERTICAL_TOP_TO_BOTTOM)
                  gap=-gap;

                            //allow for fp error
                            if (gap < 0 && gap > -2)
                                gap = 0;

                //make sure on right
                yMidPt = (f_y1[i] + f_y2[i]) / 2;

                //see if line & if only or better fit
                            if (yMidPt < f_y1[c] && yMidPt > f_y2[c] && (smallest_gap < 0 || gap < smallest_gap)) {
                  smallest_gap = gap;
                  id = i;
                }
              }
            }

            if (id == -1) //exit when no more matches
              break;

                    //merge in best match if fit found with last or if overlaps by less than half a space,otherwise join
                    float t = f_x1[id] - f_x2[last],possSpace=f_x1[id]-f_x2[c];
                    float av_char1 =(float)1.5 *((f_x2[id] - f_x1[id])/ textLength[id]);
                    float av_char2 =(float)1.5 *((f_x2[last] - f_x1[last]) / textLength[last]);

                    if((mode==PdfData.HORIZONTAL_RIGHT_TO_LEFT || mode==PdfData.VERTICAL_TOP_TO_BOTTOM)){
                        possSpace=-possSpace;
                        t=-t;
                        av_char1=-av_char1;
                        av_char2=-av_char2;
                    }

                    if (t < av_char1 && t < av_char2) {
                        merge(last,id, isGapASpace(id, last, possSpace,addSpaceXMLTag,mode),true);
                    } else {
                        current_line.addElement(id);
                        last = id;
                    }

                    //flag used and reset variables used
                    isUsed[id] = true;
View Full Code Here

      isXHTML = true;
    }

    //init table variables
    lines = new Vector_Object(20);
    lineY2 = new Vector_Int(20);
    max_rows = 0;

    //init store for data
    copyToArrays(x1, y2, x2, y1, keepFontInfo, false,true,null,false);
View Full Code Here

    private void reset(){

        isXHTML = true;
        nextSlot=0;

      lineBreaks = new Vector_Int();

        max_rows = 0;
        master = 0;

        colorExtracted=false;
View Full Code Here

         //only create if we need and set value
         if(raw_rotation !=0 || rotations!=null){
             if(rotations==null){
                if(pageNumber<2000)
                    rotations=new Vector_Int(2000);
                 else
                    rotations=new Vector_Int(pageNumber*2);
             }

             rotations.setElementAt(raw_rotation,pageNumber);

         }
View Full Code Here

                                if(textLines!=null){
                                    Vector_Rectangle vr = (Vector_Rectangle) current.getObjectValue(ValueTypes.TextAreas);
                                    vr.trim();
                                    Rectangle[] pageTextAreas = vr.get();

                                    Vector_Int vi =  (Vector_Int) current.getObjectValue(ValueTypes.TextDirections);
                                    vi.trim();
                                    int[] pageTextDirections = vi.get();

                                    for(int k=0; k!=pageTextAreas.length; k++){
                                        textLines.addToLineAreas(pageTextAreas[k], pageTextDirections[k], page);
                                    }
                                }
View Full Code Here

   
    int flagCount=1;
   
    short x1  ;
   
    Vector_Int rawFlags=new Vector_Int(50);
    Vector_Int endPts=new Vector_Int(50);
    Vector_Short XX=new Vector_Short(50);
    Vector_Short Y=new Vector_Short(50);
   

   
    //all endpoints
        if(debug){
            System.out.println("endPoints");
            System.out.println("---------");
        }

        int lastPt=0;
            for(int i=0;i<contourCount;i++){


                lastPt=currentFontFile.getNextUint16();

                if(debug)
                    System.out.println(i+" "+lastPt);

                endPts.addElement(lastPt);

            }

        //allow for corrupted value with not enough entries
        //ie customers3/ICG3Q03.pdf
        if(currentFontFile.hasValuesLeft()){


    /**Don;t comment out !!!!!!!!!
     * needs to be read to advance pointer*/
    int instructionLength=currentFontFile.getNextUint16();
    int[] instructions=new int[instructionLength];
    for(int i=0;i<instructionLength;i++)
      instructions[i]=currentFontFile.getNextUint8();

        if (depth < currentInstructionDepth)
            this.instructions = instructions;

         if(debug){
            System.out.println("Instructions");
            System.out.println("------------");
            System.out.println("count="+instructionLength);
        }

        int count = lastPt+ 1;
    int flag;
   
    /**we read the flags (some can repeat)*/
    for (int i = 0; i < count; i++) {
      flag=currentFontFile.getNextUint8();
      rawFlags.addElement(flag)
      flagCount++;
     
      if ((flag & 8) == 8) { //repeating flags
        int repeatCount = currentFontFile.getNextUint8();
        for (int r = 1; r <= repeatCount; r++) {
          rawFlags.addElement(flag);
          flagCount++;
        }
        i += repeatCount;
      }
    }
   
    /**read the x values and set segment for complex glyph*/
    for(int i=0;i<count;i++){
      flag=rawFlags.elementAt(i);
     
      //boolean twoByteValue=((flag  & 2)==0);
      if ((flag & 16) != 0) { //
        if ((flag & 2) != 0) { //1 byte + value
          x1=(short)currentFontFile.getNextUint8();
          XX.addElement(x1);
        }else{ //2 byte value - same as previous - ??? same X coord or value
          XX.addElement((short)0);
        }
       
      } else {
        if ((flag  & 2) != 0){ //1 byte - value
          x1=(short)-currentFontFile.getNextUint8();
          XX.addElement(x1);
        }else{ //signed 16 bit delta vector
          x1=currentFontFile.getNextSignedInt16();     
          XX.addElement(x1)
        }
      }
    }
   
    /**read the y values*/
    for(int i=0;i<count;i++){
      flag=rawFlags.elementAt(i);
      if ((flag & 32) != 0) {
        if ((flag & 4) != 0) {
          Y.addElement((short)currentFontFile.getNextUint8());
        } else {
          Y.addElement((short)0);
        }
      } else {
        if ((flag & 4) != 0) {
          Y.addElement((short)-currentFontFile.getNextUint8());
        } else {
          short val=currentFontFile.getNextSignedInt16();
          Y.addElement(val);
        }
      }
    }
   
    /**
     * calculate the points
     */
    int endPtIndex = 0;
    int x=0,y=0;
   
        int[] flags=rawFlags.get();
   
    int[] endPtsOfContours=endPts.get();
    short[] XPoints=XX.get();
    short[] YPoints=Y.get();
    count=XPoints.length;

    int[] pX=new int[count+2];
View Full Code Here

TOP

Related Classes of org.jpedal.utils.repositories.Vector_Int

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.