1 /* mdump.c -- Dump text image -*- coding: euc-jp; -*-
2 Copyright (C) 2003, 2004, 2005, 2006, 2007
3 National Institute of Advanced Industrial Science and Technology (AIST)
4 Registration Number H15PRO112
6 This file is part of the m17n library.
8 The m17n library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Lesser General Public License
10 as published by the Free Software Foundation; either version 2.1 of
11 the License, or (at your option) any later version.
13 The m17n library is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public
19 License along with the m17n library; if not, write to the Free
20 Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 @enpage m17n-dump dump text image
26 @section m17n-dump-synopsis SYNOPSIS
28 m17n-dump [ OPTION ... ] [ FILE ]
30 @section m17n-dump-description DESCRIPTION
32 Dump a text as PNG image file.
34 The PNG file is written to a file created in the current directory
35 with the name "BASE.png" where BASE is the basename of FILE. If
36 FILE is omitted, text is read from standard input, and the image
37 is dumped into the file "output.png".
39 The following OPTIONs are available.
45 SIZE is the font size in point. The default font size is 12 point.
49 DPI is the resolution in dots per inch. The default resolution is
54 PAPER is the paper size: a4, a4r, a5, a5r, b5, b5r, letter, WxH,
55 or W. In the case of WxH, W and H are the width and height in
56 millimeter. In the case of W, W is the width in millimeter. If
57 this option is specified, PAPER limits the image size. If FILE is
58 too large for a single page, multiple files with the names
59 "BASE.01.png", "BASE.02.png", etc. are created.
63 MARGIN is the horizontal and vertical margin in millimeter. The
64 default margin is 20 mm. It is ignored when PAPER is not
69 POS is the character position of cursor to draw. By default,
74 FILE is assumed to be an XML file generated by the serialize
75 facility of the m17n library, and FILE is deserialized before an
80 Each line is broken at word boundary.
84 FILTER is a string containing a shell command line. If this
85 option is specified, the PNG image is not written info a
86 file but is given to FILTER as standard input. If FILTER
87 contains "%s", that part is replaced by a basename of FILE.
88 So, the default behaviour is the same as specifying "cat >
91 If FILTER is just "-", the PNG image is written to stdout.
95 Enable anti-alias drawing.
99 Prefer a font whose family name is FAMILY.
103 Prefer a font specified for the language LANG. LANG must be a
104 2-letter code of ISO 630 (e.g. "en" for English).
108 Specify the text color. The supported color names are those of
109 HTML 4.0 and "#RRGGBB" notation.
113 Specify the background color. The supported color names are the
114 same as FOREGROUND, except that if "transparent" is specified,
115 make the background transparent.
119 Specify that the orientation of the text is right-to-left.
123 Quiet mode. Don't print any messages.
127 Print the version number.
136 @japage m17n-dump ¥Æ¥¥¹¥È²èÁü¤Î¥À¥ó¥×
138 @section m17n-dump-synopsis SYNOPSIS
140 m17n-dump [ OPTION ... ] [ FILE ]
142 @section m17n-dump-description DESCRIPTION
144 ¥Æ¥¥¹¥È¤ò PNG ²èÁü¤È¤·¤Æ¥À¥ó¥×¤¹¤ë¡£
146 PNG ²èÁü¤Ï¸½ºß¤Î¥Ç¥£¥ì¥¯¥È¥ê¤Ëºî¤é¤ì¤¿ "BASE.png" ¤È¤¤¤¦Ì¾Á°¤Î
147 ¥Õ¥¡¥¤¥ë¤Ë½ñ¤¹þ¤Þ¤ì¤ë¡£¤³¤³¤Ç BASE ¤ÏFILE ¤Î basename ¤Ç¤¢¤ë¡£
148 FILE ¤¬¾Êά¤µ¤ì¤ì¤Ð¡¢¥Æ¥¥¹¥È¤Ïɸ½àÆþÎϤ«¤éÆɤޤ졢²èÁü¤Ï
149 "output.png" ¤Ë¥À¥ó¥×¤µ¤ì¤ë¡£
151 °Ê²¼¤Î¥ª¥×¥·¥ç¥ó¤¬ÍøÍѤǤ¤ë¡£
157 SIZE ¤Ï¥Õ¥©¥ó¥È¤ÎÂ礤µ¤ò¥Ý¥¤¥ó¥Èñ°Ì¤Ç¼¨¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£¥Ç¥Õ¥©¥ë
158 ¥È¤ÎÂ礤µ¤Ï 12 ¥Ý¥¤¥ó¥È¡£
162 DPI ¤Ï²òÁüÅÙ¤ò£±¥¤¥ó¥Á¤¢¤¿¤ê¤Î¥É¥Ã¥Èñ°Ì¤Ç¼¨¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£¥Ç¥Õ¥©
163 ¥ë¥È¤Î²òÁüÅÙ¤Ï 300 dpi¡£
167 PAPER ¤Ï¤Ú¡¼¥Ñ¥µ¥¤¥º : a4, a4r, a5, a5r, b5, b5r, letter, WxH ¤Þ¤¿
168 ¤Ï W¡£ WxH ¤Î¾ì¹ç¡¢ W ¤È H ¤ÏÉý¤È¹â¤µ¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¡£
169 W ¤Î¾ì¹ç¡¢ W ¤ÏÉý¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄê
170 ¤µ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢ PAPER ¤¬²èÁü¥µ¥¤¥º¤òÀ©¸Â¤¹ ¤ë¡£FILE ¤¬ 1 ¥Ú¡¼¥¸
171 ¤ËǼ¤Þ¤é¤Ê¤¤¤Û¤ÉÂ礤¤¾ì¹ç¤Ï¡¢"BASE.01.png", "BASE.02.png" Åù¤Î̾Á°
172 ¤Î¤Ä¤¤¤¿Ê£¿ô¤Î¥Õ¥¡¥¤¥ë¤¬ºî¤é¤ì¤ë¡£
176 MARGIN ¤Ï¿åÊ¿¡¢¿âľ¥Þ¡¼¥¸¥ó¤ò¥ß¥ê¥á¡¼¥¿Ã±°Ì¤Ç¼¨¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£¥Ç
177 ¥Õ¥©¥ë¥È¤Î¥Þ¡¼¥¸¥ó¤Ï 20 mm¡£PAPER ¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤±¤ì¤Ð̵»ë¤µ¤ì¤ë¡£
181 POS ¤Ï¥«¡¼¥½¥ë¤Îʸ»ú°ÌÃÖ¡£¥Ç¥Õ¥©¥ë¥È¤Ç¤Ï¡¢¥«¡¼¥½¥ë¤ÏÉÁ¤«¤ì¤Ê¤¤¡£
185 FILE ¤Ï m17n ¥é¥¤¥Ö¥é¥ê¤Î¥·¥ê¥¢¥é¥¤¥ºµ¡Ç½¤Ë¤è¤Ã¤Æºî¤é¤ì¤¿ XML ¥Õ¥¡
186 ¥¤¥ë¤Ç¤¢¤ê¡¢²èÁü¤òÀ¸À®¤¹¤ëÁ°¤Ë¥Ç¥·¥ê¥¢¥é¥¤¥º¤µ¤ì¤ë¡£
194 FILTER ¤Ï¥·¥§¥ë¥³¥Þ¥ó¥É¹Ô¤ò´Þ¤àʸ»úÎó¤Ç¤¢¤ë¡£¤³¤Î¥ª¥×¥·¥ç¥ó¤¬»ØÄê
195 ¤µ¤ì¤Æ¤¤¤ì¤Ð¡¢PNG ²èÁü¤Ï¥Õ¥¡¥¤¥ë¤Ë½ñ¤«¤ì¤ë¤Î¤Ç¤Ï¤Ê¤¯¡¢FILTER ¤Ë
196 ɸ½àÆþÎϤȤ·¤ÆÅϤµ¤ì¤ë¡£ FILTER ¤¬ "%s" ¤ò´Þ¤ó¤Ç¤¤¤ì¤Ð¡¢¤½¤ì¤Ï FILE
197 ¤Î¥Ù¡¼¥¹¥Í¡¼¥à¤ËÃÖ¤´¹¤¨¤é¤ì¤ë¡£¤³¤Î¥×¥í¥°¥é¥à¤Î¥Ç¥Õ¥©¥ë¥È¤Î¿¶Éñ¤¤
198 ¤È¡¢FILTER ¤Ë "cat > %s.png" ¤ò»ØÄꤷ¤¿¾ì¹ç¤Î¿¶Éñ¤ÏƱ°ì¤Ç¤¢¤ë¡£
200 ¤â¤· FILTER ¤¬Ã±¤Ë "-" ¤Ç¤¢¤ì¤Ð¡¢ PNG ²èÁü¤Ï stdout ¤Ë½ÐÎϤµ¤ì¤ë¡£
204 ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹½èÍý¤ò¹Ô¤¦¡£
208 ¥Õ¥¡¥ß¥ê¥£Ì¾¤¬ FAMILY ¤Î¥Õ¥©¥ó¥È¤òÍ¥ÀèŪ¤Ë»È¤¦¡£
212 ¸À¸ì LANG ÍѤ˻ØÄꤵ¤ì¤¿¥Õ¥©¥ó¥È¤òÍ¥ÀèŪ¤Ë»È¤¦¡£LANG ¤Ï ISO 630 ¤Î
213 £²Ê¸»ú¥³¡¼¥É¡ÊÎ㡧±Ñ¸ì¤Ï "en" ¡Ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
217 ¥Æ¥¥¹¥È¤Î¿§¤ò»ØÄꤹ¤ë¡£HTML 4.0 ¤Î¿§¤Î̾Á°¤ª¤è¤Ó "#RRGGBB" µË¡¤ò
222 Çطʤ理ò»ØÄꤹ¤ë¡£¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¿§¤Î̾Á°¤Ï FOREGROUND Ʊ¤¸¡£
223 ¤¿¤À¤·¡¢¤â¤· "transparent" ¤¬»ØÄꤵ¤ì¤¿¤éÇطʤòÆ©ÌÀ¤Ë¤¹¤ë¡£
227 Specify that the orientation of the text is right-to-left.
231 °ìÀڤΥá¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¤Ê¤¤¡£
235 ¥Ð¡¼¥¸¥ç¥óÈÖ¹æ¤òɽ¼¨¤¹¤ë¡£
239 ¤³¤Î¥á¥Ã¥»¡¼¥¸¤òɽ¼¨¤¹¤ë¡£
252 #if defined (HAVE_FREETYPE) && defined (HAVE_GD)
255 #include <m17n-gui.h>
256 #include <m17n-misc.h>
258 /* Enumuration of the supported paper types. */
272 /* Array of paper sizes for the supported paper types. */
275 int width, height; /* in millimeter */
276 } paper_size[PAPER_NOLIMIT] = {
277 { 210, 297 }, /* a4 */
278 { 297, 210 }, /* a4r */
279 { 148, 210 }, /* a5 */
280 { 210, 148 }, /* a5r */
281 { 250, 176 }, /* b5 */
282 { 176, 250 }, /* b5r */
283 { 216, 279 }, /* letter */
287 /* Print the usage of this program (the name is PROG), and exit with
291 help_exit (char *prog, int exit_code)
299 printf ("Usage: %s [ OPTION ...] [ FILE ]\n", prog);
300 printf ("Dump a text as a PNG image into a file.\n");
301 printf (" The PNG file is created in the current directory\n");
302 printf (" with the name \"BASE.png\" where BASE is the basename of FILE.\n");
303 printf (" If FILE is omitted, text is read from standard input, and\n");
304 printf (" dumped into the file \"output.png\".\n");
305 printf ("The following OPTIONs are available.\n");
306 printf (" %-13s %s", "-s SIZE",
307 "Font size in 1/10 point (default 120).\n");
308 printf (" %-13s %s", "-d DPI",
309 "Resolution in dots per inch (defualt 300).\n");
310 printf (" %-13s %s", "-p PAPER",
311 "Paper size; a4, a4r, a5, a5r, b5, b5r, letter, W, or WxH.\n");
312 printf (" %-13s %s", "-m MARGIN",
313 "Marginal space in millimeter (default 20).\n");
314 printf (" %-13s %s", "-c POS",
315 "Character position of cursor to draw (default no cursor)\n");
316 printf (" %-13s %s", "-x",
317 "FILE is assumed to be an XML file.\n");
318 printf (" %-13s %s", "-f FILTER",
319 "String containing a shell command line to be used as a filter.\n");
320 printf (" %-13s %s", "-w", "Each line is broken at word boundary.\n");
321 printf (" %-13s %s", "-a", "Enable anti-alias drawing.\n");
322 printf (" %-13s %s", "--family FAMILY",
323 "Prefer a font whose family is FAMILY.\n");
324 printf (" %-13s %s", "--language LANG",
325 "Prefer a font specified for the langauge LANG.\n");
326 printf (" %-13s %s", "-r",
327 "Specify that the orientation of the text is right-to-left.\n");
328 printf (" %-13s %s", "-fg FOREGROUND",
329 "Specify the text color (HTML 4.0 color names or \"#RRGGBB\").\n");
330 printf (" %-13s %s", "-bg BACKGROUND",
331 "Specify the background color (\"transparent\" for transparent)\n");
332 printf (" %-13s %s", "-q", "Quiet mode. Don't print any messages.\n");
333 printf (" %-13s %s", "--version", "Print the version number.\n");
334 printf (" %-13s %s", "-h, --help", "Print this message.\n");
339 /* Format MSG by FMT and print the result to the stderr, and exit. */
341 #define FATAL_ERROR(fmt, arg) \
343 fprintf (stderr, fmt, arg); \
348 /* Move POS to the next line head in M-text MT whose length is LEN.
349 If POS is already on the last line, set POS to LEN. */
351 #define NEXTLINE(pos, len) \
353 pos = mtext_character (mt, pos, len, '\n'); \
361 /* Find the range of M-text MT that fits in one page of height HEIGHT
362 when drawn from the character position POS. Set RECT->y to the
363 Y-offset of the first baseline. */
366 find_page_end (MFrame *frame, int height, MText *mt, int pos,
367 MDrawControl *control, MDrawMetric *rect)
369 int len = mtext_len (mt);
377 NEXTLINE (next, len);
378 mdraw_text_extents (frame, mt, to, next, control, NULL, NULL, rect);
381 if (y + rect->height > height)
387 mdraw_glyph_info (frame, mt, to, to, control, &info);
388 if (y + info.metrics.height > height)
390 y += info.metrics.height;
403 /* Dump the image in IMAGE into a file whose name is generated from
404 FILENAME and PAGE_INDEX (if it is not zero). */
407 dump_image (gdImagePtr image, char *filename, char *filter,
408 int page_index, int quiet_mode)
414 char *name = alloca (strlen (filename) + 8);
416 sprintf (name, "%s.%02d", filename, page_index);
422 if (filter[0] == '-' && filter[1] == '\0')
426 char *command = alloca (strlen (filename) + strlen (filter) + 1);
428 sprintf (command, filter, filename);
429 fp = popen (command, "w");
431 FATAL_ERROR ("Can't run the command \"%s\"\n", command);
433 printf ("Running \"%s\" ... ", command);
438 char *fullname = alloca (strlen (filename) + 5);
440 sprintf (fullname, "%s.png", filename);
441 fp = fopen (fullname, "w");
443 FATAL_ERROR ("Can't write to \"%s\"\n", fullname);
445 printf ("Writing %s ... ", fullname);
449 gdImagePng (image, fp);
453 printf (" done (%dx%d)\n", image->sx, image->sy);
456 extern int line_break (MText *mt, int pos, int from, int to, int line, int y);
459 main (int argc, char **argv)
462 int paper = PAPER_NOLIMIT;
469 int break_by_word = 0;
471 int paper_width, paper_height;
473 char *family_name = NULL;
474 char *lang_name = NULL;
475 char *fg_color = NULL, *bg_color = NULL;
485 MDrawControl control;
487 char *filename = "output";
489 char *fontset_name = "truetype";
492 /* Parse the command line arguments. */
493 for (i = 1; i < argc; i++)
495 if (! strcmp (argv[i], "--help")
496 || ! strcmp (argv[i], "-h")
497 || ! strcmp (argv[i], "-?"))
498 help_exit (argv[0], 0);
499 else if (! strcmp (argv[i], "--version"))
501 printf ("m17n-dump (m17n library) %s\n", M17NLIB_VERSION_NAME);
502 printf ("Copyright (C) 2007 AIST, JAPAN\n");
505 else if (! strcmp (argv[i], "-s") && i + 1< argc)
507 fontsize = atoi (argv[++i]);
509 FATAL_ERROR ("Invalid font size: %s\n", argv[i]);
511 else if (! strcmp (argv[i], "-p") && i + 1< argc)
516 if (! strcmp (argv[i], "a4"))
518 else if (! strcmp (argv[i], "a4r"))
520 else if (! strcmp (argv[i], "a5"))
522 else if (! strcmp (argv[i], "a5r"))
524 else if (! strcmp (argv[i], "b5"))
526 else if (! strcmp (argv[i], "b5r"))
528 else if (! strcmp (argv[i], "letter"))
529 paper = PAPER_LETTER;
530 else if (sscanf (argv[i], "%dx%d", &w, &h) == 2
534 paper_size[paper].width = w;
535 paper_size[paper].height = h;
537 else if (sscanf (argv[i], "%d", &w) == 1
541 paper_size[paper].width = w;
542 paper_size[paper].height = 0;
545 FATAL_ERROR ("Invalid paper type: %s\n", argv[i]);
547 else if (! strcmp (argv[i], "-d") && i + 1< argc)
549 dpi = atoi (argv[++i]);
551 FATAL_ERROR ("Invalid resolution: %s\n", argv[i]);
553 else if (! strcmp (argv[i], "-m") && i + 1< argc)
555 margin = atoi (argv[++i]);
557 FATAL_ERROR ("Invalid margin: %s\n", argv[i]);
559 else if (! strcmp (argv[i], "-c") && i + 1< argc)
561 cursor_pos = atoi (argv[++i]);
563 FATAL_ERROR ("Invalid cursor position: %s\n", argv[i]);
565 else if (! strcmp (argv[i], "-f") && i + 1< argc)
569 else if (! strcmp (argv[i], "-x"))
573 else if (! strcmp (argv[i], "-w"))
577 else if (! strcmp (argv[i], "-q"))
581 else if (! strcmp (argv[i], "-a"))
585 else if (! strcmp (argv[i], "--family"))
587 family_name = argv[++i];
589 else if (! strcmp (argv[i], "--language"))
591 lang_name = argv[++i];
593 else if (! strcmp (argv[i], "-r"))
597 else if (argv[i][0] != '-')
599 fp = fopen (argv[i], "r");
601 FATAL_ERROR ("Fail to open the file %s!\n", argv[i]);
602 filename = basename (argv[i]);
604 else if (! strcmp (argv[i], "--fontset"))
606 fontset_name = argv[++i];
608 else if (! strcmp (argv[i], "-fg"))
612 fprintf (stderr, "Foreground color not specified\n");
613 help_exit (argv[0], 1);
615 fg_color = argv[++i];
617 else if (! strcmp (argv[i], "-bg"))
621 fprintf (stderr, "Background color not specified\n");
622 help_exit (argv[0], 1);
625 if (! strcmp (argv[i], "transparent"))
632 fprintf (stderr, "Unknown or invalid option: %s\n", argv[i]);
633 help_exit (argv[0], 1);
637 /* Initialize the m17n library. */
639 if (merror_code != MERROR_NONE)
640 FATAL_ERROR ("%s\n", "Fail to initialize the m17n library.");
642 mt = mconv_decode_stream (Mcoding_utf_8, fp);
645 mt = mtext_deserialize (mt);
647 FATAL_ERROR ("%s\n", "Fail to decode the input file or stream!");
649 len = mtext_len (mt);
651 mtext_put_prop (mt, 0, len, Mlanguage, msymbol (lang_name));
653 if (paper == PAPER_NOLIMIT)
654 paper_width = paper_height = margin = 0;
657 paper_width = paper_size[paper].width * dpi / 25.4;
658 paper_height = paper_size[paper].height * dpi / 25.4;
659 margin = margin * dpi / 25.4;
663 MPlist *plist = mplist (), *p;
664 MFontset *fontset = mfontset (fontset_name);
665 MFace *face = mface ();
667 mface_put_prop (face, Mfontset, fontset);
668 mface_put_prop (face, Msize, (void *) (fontsize * dpi / 100));
673 for (p = family_name; *p; p++)
674 if (isupper (*p)) *p = tolower (*p);
675 mface_put_prop (face, Mfamily, msymbol (family_name));
678 mface_put_prop (face, Mforeground, msymbol (fg_color));
680 mface_put_prop (face, Mbackground, msymbol (bg_color));
681 p = mplist_add (plist, Mdevice, msymbol ("gd"));
682 p = mplist_add (p, Mface, face);
683 m17n_object_unref (face);
684 frame = mframe (plist);
685 m17n_object_unref (plist);
687 FATAL_ERROR ("%s\n", "Can't open a frame (perhaps no font available)!");
690 memset (&control, 0, sizeof control);
691 control.two_dimensional = 1;
692 control.enable_bidi = 1;
693 control.anti_alias = anti_alias;
694 control.orientation_reversed = r2l;
697 control.with_cursor = 1;
698 if (cursor_pos > len)
700 control.cursor_pos = cursor_pos;
701 control.cursor_width = -1;
704 control.ignore_formatting_char = 1;
706 control.line_break = mdraw_default_line_break;
708 if (paper == PAPER_NOLIMIT)
710 control.max_line_width = 0;
711 mdraw_text_extents (frame, mt, 0, len, &control, NULL, NULL, &rect);
712 paper_width = rect.width;
713 paper_height = rect.height;
717 control.max_line_width = paper_width - margin * 2;
718 if (paper_height == 0)
720 mdraw_text_extents (frame, mt, 0, len, &control, NULL, NULL, &rect);
721 paper_height = rect.height + margin * 2;
726 image = gdImageCreateTrueColor (paper_width, paper_height);
728 image = gdImageCreate (paper_width, paper_height);
735 MFace *face = mframe_get_prop (frame, Mface);
736 MSymbol fg = mface_get_prop (face, Mforeground);
740 rgb_value = (int) msymbol_get (fg, msymbol (" rgb"));
741 if (rgb_value == 0xFFFFFF)
742 bg_rgb = gdImageColorAllocate (image, 0, 0, 0);
744 bg_rgb = gdImageColorAllocate (image, 255, 255, 255);
745 gdImageColorTransparent (image, bg_rgb);
747 gdImageAlphaBlending (image, 0);
752 MFace *face = mframe_get_prop (frame, Mface);
753 MSymbol bg = mface_get_prop (face, Mbackground);
756 int rgb_value = (int) msymbol_get (bg, msymbol (" rgb"));
757 bg_rgb = gdImageColorAllocate (image, rgb_value >> 16,
758 (rgb_value >> 8) & 255,
762 bg_rgb = gdImageColorAllocate (image, 255, 255, 255);
769 if (paper == PAPER_NOLIMIT || paper_size[paper].height == 0)
772 to = find_page_end (frame, paper_height - margin * 2, mt, from,
775 gdImageFilledRectangle (image, 0, 0, paper_width - 1, paper_height - 1,
778 mdraw_text_with_control (frame, image,
779 margin, margin - rect.y,
780 mt, from, to, &control);
782 mdraw_text_with_control (frame, image,
783 paper_width - margin, margin - rect.y,
784 mt, from, to, &control);
785 dump_image (image, filename, filter,
786 ((from > 0 || to < len) ? page_index : 0),
793 m17n_object_unref (frame);
794 m17n_object_unref (mt);
796 gdImageDestroy (image);
800 #else /* not HAVE_FREETYPE nor HAVE_GD */
803 main (int argc, char **argv)
805 fprintf (stderr, "Can't run without Freetype and GD library!\n");
809 #endif /* not HAVE_FREETYPE nor HAVE_GD */
810 #endif /* not FOR_DOXYGEN */