GadgetSeed  0.9.6
font.c
[詳解]
1 /** @file
2  @brief フォント
3 
4  @date 2007.03.25
5  @author Takashi SHUDO
6 
7  @page font_draw フォント描画
8 
9  GadgetSeedは表示デバイスへの文字フォント描画機能があります。\n
10  フォントは複数の種類を持つことができます。\n
11  またそれぞれのフォントは異なる文字の大きさやデザインを定義することができます。\n
12  GadgeeSeedでは選択できるフォントの単位をフォントセット @ref st_fontset として定義しています。
13 
14  フォント描画を使用するには、以下のコンフィグ項目を有効にして下さい。
15 
16  * COMP_ENABLE_FONTS
17 
18 
19  ---
20  @section フォントセット
21 
22  GadgetSeedは使用するフォントセットを @ref configration で選択することができます。
23 
24  @subsection フォントセット構造体
25 
26  フォントセットは以下の構造体で定義されます。
27 
28  @ref st_fontset @copybrief st_fontset
29 
30  フォントセット構造体は1種類のフォントセットを定義するデータ構造です。\n
31  フォントセット構造体は以下の組み合わせのフォントデータ @ref st_font を定義することが出来ます。\n
32 
33  - 半角フォントデータのみ
34  - 半角フォントデータと全角フォントデータ
35 
36  それぞれのフォントデータは以下のように定義しています。
37 
38  - 半角フォントデータ - 文字コードが1バイトで0x00 - 0xFFの文字
39  - 全角フォントデータ - 文字コードが2バイト以上の文字
40 
41  全角フォントは主に漢字文字を示しています。
42 
43  @subsection フォントデータ構造体
44 
45  フォントデータは以下の構造体で定義されています。
46 
47  @ref st_font @copybrief st_font
48 
49 
50  ---
51  @section 文字描画API
52 
53  include ファイル : font.h
54 
55  | API名 | 機能 |
56  |:--------------------------|:--------------------------------------|
57  | set_fontset() | @copybrief set_fontset |
58  | get_fontset() | @copybrief get_fontset |
59  | fontset_count() | @copybrief fontset_count |
60  | fontset_name() | @copybrief fontset_name |
61  | get_fontptr_by_name() | @copybrief get_fontptr_by_name |
62  | set_font_by_name() | @copybrief set_font_by_name |
63  | set_font_drawmode() | @copybrief set_font_drawmode |
64  | draw_char() | @copybrief draw_char |
65  | draw_str() | @copybrief draw_str |
66  | draw_fixed_width_str() | @copybrief draw_fixed_width_str |
67  | draw_str_in_box() | @copybrief draw_str_in_box |
68  | font_width() | @copybrief font_width |
69  | str_width() | @copybrief str_width |
70  | font_height() | @copybrief font_height |
71 
72 
73  ---
74  @section フォントデータの作成
75 
76  @subsection テキストデータからのフォントデータ作成
77 
78  以下のような文字イメージを記載したテキストデータからフォントデータのCソースを作成するツールを使用することができます。
79 
80  # 0x41 0 8 A
81  . . X X X . . .
82  . X X X X X . .
83  X X X . X X X .
84  X X . . . X X .
85  X X . . . X X .
86  X X . . . X X .
87  X X . . . X X .
88  X X X X X X X .
89  X X X X X X X .
90  X X . . . X X .
91  X X . . . X X .
92  X X . . . X X .
93  X X . . . X X .
94  X X . . . X X .
95  X X . . . X X .
96  . . . . . . . .
97 
98  "8x16"フォントは以下のテキストデータを使用して作成されています。
99 
100  fontdata/8x16/font_8x16.txt
101 
102  テキストデータからのCソースデータの作成手順は以下のMakefileを参照してください。
103 
104  fontdata/8x16/Makefile
105  fontdata/txt2font.mk
106 
107  @subsection BDFフォントからのフォントデータ作成
108 
109  BDFフォントからフォントデータを作成することができます。
110 
111  "jiskan16"フォントはBDFフォントのjiskan16より作成されています。
112 
113  BDFフォントからのCソースデータの作成手順は以下のMakefileを参照してください。
114 
115  fontdata/jiskan16/Makefile
116  fontdata/bdf2dbfont.mk
117 
118  @subsection OTF、TTFフォントからのフォントデータ作成
119 
120  OTFフォントやTTFフォントからフォントデータを作成することができます。
121  これは、実験的な試みです。
122 */
123 
124 #include "font.h"
125 #include "graphics.h"
126 #include "str.h"
127 #include "tkprintf.h"
128 #include "charcode.h"
129 
130 //#define DEBUGTBITS 0x01
131 #include "dtprintf.h"
132 
133 
134 extern const struct st_fontset * const * const font_list[];
135 
136 static struct st_fontset *now_fontset;
137 static int font_dmode;
138 
139 void init_font(void)
140 {
141  font_dmode = FONT_FIXEDWIDTH;
142  now_fontset = (struct st_fontset *)*font_list[0];
143 }
144 
145 /**
146  @brief 描画に使用するフォントセット(カレントフォントセット)を設定する
147 
148  @param[in] fontset 描画に使用するフォントセット
149 */
150 void set_fontset(struct st_fontset *fontset)
151 {
152  now_fontset = fontset;
153 }
154 
155 /**
156  @brief 描画に使用されているフォントセット(カレントフォントセット)取得する
157 
158  @return 描画に使用するフォントセット
159 */
160 struct st_fontset * get_fontset(void)
161 {
162  return now_fontset;
163 }
164 
165 /**
166  @brief 登録されているフォントセットの数を取得する
167 
168  @return フォントセットの数
169 */
170 int fontset_count(void)
171 {
172  int i = 0;
173 
174  while(font_list[i]) {
175  i++;
176  }
177 
178  return i;
179 }
180 
181 /**
182  @brief フォント名を取得する
183 
184  @param[in] num フォント番号
185 
186  @return フォント名
187 */
188 const char *fontset_name(int num)
189 {
190  return (*font_list[num])->name;
191 }
192 
193 /**
194  @brief フォントセットのポインタを取得する
195 
196  @param[in] name フォント名
197 
198  @return フォントセットポインタ
199 */
201 {
202  int i = 0;
203 
204  DTFPRINTF(0x01, "name = %s\n", name);
205 
206  while(font_list[i]) {
207  DTPRINTF(0x01, "Fined %s\n", (*font_list[i])->name);
208  if(strcomp((unsigned char *)name, (unsigned char *)((*font_list[i])->name)) == 0) {
209  return (struct st_fontset *)*font_list[i];
210  }
211  i++;
212  }
213 
214  SYSERR_PRINT("Cannot find fontname \"%s\"\n", name);
215 
216  return 0;
217 }
218 
219 /**
220  @brief カレントフォントセットをフォント名で設定する
221 
222  @param[in] name フォント名
223 
224  @return カレントフォントセットポインタ
225 */
227 {
228  struct st_fontset *font;
229 
230  font = get_fontptr_by_name(name);
231 
232  if(font != 0) {
233  now_fontset = font;
234  return now_fontset;
235  }
236 
237  return 0;
238 }
239 
240 /**
241  @brief フォント描画モードを設定する
242 
243  @param[in] mode フォント描画モード
244 
245  @info mode は @ref FONT_FIXEDWIDTH または @ref FONT_PROPORTIONAL が設定可能
246 */
247 void set_font_drawmode(int mode)
248 {
249  font_dmode = mode;
250 }
251 
252 static void draw_nofont(short x, short y, struct st_font *ft)
253 {
254  struct st_rect rect;
255 
256  rect.left = x;
257  rect.top = y;
258  rect.right = x + ft->width;
259  rect.bottom = y + ft->height;
260 
262  draw_fill_rect(&rect);
264  draw_rect(&rect);
265  draw_line(x, y, rect.right, rect.bottom);
266 }
267 
268 static struct st_font *get_fontdata(unsigned short code)
269 {
270  struct st_font *ft = 0;
271 
272  if(code <= 0xff) {
273  ft = now_fontset->font;
274  } else {
275 #ifdef GSC_FONTS_ENABLE_KANJI // $gsc 漢字フォントの描画を有効にする
276  if(now_fontset->w_font != 0) {
277  ft = now_fontset->w_font;
278  } else {
279  ft = now_fontset->font;
280  }
281 #endif
282  }
283 
284  return ft;
285 }
286 
287 static signed char *get_char_bitmap(unsigned short code, struct st_font *ft)
288 {
289  signed char *fontp = 0;
290  int cseg = (code >> 8);
291  int start, end;
292  int lcode = (code & 0xff);
293  unsigned int **indexp, *index;
294  unsigned int offset;
295 
296  DTPRINTF(0x01, "SEG : %d %04X\n", cseg, code);
297 
298  indexp = (unsigned int **)ft->index;
299  index = indexp[cseg];
300  DTPRINTF(0x01, "INDEX : %p\n", index);
301  if(index == 0) {
302  return 0;
303  }
304 
305  start = index[0];
306  end = index[1];
307 
308  DTPRINTF(0x01, "START : %08X\n", start);
309  DTPRINTF(0x01, "END : %08X\n", end);
310 
311  if((lcode < start) || (lcode > end)) {
312  fontp = 0;
313  } else {
314  offset = index[lcode - start + 2]; // 最初の2つはstart,endデータ
315  DTPRINTF(0x01, "OFFSET : %08X\n", offset);
316  if(offset != 0xffffffff) {
317  fontp = &(ft->bitmap[offset]);
318  } else {
319  fontp = 0;
320  }
321  }
322 
323  return fontp;
324 }
325 
326 #define MAX_FONT_WIDTH 40
327 #define MAX_FONT_HEIGHT 40
328 
329 static unsigned char font_bitmap[(MAX_FONT_WIDTH/8) * MAX_FONT_HEIGHT];
330 
331 static unsigned char *create_font_bitmap(signed char *fdata, short fwidth, short fheight)
332 {
333  short dwidth = 0;
334  short width = 0;
335  short height = 0;
336  short ox = 0;
337  short oy = 0;
338  unsigned char *ddata, *sdata;
339  int top = 0;
340  int dlbytes = 0;
341  int slbytes = 0;
342  int i, j;
343 
344  dwidth = (short)(*(fdata + 0));
345  width = (short)(*(fdata + 1));
346  height = (short)(*(fdata + 2));
347  ox = (short)(*(fdata + 3));
348  oy = (short)(*(fdata + 4));
349 
350  if((fwidth == width) && (ox == 0) && (oy == 0)) {
351  DTPRINTF(0x01, "No need to create font bitmap data\n");
352  return (unsigned char *)(fdata + 5);
353  }
354 
355  ddata = &font_bitmap[0];
356  sdata = (unsigned char *)(fdata + 5);
357  slbytes = (width+7)/8;
358  dlbytes = (dwidth+7)/8;
359 
360  DTPRINTF(0x01, "Font height %d\n", fheight);
361  DTPRINTF(0x01, "dwidth : %d\n", dwidth);
362  DTPRINTF(0x01, "width : %d\n", width);
363  DTPRINTF(0x01, "height : %d\n", height);
364  DTPRINTF(0x01, "slbytes: %d\n", slbytes);
365  DTPRINTF(0x01, "dlbytes: %d\n", dlbytes);
366  DTPRINTF(0x01, "ox : %d\n", ox);
367  DTPRINTF(0x01, "oy : %d\n", oy);
368 
369  top = fheight-height-oy;
370  DTPRINTF(0x01, "TOP : %d\n", top);
371 
372  // 上の空白
373  for(i=0; i<(top * dlbytes); i++) {
374  *ddata = 0;
375  ddata ++;
376  }
377 
378  // ビットマップデータの作成
379  for(i=0; i<height; i++) {
380  unsigned char *dp, *sp;
381  dp = ddata;
382  sp = sdata;
383  *dp = 0;
384  *(dp+1) = 0;
385  *(dp+2) = 0;
386  *(dp+3) = 0; // 32(ドット)以上のoxになるとゴミが出る
387  for(j=0; j<slbytes; j++) {
388  if(ox != 0) {
389  if(ox > 0) {
390  *(dp + (ox/8)) |= ((*sp) >> (ox & 7));
391  if((ox & 7) != 0) {
392  *(dp + (ox/8) + 1) = ((*sp) << (8 - (ox & 7)));
393  }
394  } else {
395  short aox = (0 - ox);
396  *(dp + (aox/8)) |= ((*sp) << (aox & 7));
397  if((aox & 7) != 0) {
398  *(dp + (aox/8) + 1) = ((*sp) >> (8 - (aox & 7)));
399  }
400  }
401  } else {
402  *dp = *sp;
403  }
404  dp ++;
405  sp ++;
406  }
407  ddata += dlbytes;
408  sdata += slbytes;
409  }
410 
411  // 下の空白
412  if((top+height) < fheight) {
413  int count = (fheight-(top+height)) * dlbytes;
414  for(i=0; i<count; i++) {
415  *ddata = 0;
416  ddata ++;
417  }
418  }
419 
420  XDUMP(0x02, (unsigned char *)(fdata + 5), slbytes * height);
421  XDUMP(0x02, font_bitmap, dlbytes * fheight);
422 
423  return font_bitmap;
424 }
425 
426 /**
427  @brief 文字を描画する
428 
429  @param[in] x 描画X座標
430  @param[in] y 描画Y座標
431  @param[in] ch 描画文字コード(UTF-16)
432 */
433 unsigned short draw_char(short x, short y, unsigned short ch)
434 {
435  signed char *ip;
436  unsigned char *fp;
437  struct st_font *ft;
438  short dwidth = 0;
439 
440  DTFPRINTF(0x02, "CH : %04X\n", ch);
441 #ifdef DEBUGTBITS
442  {
443  unsigned char str[4] = {0, 0, 0, 0};
444  utf16code_to_utf8code(str, ch);
445  DTPRINTF(0x01, "CH : \"%s\"\n", str);
446  }
447 #endif
448 
449  ft = get_fontdata(ch);
450  if(ft == 0) {
451  return 0;
452  }
453 
454  DTPRINTF(0x02, "start - end : %04X - %04X\n", ft->start, ft->end);
455 
456  ip = get_char_bitmap(ch, ft);
457  if(ip == 0) {
458  DTPRINTF(0x04, "No font ch 0x%04x\n", ch);
459  draw_nofont(x, y, ft);
460  return (unsigned short)ft->width;
461  }
462 
463  dwidth = (short)(*(ip + 0));
464 
465  fp = create_font_bitmap(ip, ft->width, ft->height);
466  draw_bitdata(x, y, dwidth, ft->height, fp, (dwidth+7)/8);
467 
468 #if DEBUGTBITS > 0
469  {
470  struct st_box fbox;
471  unsigned int lcolor;
472 
473  fbox.pos.x = x;
474  fbox.pos.y = y;
475  //fbox.sur.width = ft->width;
476  fbox.sur.width = (*(ip + 0));
477  fbox.sur.height = ft->height;
478  lcolor = get_forecolor();
479  set_forecolor(RGB(255,0,0));
480  draw_box(&fbox);
481  set_forecolor(lcolor);
482  }
483 #endif
484  return (unsigned short)dwidth;
485 }
486 
487 /**
488  @brief 文字列を描画する
489 
490  @param[in] x 描画X座標
491  @param[in] y 描画Y座標
492  @param[in] ch 描画文字列(UTF-16)
493 */
494 void draw_str(short x, short y, uchar *str)
495 {
496  ushort code;
497  int len = 0;
498 
499  while((*str) != 0) {
500  XDUMP(0x02, str, 3);
501 #ifdef GSC_FONTS_ENABLE_KANJI
502  len = utf8code_to_utf16code(&code, str);
503  DTFPRINTF(0x02, "0x%04X\n", (int)code);
504 #else
505  code = *str;
506  len = 1;
507 #endif
508  x += draw_char(x, y, code);
509  str += len;
510  }
511 }
512 
513 /**
514  @brief 固定幅で文字列を描画する
515 
516  @param[in] x 描画X座標
517  @param[in] y 描画Y座標
518  @param[in] ch 描画文字列(UTF-16)
519 */
520 void draw_fixed_width_str(short x, short y, uchar *str, short width)
521 {
522  ushort code;
523  int len = 0;
524  int fwidth = 0, dwidth = 0;
525 
526  while((*str) != 0) {
527  XDUMP(0x02, str, 3);
528 #ifdef GSC_FONTS_ENABLE_KANJI
529  len = utf8code_to_utf16code(&code, str);
530  DTFPRINTF(0x02, "0x%04X\n", (int)code);
531 #else
532  code = *str;
533  len = 1;
534 #endif
535  fwidth = font_width(code);
536  if((dwidth + fwidth) <= width) {
537  dwidth += fwidth;
538  x += draw_char(x, y, code);
539  str += len;
540  } else {
541  // 全てかけない文字は描かない [TODO]欠けても文字を描く
542  break;
543  }
544  }
545 
546  DTFPRINTF(0x01, "dwidth=%d width=%d\n", dwidth, width);
547  if(dwidth < width) {
548  int penmode;
549  struct st_box box;
550  box.pos.x = x;
551  box.pos.y = y;
552  box.sur.width = width - dwidth;
553  box.sur.height = font_height();
554  penmode = get_draw_mode();
556  DTPRINTF(0x01, "BOX X=%d Y=%d W=%d H=%d\n",
557  box.pos.x, box.pos.y,
558  box.sur.width, box.sur.height);
559  draw_fill_box(&box);
560  set_draw_mode(penmode);
561  }
562 }
563 
564 #if 0 // [TODO]
565 void draw_wstr(short x, short y, ushort *wstr)
566 {
567  ushort code;
568 
569  while((*wstr) != 0) {
570  code = *wstr;
571  DTFPRINTF(0x02, "0x%04X\n", code);
572  x += draw_char(x, y, code);
573  wstr ++;
574  }
575 }
576 #endif
577 
578 /**
579  @brief 四角形内に文字列を描画する
580 
581  @param[in] box 描画範囲四角形
582  @param[in] hattr 横方向属性
583  @param[in] vattr 縦方向属性
584  @param[in] ch 描画文字列(UTF-16)
585 
586  @info hattr は @ref FONT_HATTR_LEFT または @ref FONT_HATTR_CENTER または @ref FONT_HATTR_RIGHT が設定可能
587  @info vattr は @ref FONT_VATTR_TOP または @ref FONT_VATTR_CENTER または @ref FONT_VATTR_BOTTOM が設定可能
588 */
589 void draw_str_in_box(struct st_box *box, int hattr, int vattr, unsigned char *str)
590 {
591  int str_w = 0, str_h = 0;
592  short x = 0, y = 0;
593 
594  str_w = str_width(str);
595  str_h = font_height();
596 
597  DTPRINTF(0x02, "X= %d, Y= %d, W= %d, H= %d\n", box->pos.x, box->pos.y, box->sur.width, box->sur.height);
598  DTPRINTF(0x02, "STR_W= %d, STR_H= %d\n", str_w, str_h);
599 
600  switch(hattr) {
601  case FONT_HATTR_LEFT:
602  x = box->pos.x;
603  break;
604 
605  case FONT_HATTR_CENTER:
606  x = box->pos.x + (box->sur.width/2) - (str_w/2);
607  break;
608 
609  case FONT_HATTR_RIGHT:
610  x = box->pos.x + box->sur.width - str_w;
611  break;
612 
613  default:
614  SYSERR_PRINT("Unknow hattr %d\n", hattr);
615  break;
616  }
617 
618  switch(vattr) {
619  case FONT_VATTR_TOP:
620  y = box->pos.y;
621  break;
622 
623  case FONT_VATTR_CENTER:
624  y = box->pos.y + (box->sur.height/2) - (str_h/2);
625  break;
626 
627  case FONT_VATTR_BOTTOM:
628  y = box->pos.y + box->sur.height - str_h;
629  break;
630 
631  default:
632  SYSERR_PRINT("Unknow vattr %d\n", vattr);
633  break;
634  }
635 
636  DTPRINTF(0x02, "DX= %d, DY= %d\n", x, y);
637 
638  draw_str(x, y, str);
639 }
640 
641 /**
642  @brief カレントフォントセットの文字幅を取得する
643 
644  @param ch 文字幅を取得する文字の文字コード(UTF-16)
645 
646  @return 文字幅
647 */
648 unsigned short font_width(unsigned short ch)
649 {
650  signed char *ip;
651  struct st_font *ft;
652  unsigned short rt = 0;
653 
654  ft = get_fontdata(ch);
655  if(ft == 0) {
656  return 0;
657  }
658  ip = get_char_bitmap(ch, ft);
659  if(ip == 0) {
660  return 0;
661  } else {
662  rt = (unsigned short)(*(ip+0));
663  }
664 
665  DTPRINTF(0x01, "FWIDTH %d\n", (int)rt);
666 
667  return rt;
668 }
669 
670 /**
671  @brief カレントフォントセットの文字列幅を取得する
672 
673  @param str 文字列幅を取得する文字の文字コード(UTF-16)
674 
675  @return 文字列幅
676 */
677 unsigned short str_width(unsigned char *str)
678 {
679  ushort code;
680  int slen = 0;
681  int wlen = 0;
682 
683  while((*str) != 0) {
684  XDUMP(0x02, str, 3);
685  slen = utf8code_to_utf16code(&code, str);
686  DTFPRINTF(0x02, "0x%04X\n", (int)code);
687  if(slen != 0) {
688  wlen += font_width(code);
689  str += slen;
690  } else {
691  break;
692  }
693  }
694 
695  return (unsigned short)wlen;
696 }
697 
698 /**
699  @brief カレントフォントセットの文字高さを取得する
700 
701  @return 文字高さ
702 */
703 unsigned short font_height(void)
704 {
705  return now_fontset->font->height;
706 }
unsigned char get_draw_mode(void)
描画モードを取得する
Definition: graphics.c:426
unsigned char uchar
GadgetSeedの文字(列)は unsigned char 型となる
Definition: str.h:13
int fontset_count(void)
登録されているフォントセットの数を取得する
Definition: font.c:170
short y
Y座標
Definition: graphics.h:73
unsigned short dwidth
1文字のビットマップデータのバイト数
Definition: fontdata.h:18
char name[MAX_FONTNAMELEN]
フォントセット名
Definition: fontdata.h:24
#define FONT_VATTR_BOTTOM
下寄せ
Definition: font.h:24
struct st_surface sur
面の大きさ
Definition: graphics.h:83
unsigned short str_width(unsigned char *str)
カレントフォントセットの文字列幅を取得する
Definition: font.c:677
#define GRP_DRAWMODE_NORMAL
Draw the foreground with fore color. Draw the background with back color.
Definition: graphics.h:60
struct st_fontset * get_fontptr_by_name(char *name)
フォントセットのポインタを取得する
Definition: font.c:200
#define FONT_FIXEDWIDTH
全フォントを固定幅で描画
Definition: font.h:15
アプリケーション(タスク)デバッグ用マクロ
struct st_position pos
左上頂点の位置
Definition: graphics.h:82
フォントデータ
Definition: fontdata.h:13
文字コード処理
矩形
Definition: graphics.h:64
short height
高さ
Definition: graphics.h:78
文字列処理
short top
左上頂点のY座標
Definition: graphics.h:66
unsigned short draw_char(short x, short y, unsigned short ch)
文字を描画する
Definition: font.c:433
unsigned int get_forecolor(void)
描画の色を取得する
Definition: graphics.c:382
#define FONT_VATTR_CENTER
中心
Definition: font.h:23
short bottom
右下頂点のY座標
Definition: graphics.h:68
short left
左上頂点のX座標
Definition: graphics.h:65
フォントセット
Definition: fontdata.h:23
長(正)方形
Definition: graphics.h:81
#define FONT_VATTR_TOP
上寄せ
Definition: font.h:22
struct st_fontset * set_font_by_name(char *name)
カレントフォントセットをフォント名で設定する
Definition: font.c:226
#define GRP_DRAWMODE_REVERSE
Draw the foreground with back color. Draw the background with fore color.
Definition: graphics.h:61
struct st_fontset * get_fontset(void)
描画に使用されているフォントセット(カレントフォントセット)取得する
Definition: font.c:160
unsigned short height
1文字の高さ(ピクセル数)
Definition: fontdata.h:17
short width
Definition: graphics.h:77
short right
右下頂点のX座標
Definition: graphics.h:67
void draw_line(short x, short y, short xe, short ye)
直線を描画する
Definition: graphics.c:664
void draw_rect(struct st_rect *rect)
矩形を描画する
Definition: graphics.c:694
void draw_str(short x, short y, uchar *str)
文字列を描画する
Definition: font.c:494
void set_fontset(struct st_fontset *fontset)
描画に使用するフォントセット(カレントフォントセット)を設定する
Definition: font.c:150
カーネル用機能限定printf
int strcomp(const uchar *s1, const uchar *s2)
文字列比較
Definition: str.c:583
void draw_bitdata(short px, short py, short width, short height, unsigned char *data, short dw)
ビットデータを描画する
Definition: graphics.c:1041
void draw_fill_rect(struct st_rect *rect)
塗りつぶした矩形を描画する
Definition: graphics.c:821
void draw_box(struct st_box *box)
四角を描画する
Definition: graphics.c:1391
void draw_str_in_box(struct st_box *box, int hattr, int vattr, unsigned char *str)
四角形内に文字列を描画する
Definition: font.c:589
#define FONT_HATTR_CENTER
中心
Definition: font.h:19
void set_draw_mode(unsigned char mode)
描画モードを設定する
Definition: graphics.c:414
void set_forecolor(unsigned int color)
描画の色を設定する
Definition: graphics.c:370
void draw_fill_box(struct st_box *box)
塗りつぶした四角を描画する
Definition: graphics.c:1435
unsigned int * index
文字コードとビットマップデータのバイト位置の対応データ
Definition: fontdata.h:19
int utf16code_to_utf8code(uchar *utf8code, ushort utf16code)
UTF-16 文字から UTF-8 文字へ変換
Definition: charcode.c:142
struct st_font * w_font
全角フォントデータポインタ
Definition: fontdata.h:26
const char * fontset_name(int num)
フォント名を取得する
Definition: font.c:188
struct st_font * font
半角フォントデータポインタ
Definition: fontdata.h:25
#define FONT_HATTR_RIGHT
右寄せ
Definition: font.h:20
unsigned short start
開始文字コード
Definition: fontdata.h:14
unsigned short width
1文字の幅(ピクセル数)
Definition: fontdata.h:16
unsigned short end
終了文字コード
Definition: fontdata.h:15
unsigned short ushort
2バイト(UTF-16)文字
Definition: str.h:14
unsigned short font_width(unsigned short ch)
カレントフォントセットの文字幅を取得する
Definition: font.c:648
void set_font_drawmode(int mode)
フォント描画モードを設定する
Definition: font.c:247
#define FONT_HATTR_LEFT
左寄せ
Definition: font.h:18
int utf8code_to_utf16code(ushort *utf16code, uchar *utf8code)
UTF-8 文字から UTF-16 文字へ変換
Definition: charcode.c:247
void draw_fixed_width_str(short x, short y, uchar *str, short width)
固定幅で文字列を描画する
Definition: font.c:520
グラフィックライブラリ
フォント
unsigned short font_height(void)
カレントフォントセットの文字高さを取得する
Definition: font.c:703
short x
X座標
Definition: graphics.h:72
signed char * bitmap
各文字フォントのビットマップデータ
Definition: fontdata.h:20