/******************************************************************************
* *
* M O D U L E D E F I N E *
* *
******************************************************************************/
#define CODEMSI_C
/******************************************************************************
* *
* C O M P I L E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include <string.h>
/******************************************************************************
* *
* U S E R D E F I N E D I N C L U D E F I L E S *
* *
******************************************************************************/
#include "Common.h"
#include "XGraphic.h"
#include "Barcode.h"
/******************************************************************************
* *
* L O C A L D E F I N E S *
* *
******************************************************************************/
#define QUIET_MU 0
#define TEXT_DIS 5
/******************************************************************************
* *
* L O C A L T Y P E D E F S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L F U N C T I O N P R O T O T Y P E S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L I N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/* None */
/******************************************************************************
* *
* L O C A L U N I T I A L I Z E D D A T A D E F I N I T I O N S *
* *
******************************************************************************/
/******************************************************************************
*
* Function:
*
*
* Description:
*
*
* Input:
* None
* check = 0 => mod 10 check sum
* check = 1 => mod 10 + mod 10 checksum
* check = 2 => no check sum
* check = 3 => mod 10 + mod 11 checksum
*
* Output:
* None.
*
******************************************************************************/
INT Codemsi(_BarCodeAttr *psBarCodeAttr)
{
/*-----------------08-16-99 17:18-------------------
variables
--------------------------------------------------*/
INT iProcess, iTemp;
INT iCheck10, Len;
ULONG lTemp;
INT iTotalData;
INT i;
BYTE bCodedata, bCodeMask;
BYTE bsHuman[100];
BYTE *pHuman;
BYTE *pExpress;
_BarAttr sBarAttr;
_BarCodeAttr sBarCodeAttr;
sBarCodeAttr = *psBarCodeAttr;
pHuman = bsHuman;
iTotalData = 0;
/*-----------------08-16-99 17:19-------------------
ImagePoint initial
--------------------------------------------------*/
sBarAttr.psImageBuffer=sBarCodeAttr.psImageBuffer;
pExpress=sBarCodeAttr.pExp;
iProcess=0;
/*-----------------02-10-99 11:35-------------------
decode
--------------------------------------------------*/
while(1)
{
/*-----------------02-10-99 11:29-------------------
leading quiet zone
--------------------------------------------------*/
if ( iProcess == 0 )
{
switch ( sBarCodeAttr.iRotation )
{
case 90:
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iHeight;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow*QUIET_MU;
break;
case 180:
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iHeight;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow*QUIET_MU;
break;
case 270:
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow*QUIET_MU;
break;
case 0:
default:
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow*QUIET_MU;
break;
}
iProcess=1;
continue;
}
/*-----------------02-10-99 11:35-------------------
start code
--------------------------------------------------*/
else if ( iProcess == 1 )
{
sBarAttr.iType = DRAW_BAR;
switch ( sBarCodeAttr.iRotation )
{
case 90:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow;
break;
case 180:
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iWide;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
break;
case 270:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iWide;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
break;
case 0:
default:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iWide;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow;
break;
}
iProcess=2;
continue;
}
/*-----------------02-10-99 12:06-------------------
get data -> encode fisrt byte
--------------------------------------------------*/
else if ( iProcess==2 )
{
if ( (*pExpress>='0') && (*pExpress<='9') )
{
bCodedata=*pExpress-'0';
*pHuman = *pExpress;
pHuman++ ;
++pExpress;
iTotalData += 1;
}
else if ( *pExpress==0 )
{
*pHuman = 0;
iProcess=3;
continue;
}
else
{
/*-----------------02-23-99 17:44-------------------
error
--------------------------------------------------*/
return FALSE;
}
}
/*-----------------02-10-99 14:52-------------------
check sum mode 10
--------------------------------------------------*/
else if( iProcess==3 )
{
if ( sBarCodeAttr.iCheck == 2 )
{
iProcess=5;
continue;
}
if ( sBarCodeAttr.iCheck == 3 )
{
iCheck10 = 0;
pExpress = sBarCodeAttr.pExp;
i = 0;
Len = strlen( (CHAR *)pExpress );
while ( *( pExpress + i ) != 0 )
{
iTemp = Len % 6;
if ( iTemp == 0 )
iTemp = 6;
iCheck10 += ( *( pExpress + i ) - '0' ) * ( iTemp + 1 );
i += 1;
Len -= 1;
}
bCodedata = 11 - ( iCheck10 % 11);
if ( bCodedata == 11 )
bCodedata = 0;
}
else
{
iCheck10 = 0;
pExpress = sBarCodeAttr.pExp;
iTemp = 0;
lTemp = 0;
i = 0;
while ( *( pExpress + i ) != 0 )
{
// if total data is odd and add odd data
if ( ( !( i % 2 )) ^ ( iTotalData % 2 ) )
{
iCheck10 += *( pExpress + i ) - '0';
}
else
{
lTemp *= 10;
lTemp += *( pExpress + i ) - '0';
}
i += 1;
}
lTemp = lTemp * 2;
iTemp = 0;
while ( lTemp != 0 )
{
iTemp = iTemp + ( lTemp % 10 );
lTemp = lTemp / 10;
}
bCodedata = 10 - ( (iCheck10 + iTemp ) % 10);
if ( bCodedata == 10 )
bCodedata = 0;
}
iTotalData += 1;
iProcess=4;
}
/*-----------------02-10-99 12:07-------------------
check sum mode 11
--------------------------------------------------*/
else if ( iProcess==4 )
{
if ( sBarCodeAttr.iCheck == 0 )
{
iProcess=5;
continue;
}
iCheck10 = 0;
pExpress = sBarCodeAttr.pExp;
iTemp = 0;
lTemp = 0;
i = 0;
while ( *( pExpress + i ) != 0 )
{
// if total data is odd and add odd data
if ( ( !( i % 2 )) ^ ( iTotalData % 2 ) )
{
iCheck10 += *( pExpress + i ) - '0';
}
else
{
lTemp *= 10;
lTemp += *( pExpress + i ) - '0';
}
i += 1;
}
// if total data is odd and add odd data
if ( ( !( i % 2 )) ^ ( iTotalData % 2 ) )
{
iCheck10 += bCodedata;
}
else
{
lTemp *= 10;
lTemp += bCodedata;
}
lTemp = lTemp * 2;
iTemp = 0;
while ( lTemp != 0 )
{
iTemp = iTemp + ( lTemp % 10 );
lTemp= lTemp / 10;
}
bCodedata = 10 - ( (iCheck10 + iTemp ) % 10);
if ( bCodedata == 10 )
bCodedata = 0;
iProcess=5;
/*
iWeight = 2;
iTemp = 0;
for ( i = iTotalData ; i>0 ; i-- )
{
iTemp += iWeight * ( *( pExpress + i ) - '0' );
iWeight += 1;
if ( iWeight >= 8 )
iWeight = 2;
}
iTemp = iTemp % 11;
iTemp = 11 - iTemp;
if ( iTemp == 11 )
iTemp = 0;
bCodedata = iTemp;
iProcess=5;
*/
}
/*-----------------02-10-99 12:07-------------------
end code
--------------------------------------------------*/
else if ( iProcess==5 )
{
sBarAttr.iType=DRAW_BAR;
switch ( sBarCodeAttr.iRotation )
{
case 90:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow;
sBarAttr.iType=DRAW_BAR;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iWide;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
break;
case 180:
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
break;
case 270:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
break;
default:
case 0:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iWide;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
DrawBar(&sBarAttr);
break;
}
iProcess=6;
}
/*-----------------02-10-99 11:40-------------------
if draw ok
--------------------------------------------------*/
if ( iProcess==6 )
{
switch ( sBarCodeAttr.iRotation )
{
case 90:
psBarCodeAttr->TotalWidth = sBarCodeAttr.sCoord.iY - psBarCodeAttr->sCoord.iY;
psBarCodeAttr->TotalHeight = psBarCodeAttr->iHeight;
break;
case 180:
psBarCodeAttr->TotalWidth = psBarCodeAttr->sCoord.iX - sBarCodeAttr.sCoord.iX;
psBarCodeAttr->TotalHeight = psBarCodeAttr->iHeight;
break;
case 270:
psBarCodeAttr->TotalWidth = psBarCodeAttr->sCoord.iY - sBarCodeAttr.sCoord.iY;
psBarCodeAttr->TotalHeight = psBarCodeAttr->iHeight;
break;
case 0:
default:
psBarCodeAttr->TotalWidth = sBarCodeAttr.sCoord.iX - psBarCodeAttr->sCoord.iX;
psBarCodeAttr->TotalHeight = psBarCodeAttr->iHeight;
break;
}
break;
}
/*-----------------02-10-99 11:35-------------------
draw bar
--------------------------------------------------*/
bCodeMask=0x10;
while(bCodeMask>1)
{
bCodeMask=bCodeMask>>1;
sBarAttr.iType=DRAW_BAR;
switch ( sBarCodeAttr.iRotation )
{
case 90:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
if ( (bCodedata & bCodeMask)!=0 )
{
sBarAttr.iHeight=sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow;
}
else
{
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY+sBarCodeAttr.iWide;
}
break;
case 180:
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
if ( (bCodedata & bCodeMask)!=0 )
{
sBarAttr.iWidth=sBarCodeAttr.iWide;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
}
else
{
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX-sBarCodeAttr.iWide;
}
break;
case 270:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.iWidth=sBarCodeAttr.iHeight;
if ( (bCodedata & bCodeMask)!=0 )
{
sBarAttr.iHeight=sBarCodeAttr.iWide;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
}
else
{
sBarAttr.iHeight=sBarCodeAttr.iNarrow;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iY=sBarCodeAttr.sCoord.iY-sBarCodeAttr.iWide;
}
break;
case 0:
default:
sBarAttr.sCoord.iX=sBarCodeAttr.sCoord.iX;
sBarAttr.sCoord.iY=sBarCodeAttr.sCoord.iY;
sBarAttr.iHeight=sBarCodeAttr.iHeight;
if ( (bCodedata & bCodeMask)!=0 )
{
sBarAttr.iWidth=sBarCodeAttr.iWide;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iWide;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow;
}
else
{
sBarAttr.iWidth=sBarCodeAttr.iNarrow;
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iNarrow;
DrawBar(&sBarAttr);
sBarCodeAttr.sCoord.iX=sBarCodeAttr.sCoord.iX+sBarCodeAttr.iWide;
}
break;
}
}
}
/*-----------------02-24-99 11:26-------------------
human readable is true draw text
--------------------------------------------------*/
if ( sBarCodeAttr.iHuman != 0 )
{
_TextAttr sTextAttr;
sTextAttr.sCoord.iX = psBarCodeAttr->sCoord.iX;
sTextAttr.sCoord.iY = psBarCodeAttr->sCoord.iY;
sTextAttr.iDirection = psBarCodeAttr->iRotation;
sTextAttr.iRotation = psBarCodeAttr->iRotation;
sTextAttr.iDistance = 0;
sTextAttr.iHoriMulti = psBarCodeAttr->FontHoriMulti;
sTextAttr.iVertMulti = psBarCodeAttr->FontVertMulti;
sTextAttr.ExpLength = strlen((CHAR *)bsHuman);
sTextAttr.pExp = bsHuman;
sTextAttr.pFont = psBarCodeAttr->pFont;
sTextAttr.eLanguage = psBarCodeAttr->eLanguage;
sTextAttr.ePutWay = psBarCodeAttr->ePutWay;
sTextAttr.psImageBuffer = psBarCodeAttr->psImageBuffer;
PreviewText(&sTextAttr);
switch ( psBarCodeAttr->iRotation )
{
case 90:
if ( psBarCodeAttr->AboveCode )
sTextAttr.sCoord.iX += sTextAttr.iRealHeight + TEXT_DIS;
else
sTextAttr.sCoord.iX -= psBarCodeAttr->iHeight + TEXT_DIS;
sTextAttr.sCoord.iY += psBarCodeAttr->iNarrow * QUIET_MU;
if ( psBarCodeAttr->iHuman == 2 )
sTextAttr.sCoord.iY += (psBarCodeAttr->TotalWidth - sTextAttr.iRealWidth) / 2;
else if ( psBarCodeAttr->iHuman == 3 )
sTextAttr.sCoord.iY = sBarCodeAttr.sCoord.iY - sTextAttr.iRealWidth;
break;
case 180:
if ( psBarCodeAttr->AboveCode )
sTextAttr.sCoord.iY += sTextAttr.iRealHeight + TEXT_DIS;
else
sTextAttr.sCoord.iY -= psBarCodeAttr->iHeight + TEXT_DIS;
sTextAttr.sCoord.iX -= psBarCodeAttr->iNarrow * QUIET_MU;
if ( psBarCodeAttr->iHuman == 2 )
sTextAttr.sCoord.iX -= (psBarCodeAttr->TotalWidth - sTextAttr.iRealWidth) / 2;
else if ( psBarCodeAttr->iHuman == 3 )
sTextAttr.sCoord.iX = sBarCodeAttr.sCoord.iX + sTextAttr.iRealWidth;
break;
case 270:
if ( psBarCodeAttr->AboveCode )
sTextAttr.sCoord.iX -= sTextAttr.iRealHeight + TEXT_DIS;
else
sTextAttr.sCoord.iX += psBarCodeAttr->iHeight + TEXT_DIS;
sTextAttr.sCoord.iY -= psBarCodeAttr->iNarrow * QUIET_MU;
if ( psBarCodeAttr->iHuman == 2 )
sTextAttr.sCoord.iY -= (psBarCodeAttr->TotalWidth - sTextAttr.iRealWidth) / 2;
else if ( psBarCodeAttr->iHuman == 3 )
sTextAttr.sCoord.iY = sBarCodeAttr.sCoord.iY + sTextAttr.iRealWidth;
break;
case 0:
default:
if ( psBarCodeAttr->AboveCode )
sTextAttr.sCoord.iY -= sTextAttr.iRealHeight + TEXT_DIS;
else
sTextAttr.sCoord.iY += psBarCodeAttr->iHeight + TEXT_DIS;
sTextAttr.sCoord.iX += psBarCodeAttr->iNarrow * QUIET_MU;
if ( psBarCodeAttr->iHuman == 2 )
sTextAttr.sCoord.iX += (psBarCodeAttr->TotalWidth - sTextAttr.iRealWidth) / 2;
else if ( psBarCodeAttr->iHuman == 3 )
sTextAttr.sCoord.iX = sBarCodeAttr.sCoord.iX - sTextAttr.iRealWidth;
break;
}
OutText(&sTextAttr);
psBarCodeAttr->TotalHeight += sTextAttr.iRealHeight + TEXT_DIS;
psBarCodeAttr->FontWidth = sTextAttr.iRealWidth;
psBarCodeAttr->FontHeight = sTextAttr.iRealHeight + TEXT_DIS;
}
return TRUE;
}
INT PreviewCodemsi(_BarCodeAttr *psBarCodeAttr)
{
INT TotalChar;
TotalChar = strlen((CHAR *)psBarCodeAttr->pExp);
if (psBarCodeAttr->iCheck == 0)
TotalChar += 1;
else if (psBarCodeAttr->iCheck == 1)
TotalChar += 2;
else if (psBarCodeAttr->iCheck == 2)
TotalChar += 0;
else if (psBarCodeAttr->iCheck == 3)
TotalChar += 2;
psBarCodeAttr->TotalWidth = psBarCodeAttr->iWide * 2 + psBarCodeAttr->iNarrow * 3 +
TotalChar * (psBarCodeAttr->iNarrow * 4 + psBarCodeAttr->iWide * 4) + QUIET_MU;
psBarCodeAttr->TotalHeight = psBarCodeAttr->iHeight;
if (psBarCodeAttr->eLanguage == LANG_DPL && psBarCodeAttr->iHuman)
{
_TextAttr sTextAttr;
sTextAttr.sCoord.iX = psBarCodeAttr->sCoord.iX;
sTextAttr.sCoord.iY = psBarCodeAttr->sCoord.iY;
sTextAttr.iDirection = psBarCodeAttr->iRotation;
sTextAttr.iRotation = psBarCodeAttr->iRotation;
sTextAttr.iDistance = 0;
sTextAttr.iHoriMulti = psBarCodeAttr->FontHoriMulti;
sTextAttr.iVertMulti = psBarCodeAttr->FontVertMulti;
sTextAttr.ExpLength = strlen((CHAR *)psBarCodeAttr->pExp);
sTextAttr.pExp = psBarCodeAttr->pExp;
sTextAttr.pFont = psBarCodeAttr->pFont;
sTextAttr.eLanguage = psBarCodeAttr->eLanguage;
sTextAttr.ePutWay = psBarCodeAttr->ePutWay;
sTextAttr.psImageBuffer = psBarCodeAttr->psImageBuffer;
PreviewText(&sTextAttr);
psBarCodeAttr->TotalHeight += sTextAttr.iRealHeight + TEXT_DIS;
psBarCodeAttr->FontWidth = sTextAttr.iRealWidth;
psBarCodeAttr->FontHeight = sTextAttr.iRealHeight + TEXT_DIS;
}
return TRUE;
}