02111-1307, USA. */
/***en
- @enpage mdump dump text image
+ @enpage m17n-dump dump text image
- @section mdump-synopsis SYNOPSIS
+ @section m17n-dump-synopsis SYNOPSIS
- mdump [ OPTION ... ] [ FILE ]
+ m17n-dump [ OPTION ... ] [ FILE ]
- @section mdump-description DESCRIPTION
+ @section m17n-dump-description DESCRIPTION
Dump a text as PNG image file.
Prefer a font specified for the language LANG. LANG must be a
2-letter code of ISO 630 (e.g. "en" for English).
+ <li> -r
+
+ Specify that the orientation of the text is right-to-left.
+
<li> -q
Quiet mode. Don't print any messages.
</ul>
*/
/***ja
- @japage mdump ¥Æ¥¥¹¥È²èÁü¤Î¥À¥ó¥×
+ @japage m17n-dump ¥Æ¥¥¹¥È²èÁü¤Î¥À¥ó¥×
- @section mdump-synopsis SYNOPSIS
+ @section m17n-dump-synopsis SYNOPSIS
- mdump [ OPTION ... ] [ FILE ]
+ m17n-dump [ OPTION ... ] [ FILE ]
- @section mdump-description DESCRIPTION
+ @section m17n-dump-description DESCRIPTION
¥Æ¥¥¹¥È¤ò PNG ²èÁü¤È¤·¤Æ¥À¥ó¥×¤¹¤ë¡£
printf (" dumped into the file \"output.png\".\n");
printf ("The following OPTIONs are available.\n");
printf (" %-13s %s", "-s SIZE",
- "Font size in point (default 12).\n");
+ "Font size in 1/10 point (default 120).\n");
printf (" %-13s %s", "-d DPI",
"Resolution in dots per inch (defualt 300).\n");
printf (" %-13s %s", "-p PAPER",
"Prefer a font whose family is FAMILY.\n");
printf (" %-13s %s", "--language LANG",
"Prefer a font specified for the langauge LANG.\n");
+ printf (" %-13s %s", "-r",
+ "Specify that the orientation of the text is right-to-left.\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");
while (to < next)
{
mdraw_glyph_info (frame, mt, to, to, control, &info);
- if (y + info.this.height > height)
+ if (y + info.metrics.height > height)
break;
- y += info.this.height;
+ y += info.metrics.height;
to = info.line_to;
}
break;
return to;
}
-
-/* Table to convert a byte of LSBFirst to MSBFirst. */
-char reverse_bit_order[256];
-
-/* Initialize the above table. */
-
-void
-init_reverse_bit_order ()
-{
- int i;
-
- for (i = 0; i < 256; i++)
- reverse_bit_order[i]
- = (((i & 1) << 7) | ((i & 2) << 5) | ((i & 4) << 3) | ((i & 8) << 1)
- | ((i & 16) >> 1) | ((i & 32) >> 3)
- | ((i & 64) >> 5) | ((i & 128) >> 7));
-}
-
-
/* Dump the image in IMAGE into a file whose name is generated from
FILENAME and PAGE_INDEX (if it is not zero). */
int anti_alias = 0;
char *family_name = NULL;
char *lang_name = NULL;
+ int r2l = 0;
int i;
int page_index;
gdImagePtr image;
help_exit (argv[0], 0);
else if (! strcmp (argv[i], "--version"))
{
- printf ("mdump (m17n library) %s\n", PROGRAM_VERSION);
+ printf ("m17n-dump (m17n library) %s\n", PROGRAM_VERSION);
printf ("Copyright (C) 2003, 2004 AIST, JAPAN\n");
exit (0);
}
{
lang_name = argv[++i];
}
+ else if (! strcmp (argv[i], "-r"))
+ {
+ r2l = 1;
+ }
else if (argv[i][0] != '-')
{
fp = fopen (argv[i], "r");
frame = mframe (plist);
m17n_object_unref (plist);
if (! frame)
- FATAL_ERROR ("%s\n", "Can't open a frame (perhaps no font avairable)!");
+ FATAL_ERROR ("%s\n", "Can't open a frame (perhaps no font available)!");
}
memset (&control, 0, sizeof control);
- control.as_image = 1;
control.two_dimensional = 1;
control.enable_bidi = 1;
control.anti_alias = anti_alias;
+ control.orientation_reversed = r2l;
if (cursor_pos >= 0)
{
control.with_cursor = 1;
else
control.ignore_formatting_char = 1;
if (break_by_word)
- control.line_break = line_break;
+ control.line_break = mdraw_default_line_break;
if (paper == PAPER_NOLIMIT)
{
gdImageFilledRectangle (image, 0, 0, paper_width - 1, paper_height - 1,
white);
- mdraw_text_with_control (frame, image,
- margin, margin - rect.y, mt, from, to,
- &control);
+ if (! r2l)
+ mdraw_text_with_control (frame, image,
+ margin, margin - rect.y,
+ mt, from, to, &control);
+ else
+ mdraw_text_with_control (frame, image,
+ paper_width - margin, margin - rect.y,
+ mt, from, to, &control);
dump_image (image, filename, filter,
((from > 0 || to < len) ? page_index : 0),
quiet_mode);