コード例 #1
0
  public int setConstant(int pdfKeyType, int keyStart, int keyLength, byte[] raw) {

    int PDFvalue = PdfDictionary.Unknown;

    int id = 0, x = 0, next;

    try {

      // convert token to unique key which we can lookup

      for (int i2 = keyLength - 1; i2 > -1; i2--) {

        next = raw[keyStart + i2];

        // System.out.println((char)next);
        next = next - 48;

        id = id + ((next) << x);

        x = x + 8;
      }

      /** not standard */
      switch (id) {

          //                case StandardFonts.CIDTYPE0:
          //                    PDFvalue =StandardFonts.CIDTYPE0;
          //                break;

        default:

          //                	if(pdfKeyType==PdfDictionary.Encoding){
          //                		PDFvalue=PdfCIDEncodings.getConstant(id);
          //
          //                		if(PDFvalue==PdfDictionary.Unknown){
          //
          //                			byte[] bytes=new byte[keyLength];
          //
          //                            System.arraycopy(raw,keyStart,bytes,0,keyLength);
          //
          //                			unknownValue=new String(bytes);
          //                		}
          //
          //                		if(debug && PDFvalue==PdfDictionary.Unknown){
          //                			System.out.println("Value not in PdfCIDEncodings");
          //
          //                           	 byte[] bytes=new byte[keyLength];
          //
          //                               System.arraycopy(raw,keyStart,bytes,0,keyLength);
          //                               System.out.println("Add to CIDEncodings and as String");
          //                               System.out.println("key="+new String(bytes)+" "+id+" not
          // implemented in setConstant in PdfFont Object");
          //
          //                               System.out.println("final public static int CMAP_"+new
          // String(bytes)+"="+id+";");
          //                		}
          //                	}else
          PDFvalue = super.setConstant(pdfKeyType, id);

          if (PDFvalue == -1) {

            if (debug) {

              byte[] bytes = new byte[keyLength];

              System.arraycopy(raw, keyStart, bytes, 0, keyLength);
              System.out.println(
                  "key="
                      + new String(bytes)
                      + " "
                      + id
                      + " not implemented in setConstant in "
                      + this);

              System.out.println("final public static int " + new String(bytes) + "=" + id + ";");
            }
          }

          break;
      }

    } catch (Exception ee) {
      ee.printStackTrace();
    }

    // System.out.println(pdfKeyType+"="+PDFvalue);
    switch (pdfKeyType) {
      case PdfDictionary.SMask:
        generalType = PDFvalue;
        break;

      case PdfDictionary.TR:
        generalType = PDFvalue;
        break;

      default:
        super.setConstant(pdfKeyType, id);
    }

    return PDFvalue;
  }