📄 gpcfont.c
字号:
continue;
case 0x0d: //忽略此换行符
str++;
continue;
case '\t':
str++;
x += pii.width;
if( x > xDes+1 )
quit = 1;
continue;
default:
str++;
continue;
}
}
//2001.10.25
x += pii.width;
if ( x <= xDes + 1 )
{
str++;
sePutChar( pGC, &pii );
}
else
{
pii.x = xSrc;
y += pii.height;
if ( y + pii.height > yDes + 1 )
break;
else
{
pii.y = y;
str++;
sePutChar( pGC, &pii );
}
x = xSrc + pii.width;
}
}
if( pGC == gSysTcbTbl[ gLcdOwnerTskId-1 ].gc && pGC->group_operation == 0 )
WRITELCD( xSrc, ySrc, xDes, yDes ) //WRITELCD( topx, endx, topy, endy )
// seWrite2LCD( pGC->vram, 0);
return GPC_ERR_OK;
}
STATUS SysTextOut(DWORD gc, DWORD rgb, WORD xSrc, WORD ySrc, PBYTE text, WORD style)
{
GC *pGC;
WORD i, x, y;
DWORD ulFont2Start, font1size, font2size, length;
PHYIMAGEINFO pii;
PIXEL frtcolor;//, bkcolor;
WORD quit = 0;
pGC = ( GC* )gc;
if ( pGC == NULL || pGC->symbol != GPC_GC_SYMBOL )
return GPC_ERR_FAILED;
if ( text == NULL )
return GPC_ERR_FAILED;
// over the screen
if ( xSrc >= pGC->width || ySrc >= pGC->height )
return GPC_ERR_FAILED;
if ( pGC->font->Font1 != 0 )
font1size = pGC->font->Font1Height * ( ( pGC->font->Font1Width + 7 )>>3 );
else
font1size = 0;
if( pGC->font->Font2 != 0 )
font2size = pGC->font->Font2Height * ( ( pGC->font->Font2Width + 7 )>>3 );
else
font2size = 0;
if ( !font1size && !font2size )
return GPC_ERR_FAILED;
if ( ySrc + pGC->font->Font2Height > pGC->height )
return GPC_ERR_FAILED;
// if( style < GPC_MIN_STYLE || style > GPC_MAX_STYLE )
// return GPC_ERR_FAILED;
pii.method = style;
pii.mode = GPC_TRANSPARENT_STYLE;
seRGBtoIndex( (DWORD)(rgb), &frtcolor );
//seRGBtoIndex( (DWORD)(gc->bk_color), &bkcolor );
pii.ColorIndex = frtcolor;
//pii.BkColorIndex = bkcolor;
length = strlen( text );
x = xSrc;
y = ySrc;
for ( i = 0; i < length && quit != 1 ; 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 ( font1size == 0 )
continue;
pii.buffer = pGC->font->Font1 + font1size * ( text[i] - ' ' );
pii.width = pGC->font->Font1Width;
pii.height = pGC->font->Font1Height;
break;
case 2:
// 2000.04.20 Add by Shin :: Check No Font
i++;
if( text[i] & 0x80 == 0x00 )
{
quit = 1;
continue;
}
if ( font2size == 0 )
continue;
// Count Font2 patten Start Point
if ( i >= length )
continue;
ulFont2Start = ( *( text + i - 1 )- 161 )*94 + ( *( text + i )- 161 );
//if( ulFont2Start )
// continue;
pii.buffer = pGC->font->Font2 + ulFont2Start * font2size;
pii.width = pGC->font->Font2Width;
pii.height = pGC->font->Font2Height;
break;
default:
continue;
}
//2001.10.25
if ( (pii.x + pii.width) <= pGC->width )
sePutChar( pGC, &pii );
else
{
if( x == xSrc )
return GPC_ERR_FAILED;
else
break;
}
x += pii.width;
}
if( pGC == gSysTcbTbl[ gLcdOwnerTskId-1 ].gc && pGC->group_operation == 0 )
WRITELCD( xSrc, ySrc, xSrc + (SHORT)(length) * pii.width - 1, ySrc + pii.height - 1 ) //WRITELCD( topx, endx, topy, endy )
// seWrite2LCD( pGC->vram, 0);
return GPC_ERR_OK;
}
STATUS SysTextOutEx(DWORD gc, DWORD rgb, WORD xSrc, WORD ySrc, PBYTE text, WORD length, WORD style, WORD exstyle, DWORD bkrgb)
{
GC *pGC;
WORD i, x, y;
DWORD ulFont2Start, font1size, font2size;
PHYIMAGEINFO pii;
PIXEL frtcolor, bkcolor;
WORD quit = 0;
pGC = ( GC* )gc;
if ( pGC == NULL || pGC->symbol != GPC_GC_SYMBOL )
return GPC_ERR_FAILED;
if ( text == NULL )
return GPC_ERR_FAILED;
// over the screen
if ( xSrc > (pGC->width - 1) || ySrc > (pGC->height - 1) )
return GPC_ERR_FAILED;
if ( pGC->font->Font1 != 0 )
font1size = pGC->font->Font1Height * ( ( pGC->font->Font1Width + 7 ) / 8 );
else
font1size = 0;
if ( pGC->font->Font2 != 0 )
font2size = pGC->font->Font2Height * ( ( pGC->font->Font2Width + 7 ) / 8 );
else
font2size = 0;
if ( !font1size && !font2size )
return GPC_ERR_FAILED;
if ( ySrc + pGC->font->Font2Height > pGC->height )
return GPC_ERR_FAILED;
// if( style < GPC_MIN_STYLE || style > GPC_MAX_STYLE )
// return GPC_ERR_FAILED;
pii.method = style;
pii.mode = exstyle;
seRGBtoIndex( (DWORD)(rgb), &frtcolor );
seRGBtoIndex( (DWORD)(bkrgb), &bkcolor );
pii.ColorIndex = frtcolor;
pii.BkColorIndex = bkcolor;
x = xSrc;
y = ySrc;
for ( i = 0; i < length && text[i] != '\0'; 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( font1size == 0 )
continue;
pii.buffer = pGC->font->Font1 + font1size * ( text[i] - ' ' );
pii.width = pGC->font->Font1Width;
pii.height = pGC->font->Font1Height;
break;
case 2:
// 2000.04.20 Add by Shin :: Check No Font
i++;
if( text[i] & 0x80 == 0x00 )
{
quit = 1;
continue;
}
if( font2size == 0 )
continue;
// Count Font2 patten Start Point
if( i >= length )
continue;
ulFont2Start = ( *( text + i - 1 )- 161 )*94 + ( *( text + i )- 161 );
//if( ulFont2Start )
// continue;
pii.buffer = pGC->font->Font2 + ulFont2Start * font2size;
pii.width = pGC->font->Font2Width;
pii.height = pGC->font->Font2Height;
break;
default:
continue;
}
//2001.10.25
if ( (pii.x + pii.width) <= pGC->width )
sePutChar( pGC, &pii );
else
{
if( x == xSrc )
return GPC_ERR_FAILED;
else
break;
}
x += pii.width;
}
if( pGC == gSysTcbTbl[ gLcdOwnerTskId-1 ].gc && pGC->group_operation == 0 )
WRITELCD( xSrc, ySrc, xSrc + (SHORT)(length) * pii.width - 1, ySrc + pii.height - 1 )//WRITELCD( topx, endx, topy, endy )
// seWrite2LCD( pGC->vram, 0);
return GPC_ERR_OK;
}
WORD SysAlignString( PBYTE string, WORD winXSrc, WORD winXWidth, BYTE align )
{
WORD len;
WORD xSrc = winXSrc;
if( string == NULL )
return xSrc;
len = (WORD)strlen( string ) * ENGLISH_CHAR_WIDTH;
if( len < winXWidth )
{
switch( align )
{
case GPC_ALIGN_CENTER:
xSrc += ( ( winXWidth - len ) >> 1 );
break;
case GPC_ALIGN_LEFT:
break;
case GPC_ALIGN_RIGHT:
xSrc += ( winXWidth - len );
break;
}
}
return xSrc;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -