<li> -p PAPER
- PAPER is the paper size: a4, a4r, a5, a5r, b5, b5r, letter, or
- WxH. In the last case, W and H are the width and height in
- millimeter. If this option is specified, PAPER limits the image
- size. If FILE is too large for a single page, multiple files with
- the names "BASE.01.png", "BASE.02.png", etc. are created.
+ PAPER is the paper size: a4, a4r, a5, a5r, b5, b5r, letter, WxH,
+ or W. In the case of WxH, W and H are the width and height in
+ millimeter. In the case of W, W is the width in millimeter. If
+ this option is specified, PAPER limits the image size. If FILE is
+ too large for a single page, multiple files with the names
+ "BASE.01.png", "BASE.02.png", etc. are created.
<li> -m MARGIN
<li> -p PAPER
- PAPER ¤Ï¤Ú¡¼¥Ñ¥µ¥¤¥º : a4, a4r, a5, a5r, b5, b5r, letter, ¤Þ¤¿¤Ï
- WxH. WxH ¤Î¾ì¹ç¡¢ W ¤È H ¤ÏÉý¤È¹â¤µ¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¡£
- ¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ PAPER ¤¬²èÁü¥µ¥¤¥º¤òÀ©¸Â¤¹
- ¤ë¡£FILE ¤¬ 1 ¥Ú¡¼¥¸¤ËǼ¤Þ¤é¤Ê¤¤¤Û¤ÉÂ礤¤¾ì¹ç¤Ï¡¢"BASE.01.png",
- "BASE.02.png" Åù¤Î̾Á°¤Î¤Ä¤¤¤¿Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤¬ºî¤é¤ì¤ë¡£
+ PAPER ¤Ï¤Ú¡¼¥Ñ¥µ¥¤¥º : a4, a4r, a5, a5r, b5, b5r, letter, WxH ¤Þ¤¿
+ ¤Ï W¡£ WxH ¤Î¾ì¹ç¡¢ W ¤È H ¤ÏÉý¤È¹â¤µ¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¡£
+ W ¤Î¾ì¹ç¡¢ W ¤ÏÉý¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄê
+ ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ PAPER ¤¬²èÁü¥µ¥¤¥º¤òÀ©¸Â¤¹ ¤ë¡£FILE ¤¬ 1 ¥Ú¡¼¥¸
+ ¤ËǼ¤Þ¤é¤Ê¤¤¤Û¤ÉÂ礤¤¾ì¹ç¤Ï¡¢"BASE.01.png", "BASE.02.png" Åù¤Î̾Á°
+ ¤Î¤Ä¤¤¤¿Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤¬ºî¤é¤ì¤ë¡£
<li> -m MARGIN
#include <m17n-gui.h>
#include <m17n-misc.h>
-#define VERSION "1.0"
+#define PROGRAM_VERSION "1.1"
/* Enumuration of the supported paper types. */
enum paper_type
printf (" %-13s %s", "-d DPI",
"Resolution in dots per inch (defualt 300).\n");
printf (" %-13s %s", "-p PAPER",
- "Paper size; a4, a4r, a5, a5r, b5, b5r, letter, or WxH.\n");
+ "Paper size; a4, a4r, a5, a5r, b5, b5r, letter, W, or WxH.\n");
printf (" %-13s %s", "-m MARGIN",
"Marginal space in millimeter (default 20).\n");
printf (" %-13s %s", "-c POS",
printf (" %-13s %s", "-f FILTER",
"String containing a shell command line to be used as a filter.\n");
printf (" %-13s %s", "-w", "Each line is broken at word boundary.\n");
+ printf (" %-13s %s", "-a", "Enable anti-alias drawing.\n");
printf (" %-13s %s", "-q", "Quiet mode. Don't print any messages.\n");
printf (" %-13s %s", "--version", "Print the version number.\n");
printf (" %-13s %s", "-h, --help", "Print this message.\n");
int quiet_mode = 0;
int break_by_word = 0;
char *filter = NULL;
- int i;
int paper_width, paper_height;
+ int anti_alias = 0;
+ int i;
int page_index;
gdImagePtr image;
int white;
help_exit (argv[0], 0);
else if (! strcmp (argv[i], "--version"))
{
- printf ("mdump (m17n library) %s\n", VERSION);
+ printf ("mdump (m17n library) %s\n", PROGRAM_VERSION);
printf ("Copyright (C) 2003, 2004 AIST, JAPAN\n");
exit (0);
}
paper_size[paper].width = w;
paper_size[paper].height = h;
}
+ else if (sscanf (argv[i], "%d", &w) == 1
+ && w > 0)
+ {
+ paper = PAPER_USER;
+ paper_size[paper].width = w;
+ paper_size[paper].height = 0;
+ }
else
FATAL_ERROR ("Invalid paper type: %s\n", argv[i]);
}
{
quiet_mode = 1;
}
+ else if (! strcmp (argv[i], "-a"))
+ {
+ anti_alias = 1;
+ }
else if (argv[i][0] != '-')
{
fp = fopen (argv[i], "r");
control.as_image = 1;
control.two_dimensional = 1;
control.enable_bidi = 1;
- control.anti_alias = 1;
+ control.anti_alias = anti_alias;
if (cursor_pos >= 0)
{
control.with_cursor = 1;
paper_height = rect.height;
}
else
- control.max_line_width = paper_width - margin * 2;
+ {
+ control.max_line_width = paper_width - margin * 2;
+ if (paper_height == 0)
+ {
+ mdraw_text_extents (frame, mt, 0, len, &control, NULL, NULL, &rect);
+ paper_height = rect.height + margin * 2;
+ }
+ }
image = gdImageCreate (paper_width, paper_height);
from = 0;
{
int to;
- if (paper == PAPER_NOLIMIT)
+ if (paper == PAPER_NOLIMIT || paper_size[paper].height == 0)
to = len;
else
to = find_page_end (frame, paper_height - margin * 2, mt, from,