C#生成Code39条形码而非条形码字体的方法

2019-12-26 13:16:00王振洲
  • num5++;  } 
  • chArray[num5] = '0';  num5++; 
  • }  return chArray; 
  • }  private int indexFromCharacter(byte c) 
  • {  //0x2c==44 
  • for (int i = 0; i < 0x2c; i++)  { 
  • if (this.c39_bp[i, 0] == c)  { 
  • return i;  } 
  • }  return -1; 
  • }   
  • private byte[] processExtended(byte[] data)  { 
  • //0x25 38  //0x4F 79 0x4E 78 
  • //int num = 0x4F;  int num = data.Length - 1; 
  • byte[] sourceArray = new byte[num + 1];  int index = 0; 
  • for (int i = 0; i < data.Length; i++)  { 
  • byte c = data[i];  if (this.valueFromCharacter(c) != -1) 
  • {  sourceArray[index] = c; 
  • index++;  } 
  • else  { 
  • byte num5 = 0;  byte num6 = 0; 
  • if (this.valuesFromExtended(c, ref num5, ref num6))  { 
  • sourceArray[index] = num5;  sourceArray[index + 1] = num6; 
  • index += 2;  } 
  • }  } 
  • byte[] destinationArray = new byte[index];  Array.Copy(sourceArray, destinationArray, index); 
  • return destinationArray;  } 
  • /// <summary>  /// 返回指定字符在code39合法字符数组中对应的索引 
  • /// </summary>  /// <param name="c"></param> 
  • /// <returns></returns>  private int valueFromCharacter(byte c) 
  • {  //c39_cw为数组,保存的为合法的字符集信息[0-9A-Z+-*/%. ] 共43个 
  • //如果存在这个字符就返回c39_cw对应的索引  for (int i = 0; i < /*0x2b*/this.c39_cw.Length; i++) 
  • {  if (this.c39_cw[i] == c)