⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gpctext.c

📁 使用键盘上的上、下、左、右四个按键
💻 C
字号:
//------------------------------------------------------------------------------
// File:        gpcText.c
// Date:        2001-6-11 pm 05:19:27
// Written by:  CYu
// Decription:  
// Modification record
//------------------------------------------------------------------------------
// Copyright:   EPSON Proprietary Material
//              Copyright (c) 2001, All Rights Reserved
//              SHANGHAI EPSON ELECTRONICS CO., LTD.
//
//              DISTRIBUTION PROHIBITED without written authorization from EPSON
//------------------------------------------------------------------------------
#include <gpc.h>
//--- macro and definition -----------------------------------------------------

//--- static variables ---------------------------------------------------------
//--- external variables -------------------------------------------------------
//--- shared variables ---------------------------------------------------------
//--- static functions ---------------------------------------------------------
//--- external functions -------------------------------------------------------
extern gpcGCValues gpcGC;

//-------------------------------------------------------------------------
//    gpcText()
//
//  Draw text in the x, y with text's length.
//  8bit per pixel
//
//  Parameters:
//      x       - Position X of start text.
//      y       - Position Y of start text.
//      text   - Point to text.
//      length - length of text.
//    Returns:
//      GPC_ERR_OK
//-------------------------------------------------------------------------
U16 gpcText( S16 x, S16 y, U8 *text, S16 length )
{
    int i;
    U32 ulFont2Start;
    PHYIMAGEINFO pii;

    pii.method = GPC_COPY_PUT;
    pii.ColorIndex = gpcGC.GCColorIndex;
    pii.BkColorIndex = gpcGC.GCBkColorIndex;

    for(i=0;i<length;i++)
    {
        pii.x = x;
        pii.y = y;
        // Check Font Byte ( 1:1Byte, 2:2Byte )
        switch( gpcCheckFontByte( text+i ) )
        {
            case 1:
                // 2000.04.20 Add by Shin :: Check No Font
                if(!gpcGC.GCFont1)
                    continue;
                pii.buffer = gpcGC.GCFont1 + gpcGC.GCFont1Height * text[i];
                pii.width = gpcGC.GCFont1Width;
                pii.height = gpcGC.GCFont1Height;
                break;
            case 2:
                // 2000.04.20 Add by Shin :: Check No Font
                if(!gpcGC.GCFont2)
                {
                    i++;
                    continue;
                }
                // Count Font2 patten Start Point
                ulFont2Start = gpcFont2StartPoint(text+i);
                i++;
                if(!ulFont2Start)// if font is not exist in font file, next font process
                    continue;
                pii.buffer = gpcGC.GCFont2 + ulFont2Start * 2 * gpcGC.GCFont2Height; 
                pii.width = gpcGC.GCFont2Width;
                pii.height = gpcGC.GCFont2Height;
                break;
            default:
                break;
        }


        seSetMonoImage( &pii );
        x += pii.width;
    }
    return GPC_ERR_OK;
}

//----------------------------- The End of the File ----------------------------

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -