From owner-freebsd-ports Wed May 3 14:56:34 2000 Delivered-To: freebsd-ports@freebsd.org Received: from sep.hamburg.com (sep.hamburg.com [194.64.112.14]) by hub.freebsd.org (Postfix) with ESMTP id 2F02D37B54D for ; Wed, 3 May 2000 14:56:28 -0700 (PDT) (envelope-from hmo@sep.hamburg.com) Received: (from hmo@localhost) by sep.hamburg.com (8.9.3/8.9.3/hmo18feb00) id XAA86671; Wed, 3 May 2000 23:56:19 +0200 (CEST) (envelope-from hmo) Message-Id: <200005032156.XAA86671@sep.hamburg.com> Subject: netpbm-8.4 To: bryanh@giraffe-data.com Date: Wed, 3 May 2000 23:56:18 +0200 (CEST) Cc: ports@freebsd.org From: hmo@sep.hamburg.com (Helge Oldach) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=ELM957390978-85015-0_ Content-Transfer-Encoding: 7bit Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org --ELM957390978-85015-0_ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Bryan, pbmtext doesn't handle characters below 0x20 or above 0x7f very well - they are just replaced by spaces. This is caused by a sign promotion issue. Attached is a fix for pbmtext.c, making it look into the selected font whether a specific character is present or not (and only if it isn't replace it by a space), and correctly handle character codes 0x01 upto 0xff. Interestingly the built-in "bdf" font (which actually is pbmtext's default font!) already contains full ISO-8859-1 encoding, but that could never be used... Tested on FreeBSD 3.4-STABLE, though it should certainly work on any decent platform. (FreeBSD port maintainer, please feed this into a patch file and cvs it.) Regards, Helge --ELM957390978-85015-0_ Content-Type: text/plain; charset=ISO-8859-1 Content-Disposition: attachment; filename=patch-hmo-1 Content-Description: ../../patches/patch-hmo-1 Content-Transfer-Encoding: 7bit --- pbm/pbmtext.c.orig Sun Mar 19 05:11:47 2000 +++ pbm/pbmtext.c Wed May 3 23:32:21 2000 @@ -15,7 +15,7 @@ #include "pbm.h" #include "pbmfont.h" -static void fix_control_chars ARGS(( char* buf )); +static void fix_control_chars ARGS(( unsigned char* buf, struct font* fn )); static void fill_rect ARGS(( bit** bits, int row0, int col0, int height, int width, bit color )); int @@ -34,7 +34,7 @@ struct glyph* glyph; int lines, maxlines, line; int maxwidth, maxleftb; - char* cp; + unsigned char* cp; char* usage = "[-font ] [-builtin ] [text]"; pbm_init( &argc, argv ); @@ -95,7 +95,7 @@ (void) strcat( buf, argv[argn] ); ++argn; } - fix_control_chars( buf ); + fix_control_chars( buf, fn ); lp[0] = buf; lines = 1; } @@ -106,7 +106,7 @@ { int l; - fix_control_chars( buf ); + fix_control_chars( buf, fn ); l = strlen( buf ); if ( lines >= maxlines ) { @@ -143,7 +143,7 @@ for ( line = 0; line < lines; ++line ) { int x = 0; int bwid = 0; - char lastch; + unsigned char lastch; int isfirst; /* logical */ isfirst = 1; /* initial assumption */ @@ -211,8 +211,9 @@ } static void -fix_control_chars( buf ) - char* buf; +fix_control_chars( buf, fn ) + unsigned char* buf; + struct font* fn; { int i, j, n, l; @@ -228,8 +229,8 @@ buf[i] = ' '; --i; } - else if ( buf[i] < ' ' || buf[i] > '~' ) - /* Turn other control chars into a single space. */ + else if ( !fn->glyph[(int)buf[i]] ) + /* Turn unknown chars into a single space. */ buf[i] = ' '; } } --ELM957390978-85015-0_-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message