GBDKライブラリドキュメント
GBDK libraries documentation

Prev
5章 ライブラリ
Chapter 5.Libraries

複数のフォントのサポート - font.h
Support for multiple fonts - font.h

関数
Functions

init_font
init_font

void init_font(void)
フォントハンドルをすべてクリアし、タイルをすべてリリースすることにより、フォントシステムを初期化します。
Initialise the font system by clearing all font handles and releasing all tiles.

解説
Description

フォントシステムを初期化します。 このルーチンは load_font に任意の呼び出しの前にプログラムの最初に呼ばれたほうがよい。
Initialises the font system.This routine should be called at the start of the program before any calls to load_font.

引数
Parameters

無。
None.

返り値
Returns

無。
Nothing.

load_font
load_font

FONT_HANDLE load_font( void *font_structure )
成功や失敗中のNULL上の FONT_HANDLE を返して、フォントフォントをロードすることを試みます。
Attempt to load the font font, returning a FONT_HANDLE on success or NULL on failure.

解説
Description

一度各フォントについては、それが要求されれば、load_fontが呼ばれたほうがよい。 現在、unload_fontサポートがないことに注意してください。
load_font should be called once for each font that is required.Note that currently there is no unload_font support.

引数
Parameters

フォント:有効なフォント構造体の基礎へのポインタ
font: pointer to the base of a valid font structure

返り値
Returns

成功した場合、 FONT_HANDLE を返します。 失敗した場合、NULL(0)を返します。
On success, returns a FONT_HANDLE.On failure, returns NULL (0)

set_font
set_font

void set_font( FONT_HANDLE font_handle )
以前にロードしたフォントfont_handleに現在のフォントをセットします。
Set the current font to the previously loaded font font_handle

解説
Description

set_fontは現在の出力フォントをfont_handleによって指定されるものに変更します。
set_font changes current output font to the one specified by font_handle

引数
Parameters

font_handle:前の load_font 呼び出しからのハンドル。
font_handle: handle from a previous load_font call.

返り値
Returns

無。
Nothing.

バグ
Bugs

font_handleが有効なフォントハンドルかどうか確かめるチェックはされません。
No check is made to see if font_handle is a valid font handle.

mprint_string
mprint_string

void mprint_string( char *string )
現在のフォントを使用して、string文字列を表示します。
Print string string using the current font.

解説
Description

これはフォントライブラリをテストするために使用される一時的なルーチンです。
This is a temporary routine used to test the font library.

引数
Parameters

string: 0で終了する表示文字列。
string: null terminated string to print.

返り値
Returns

無。
Nothing.

データ型
Data types

FONT_HANDLE:UWORD
FONT_HANDLE: UWORD

解説
Description

FONT_HANDLEは load_font から返され、 set_font によって使用される16ビットの値です。 物理的に、それはfont_tableのエントリへのポインタです。
A FONT_HANDLE is a 16 bit value returned from load_font and used by set_font.Physically it is a pointer to an entry in the font_table.

font_structure
font_structure

解説
Description

font_structureは、 コード化されたデータタイル (bitmap)イメージデータを含むフォントと関係したデータ用のコンテナです。 コード化テーブルとタイルデータの可変長さ性質により、デフォルトC構造体は存在しません。
A font_structure is a container for the data related to a font, including the encoding data and tile (bitmap) image data.Due to the variable length nature of the encoding table and the tile data no default C structure exists.

形式
Format

フォント構造体は、4つのフィールド-フォントタイプ、使用されるタイルの数、コード化テーブルとタイルデータ-から構成されます。
A font structure is made up of four fields - the font type, the number of tiles used, the encoding table and the tile data.

type:UBYTE
type: UBYTE

フォントタイプはコード化テーブルとタイルデータの形式について解説するシングルビットです。 コード化テーブル長さは低位2ビットによって指定されます。 00:256バイトのコード化テーブル 01:128バイトのコード化テーブル 10と11が予約されます。 第3ビット(0x04)はタイルデータが圧縮されるかどうか決めるために使用されます。 多くのタイルは、灰色の濃淡を使用せず、したがって、16の代わりに8バイトで表わすことができます。 ビット2がセットされる場合、タイルは長さ8バイトと仮定され、ロード段階で16バイトまで拡張します。
The Font type is a single bit that describes the encoding table and the format of the tile data.The encoding table length is specified by the lower two bits 00: 256 byte encoding table 01: 128 byte encoding table 10 and 11 are reserved.The third bit (0x04) is used to determine if the tile data is compressed.Many tiles do not use shades of grey, and so can be represented in 8 bytes instead of 16.If bit 2 is set, then the tiles are assumed to be 8 bytes long and are expanded to 16 bytes at the load stage.

num_tiles:UBYTE
num_tiles: UBYTE

num_tilesは、タイルデータの中に、と従ってあるタイルの数を与えます、フォントによって要求されるタイルの数。
num_tiles gives the number of tiles present in the tile data and hence the number of tiles required by the font.

encoding:UBYTEの配列
encoding: array of UBYTE

コード化テーブルはタイルデータ中の適切なタイルにASCII文字を写像する配列です。 例えば、文字「A」が第10のタイルだったと仮定します。 その場合、コード化テーブル中の第65の(「A」のためのASCIIコード)エントリは、10である。 対応するタイルがないいかなるASCII特徴もデフォルトタイルに写像されるほうがよい。 スペースはタイルを推薦されます。
The encoding table is an array that maps an ASCII character to the appropriate tile in the tile data.For example, suppose that the letter 'A' was the tenth tile.Then the 65th (the ASCII code for 'A') entry in the encoding table would be 10.Any ASCII characters that don't have a corresponding tile should be mapped to a default tile.Space is recommended tile.

tile_data:UBYTEの配列
tile_data: array of UBYTE

最終フィールドは実際のタイルデータです。 0からのスタートに番号を付けるそのタイルに注意してください。
The final field is the actual tile data.Note that tile numbering starts from zero.



Prev
ホーム
Home
malloc、freeと関連した関数 - stdlib.h
malloc, free and related functions - stdlib.h

Up
 1