int QEb::narrowFontStart() { int start; EB_Error_Code ecode = eb_narrow_font_start(&book, &start); if (ecode != EB_SUCCESS) { dispError("eb_narrow_font_start", ecode); return -1; } return start; }
int main(int argc, char *argv[]) { EB_Error_Code error_code; EB_Book book; EB_Subbook_Code subbook_list[EB_MAX_SUBBOOKS]; int subbook_count; int subbook_index; int font_start; unsigned char bitmap[EB_SIZE_NARROW_FONT_16]; int i, j; /* コマンド行引数をチェック。*/ if (argc != 3) { fprintf(stderr, "Usage: %s book-path subbook-index\n", argv[0]); exit(1); } /* EB ライブラリと `book' を初期化。*/ eb_initialize_library(); eb_initialize_book(&book); /* 書籍を `book' に結び付ける。*/ error_code = eb_bind(&book, argv[1]); if (error_code != EB_SUCCESS) { fprintf(stderr, "%s: failed to bind the book, %s: %s\n", argv[0], eb_error_message(error_code), argv[1]); goto die; } /* 副本の一覧を取得。*/ error_code = eb_subbook_list(&book, subbook_list, &subbook_count); if (error_code != EB_SUCCESS) { fprintf(stderr, "%s: failed to get the subbbook list, %s\n", argv[0], eb_error_message(error_code)); goto die; } /* 副本のインデックスを取得。*/ subbook_index = atoi(argv[2]); /*「現在の副本 (current subbook)」を設定。*/ error_code = eb_set_subbook(&book, subbook_list[subbook_index]); if (error_code != EB_SUCCESS) { fprintf(stderr, "%s: failed to set the current subbook, %s\n", argv[0], eb_error_message(error_code)); goto die; } /*「現在の外字の大きさ」を設定。*/ if (eb_set_font(&book, EB_FONT_16) < 0) { fprintf(stderr, "%s: failed to set the font size, %s\n", argv[0], eb_error_message(error_code)); goto die; } /* 外字の開始位置を取得。*/ error_code = eb_narrow_font_start(&book, &font_start); if (error_code != EB_SUCCESS) { fprintf(stderr, "%s: failed to get font information, %s\n", argv[0], eb_error_message(error_code)); goto die; } i = font_start; for (;;) { /* 外字のビットマップデータを取得。*/ error_code = eb_narrow_font_character_bitmap(&book, i, (char *)bitmap); if (error_code != EB_SUCCESS) { fprintf(stderr, "%s: failed to get font data, %s\n", argv[0], eb_error_message(error_code)); goto die; } /* ビットマップをアスキーアートにして出力。*/ printf("code point=%04x\n", i); for (j = 0; j < 16; j++) { fputc((bitmap[j] & 0x80) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x40) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x20) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x10) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x08) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x04) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x02) ? '*' : ' ', stdout); fputc((bitmap[j] & 0x01) ? '*' : ' ', stdout); fputc('\n', stdout); } fputs("--------\n", stdout); /* 外字の文字番号を一つ進める。*/ error_code = eb_forward_narrow_font_character(&book, 1, &i); if (error_code != EB_SUCCESS) break; } /* 書籍と EB ライブラリの利用を終了。*/ eb_finalize_book(&book); eb_finalize_library(); exit(0); /* エラー発生で終了するときの処理。*/ die: eb_finalize_book(&book); eb_finalize_library(); exit(1); }