Barcode 128 space

孤街浪徒 提交于 2019-12-11 12:47:04

问题


I'm converting in a visual studio's console application some strings into barcode128 format.

My problem is with the "space" ( ): I can't convert it in any form, I have the barcode128 library for word and it doesn't convert space, but he simply splits two barcodes making them impossible to read.

I read to replace ASCII 32 ( ) with ASCII 194 (┬) but this ascii is not converted by word. How can I convert into barcode128 a string with a space?

Example "PROP. LOG."

thanks all


回答1:


Whether the space character needs special treatment depends on the actual font you are using.

But fonts seem to miss a working code point for a space where you would expect it. While defined (with a pattern of '11011001100' and with weights of '212222') some fonts out there seem to not have it at the same spot. You probably use a Font that doesn't contain a proper space character at 32.

So you will have to find out where the space character is in your font.

One free Font that does have it at 32 is to be found here.

I looked into a few other free fonts and found that they have the space character at 223.

The control codes also were misplaced. Wikipedia says to this:

The encoded ASCII char depends on the actual used barcode-font. Especially the ASCII char of value 0 and of value 95 and above can be defined differently in the font that is installed.

According to the code numbers in the table this may or may not include the space character..

Here are the constants that worked for me:

    char FNC1 = (char)181;
    char FNC4 = (char)220;
    char StartA = (char)192;
    char StartB = (char)193;
    char StartC = (char)194;
    char Stop = (char)200;
    char ShiftAB = (char)252;
    char Space = (char)223;

Update As I found the mess the various fonts provided too much I decided to go with drawing the barcodes I will eventually need myself. Not hard at all and I can stay with the codes as set in the standard tables..



来源:https://stackoverflow.com/questions/35229541/barcode-128-space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!