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

📄 guirawbitmap.c

📁 The combined demo is dedicated for S1C33L05, so DMT33L05 should be used to load and run the demo. F
💻 C
字号:
/* $id: guiRawbitmap.c V1.0 2001/11/5 */
/***************************************************************************
 *    This source code has been made available to you by EPSON on an AS-IS
 *    basis. Anyone receiving this source is licensed under EPSON
 *    copyrights to use it in any way he or she deems fit, including
 *    copying it, modifying it, compiling it, and redistributing it either
 *    with or without modifications.
 *
 *    Any person who transfers this source code or any derivative work
 *    must include the EPSON copyright notice, this paragraph, and the
 *    preceding two paragraphs in the transferred software.
 *
 *    COPYRIGHT   EPSON  CORPORATION 2001
 *    LICENSED MATERIAL  -  PROGRAM PROPERTY OF EPSON
 **************************************************************************/


/***************************************************************************
 * FILE: guiRawbitmap.c
 * MODULE: FONT
 *
 * PURPOSE: The management of Raw Bitmap Font operation set .
 *
 *
 * AUTHOR(S): ZhaoJZ
 * GROUP: GUI Group
 * DATE CREATED: 2001/11/5
 * REFERENCE DOCUMENT ID:
 * MODIFICATIONS:
 *    Date           userName          Description
 *    2001/11/5      ZhaoJZ            Create this file
 **************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "sysGUI.h"

//#include "guiTotal.h"
#include "guiFont.h"

#include "guiCharset.h"
#include "guiDevfont.h"
#include "guiRawbitmap.h"
#include "guiFontname.h"
/*************** Raw bitmap font operations *********************************/
T_MODULE T_WORD get_char_width(
				T_GUI_LogFont *logfont,
				T_GUI_DevFont *devfont,
				T_CONST T_UBYTE *mchar,
				T_WORD len
				)
{
    return RBFONT_INFO_P(devfont)->width;
}

T_MODULE T_WORD get_str_width(
				T_GUI_LogFont *logfont,
				T_GUI_DevFont *devfont,
				T_CONST T_UBYTE *mstr,
				T_WORD len,
				T_WORD cExtra
				)
{
    T_WORD number;

    number = (*devfont->charset_ops->nr_chars_in_str)(mstr, len);
    return (RBFONT_INFO_P(devfont)->width + cExtra ) *number;
}

T_MODULE T_WORD get_ave_width(T_GUI_LogFont *logfont, T_GUI_DevFont *devfont)
{
    return RBFONT_INFO_P(devfont)->width;
}

T_MODULE T_WORD get_font_height(T_GUI_LogFont *logfont, T_GUI_DevFont *devfont)
{
    return RBFONT_INFO_P(devfont)->height;
}

T_MODULE T_WORD get_font_size(T_GUI_LogFont *logfont, T_GUI_DevFont *devfont, T_WORD expect)
{
    return RBFONT_INFO_P(devfont)->height;
}

T_MODULE T_WORD get_font_descent(T_GUI_LogFont *logfont, T_GUI_DevFont *devfont)
{
    return 0;
}

/* get the bytes occupied by the character */
T_MODULE T_GUI_SIZE char_bitmap_size(
				    T_GUI_LogFont *logfont,
		   		    T_GUI_DevFont *devfont,
				    T_CONST T_UBYTE *mchar,
				    T_WORD len
				    )
{
    return ((RBFONT_INFO_P(devfont)->width + 7) >> 3)
                * RBFONT_INFO_P(devfont)->height;
}

T_MODULE T_GUI_SIZE max_bitmap_size(T_GUI_LogFont *logfont, T_GUI_DevFont *devfont)
{
    return ((RBFONT_INFO_P(devfont)->width + 7) >> 3)
                * RBFONT_INFO_P(devfont)->height;
}

/* get the character's lattic */
T_MODULE T_CONST T_VOID* get_char_bitmap(
						 T_GUI_LogFont *logfont,
						 T_GUI_DevFont *devfont,
						 T_CONST T_UBYTE *mchar,
						 T_WORD len
						 )
{
    T_WORD bitmap_size;
    T_WORD offset;

/* get the offset position of the character in the character set table*/
    offset = (*devfont->charset_ops->char_offset)(mchar);

    if(offset >= RBFONT_INFO_P(devfont)->font_size)
        offset = (*devfont->charset_ops->char_offset)(devfont->charset_ops->def_char);

    bitmap_size = ((RBFONT_INFO_P(devfont)->width + 7) >> 3)
                        * RBFONT_INFO_P(devfont)->height;

    return RBFONT_INFO_P(devfont)->font + bitmap_size * offset;
}


/* define the operations of rawbitmap font */
T_GUI_FontOps raw_bitmap_font_ops =
{
    get_char_width,
    get_str_width,
    get_ave_width,
    get_ave_width,
    get_font_height,
    get_font_size,
    get_font_height,
    get_font_descent,
    char_bitmap_size,
    max_bitmap_size,
    get_char_bitmap,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
};

⌨️ 快捷键说明

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