From: handa Date: Tue, 15 Jun 2004 11:07:30 +0000 (+0000) Subject: Add command line arguments --family and --language. X-Git-Tag: withdl~85 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=b960c7f8f9ade62945ebfcd330d3f05679ad5a39;p=m17n%2Fm17n-lib.git Add command line arguments --family and --language. --- diff --git a/example/mdump.c b/example/mdump.c index a9a91df..14dbd2a 100644 --- a/example/mdump.c +++ b/example/mdump.c @@ -92,6 +92,15 @@ Enable anti-alias drawing. +
  • --family FAMILY + + Prefer a font whose family name is FAMILY. + +
  • --language LANG + + Prefer a font specified for the language LANG. LANG must be a + 2-letter code of ISO 630 (e.g. "en" for English). +
  • -q Quiet mode. Don't print any messages. @@ -175,6 +184,15 @@ ¥¢¥ó¥Á¥¨¥¤¥ê¥¢¥¹½èÍý¤ò¹Ô¤¦¡£ +
  • --family FAMILY + + ¥Õ¥¡¥ß¥ê¥£Ì¾¤¬ FAMILY ¤Î¥Õ¥©¥ó¥È¤òÍ¥ÀèŪ¤Ë»È¤¦¡£ + +
  • --language LANG + + ¸À¸ì LANG ÍѤ˻ØÄꤵ¤ì¤¿¥Õ¥©¥ó¥È¤òÍ¥ÀèŪ¤Ë»È¤¦¡£LANG ¤Ï ISO 630 ¤Î + £²Ê¸»ú¥³¡¼¥É¡ÊÎ㡧±Ñ¸ì¤Ï "en" ¡Ë¤Ç¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£ +
  • -q °ìÀڤΥá¥Ã¥»¡¼¥¸¤òɽ¼¨¤·¤Ê¤¤¡£ @@ -425,6 +443,8 @@ main (int argc, char **argv) char *filter = NULL; int paper_width, paper_height; int anti_alias = 0; + char *family_name = NULL; + char *langu_name = NULL; int i; int page_index; gdImagePtr image; @@ -530,6 +550,14 @@ main (int argc, char **argv) { anti_alias = 1; } + else if (! strcmp (argv[i], "--family")) + { + family_name = argv[++i]; + } + else if (! strcmp (argv[i], "--language")) + { + lang_name = argv[++i]; + } else if (argv[i][0] != '-') { fp = fopen (argv[i], "r"); @@ -557,6 +585,8 @@ main (int argc, char **argv) FATAL_ERROR ("%s\n", "Fail to decode the input file or stream!"); len = mtext_len (mt); + if (lang_name) + mtext_put_prop (mt, 0, len, Mlanguage, msymbol (lang_name)); if (paper == PAPER_NOLIMIT) paper_width = paper_height = margin = 0; @@ -574,6 +604,9 @@ main (int argc, char **argv) mface_put_prop (face, Mfontset, fontset); mface_put_prop (face, Msize, (void *) (fontsize * dpi / 100)); + if (family_name) + mface_put_prop (face, Mfamily, msymbol (family_name)); + p = mplist_add (plist, Mdevice, msymbol ("gd")); p = mplist_add (p, Mface, face); m17n_object_unref (face);