|  |  | @ -102,11 +102,11 @@ public class BarcodeUtils { | 
			
		
	
		
			
				
					|  |  |  |         Graphics2D g = outImage.createGraphics(); | 
			
		
	
		
			
				
					|  |  |  |         g.drawImage(image, 0, 0, imageW, imageH, null); | 
			
		
	
		
			
				
					|  |  |  |         g.setColor(QRCOLOR); | 
			
		
	
		
			
				
					|  |  |  |         g.setFont(new Font("微软雅黑", Font.BOLD, FONTSIZE)); | 
			
		
	
		
			
				
					|  |  |  | //        g.setFont(new Font("微软雅黑", Font.BOLD, FONTSIZE));
 | 
			
		
	
		
			
				
					|  |  |  |         g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); | 
			
		
	
		
			
				
					|  |  |  |         g.setBackground(Color.white); | 
			
		
	
		
			
				
					|  |  |  | //        获取文字数量  按照字节展示
 | 
			
		
	
		
			
				
					|  |  |  |         int size = pressText.getBytes("UTF-8").length; | 
			
		
	
		
			
				
					|  |  |  |         int size = pressText.getBytes("GBK").length; | 
			
		
	
		
			
				
					|  |  |  | //        获取一行最多能容纳多少文字   按照文字字节展示
 | 
			
		
	
		
			
				
					|  |  |  |         int maxSize = (WIDTH / FONTSIZE - 2) * 2; | 
			
		
	
		
			
				
					|  |  |  |         if (size > maxSize) { | 
			
		
	
	
		
			
				
					|  |  | @ -121,7 +121,7 @@ public class BarcodeUtils { | 
			
		
	
		
			
				
					|  |  |  |                 g.drawString(pressText, (WIDTH - (FONTSIZE * v)) / 2, startY); | 
			
		
	
		
			
				
					|  |  |  |             } | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             g.drawString(pressText, (WIDTH - ((pressText.getBytes("UTF-8").length) / 2) * FONTSIZE) / 2, startY); | 
			
		
	
		
			
				
					|  |  |  |             g.drawString(pressText, (WIDTH - ((pressText.getBytes("GBK").length) / 2) * FONTSIZE) / 2, startY); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         g.dispose(); | 
			
		
	
	
		
			
				
					|  |  | @ -153,7 +153,7 @@ public class BarcodeUtils { | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     private static String outStringByByte(String str, int len) throws IOException { | 
			
		
	
		
			
				
					|  |  |  |         byte[] btf = str.getBytes("UTF-8"); | 
			
		
	
		
			
				
					|  |  |  |         byte[] btf = str.getBytes("GBK"); | 
			
		
	
		
			
				
					|  |  |  |         int count = 0; | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         for (int j = len - 1; j >= 0; j--) { | 
			
		
	
	
		
			
				
					|  |  | @ -165,9 +165,9 @@ public class BarcodeUtils { | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |         if (count % 2 == 0) { | 
			
		
	
		
			
				
					|  |  |  |             return new String(btf, 0, len, "UTF-8"); | 
			
		
	
		
			
				
					|  |  |  |             return new String(btf, 0, len, "GBK"); | 
			
		
	
		
			
				
					|  |  |  |         } else { | 
			
		
	
		
			
				
					|  |  |  |             return new String(btf, 0, len - 1, "UTF-8"); | 
			
		
	
		
			
				
					|  |  |  |             return new String(btf, 0, len - 1, "GBK"); | 
			
		
	
		
			
				
					|  |  |  |         } | 
			
		
	
		
			
				
					|  |  |  | 
 | 
			
		
	
		
			
				
					|  |  |  |     } | 
			
		
	
	
		
			
				
					|  |  | 
 |