2
* dbg-bml.c - test program for bitmaplist class.
3
* by Hirotsugu Kakugawa
7
* Copyright (C) 1997 Hirotsugu Kakugawa.
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2, or (at your option)
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU General Public License for more details.
20
* You should have received a copy of the GNU General Public License
21
* along with this program; if not, write to the Free Software
22
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28
#include "VFlib-3_6.h"
32
int display(int,int,double,double,int,double);
38
main(int argc, char **argv)
44
int rp_x, rp_y, mv_x, mv_y;
45
int delta_x, delta_y, ign_mv;
46
VF_BITMAP bm, composed_bitmap;
47
struct vf_s_bitmaplist the_bitmaplist, *bitmaplist;
60
bitmaplist = &the_bitmaplist;
61
VF_BitmapListInit(bitmaplist);
64
while ((argc > 0) && (*argv[0] == '-')){
65
if (strcmp(argv[0], "-v") == 0){
68
} else if (strcmp(argv[0], "-M") == 0){
69
std_mag = atof(argv[1]);
71
} else if ((strcmp(argv[0], "-h") == 0)
72
|| (strcmp(argv[0], "-help") == 0)){
80
if (VF_Init(vflibcap, NULL) < 0){
81
fprintf(stderr, "Error %d in VF_Init().\n", vf_error);
87
if (strcmp(argv[0], "-m") == 0){
88
mag = atof(argv[1]) * std_mag;
90
} else if (strcmp(argv[0], "-f") == 0){
93
if ((font_id = VF_OpenFont2(font_name, -1, 1, 1)) < 0){
94
fprintf(stderr, "Error %d in VF_OpenFont2(%s)\n",
98
} else if (strcmp(argv[0], "-x") == 0){
99
mv_x += atoi(argv[1]);
101
} else if (strcmp(argv[0], "-y") == 0){
102
mv_y += atoi(argv[1]);
104
} else if (strcmp(argv[0], "-dx") == 0){
105
delta_x = atoi(argv[1]);
107
} else if (strcmp(argv[0], "-dy") == 0){
108
delta_y = atoi(argv[1]);
110
} else if (strcmp(argv[0], "-n") == 0){
112
} else if (font_id < 0){
113
fprintf(stderr, "Error: Font is not selected.\n");
115
} else if (font_id >= 0){
116
sscanf(argv[0], "%i", &code);
117
bm = VF_GetBitmap2(font_id, code, mag, mag);
120
fprintf(stderr, "Error: Fauiled to obtain a glyph.\n");
127
VF_BitmapListPut(bitmaplist, bm,
128
rp_x + mv_x + delta_x, rp_y + mv_y + delta_y);
141
if ((composed_bitmap = VF_BitmapListCompose(bitmaplist)) != NULL){
142
VF_DumpBitmap(composed_bitmap);
145
VF_BitmapListFinish(bitmaplist);
154
printf("dbg-bml - Debug bitmaplist class\n");
155
printf("Usage: bdg-bml [OPTIONS] [ARGS]\n");
156
printf("OPTIONS: -v VFLIBCAP Select vflibcap file\n");
157
printf(" -M MAG Change default magnification\n");
158
printf(" -h Print help\n");
159
printf("ARGS: -f FONT Change fonts\n");
160
printf(" -m MAG Change magnification\n");
161
printf(" -x NPIX Move ref point NPIX pixels holizontally\n");
162
printf(" -y NPIX Move ref point NPIX pixels vertically\n");
163
printf(" -dx NPIX Shift next glyph NPIX pixels holizontally\n");
164
printf(" -dx NPIX Shift next glyph NPIX pixels vertically\n");
165
printf(" -n Do not move ref point\n");
166
printf(" CODE_POINT Add glyph for CODE_POINT\n");
167
printf(" -m has effect on only current font.\n");
168
printf(" -dx, -dy and -n have effects on only for next one glyph.\n");
169
printf("Example 1: dbg-bml -f timI24.pcf 0x69 0x66 0x66\n");
170
printf("Example 2: dbg-bml -f timR24.pcf -m 2 0x41\n");
171
printf("Example 3: dbg-bml -f timR24.pcf 0x41 -f timI24.pcf 0x42\n");