Settings

The page will reload to apply your changes.
Theme

ASCII Art Font

ASCII Art Menu

Original Usenet message from alt.ascii-art, 20 Dec 1994.
"hebtype" source code was Re: Wanted: Hebrew Characters

"hebtype" source code was Re: Wanted: Hebrew Characters

In article <syl...@netcom.com>,
Sylvia Caras <syl...@netcom.com> wrote:
>I would like to be able to write short messages in Hebrew to send
>via e mail.  Is there a Hebrew ASCII alphabet available?  Sylvia

Yes, you have two choices...

In the widely distributed figlet program (see FAQ) there is a
"Jerusalem" font that has hebrew characters.

Or, you can use the program I wrote to do this with my own couple of hebrew
ASCII fonts.  My program "hebtype" has the advantage of allowing you
to not have to type backwards. And, it has a gematria mode, and a mnemonic
as well as a VT100 key mapping.  And, it can display the 128offset encoded
tanach files which are in public domain -- on any screen!

Here are my fonts themselves:
				Standard 4line hebrew font:
            ____ ,__  |_  ___  __  _ _  _ ____ ___ _ __  ____ __  __   _ _
            |  | |  |   |    |   | | | /|  | |  /  |   |    |   |   |  ,\|
            |__| | _|  /     | __|   |__|  | |  |  | | |    | _/| __|_ | \
                             |                                            
                      ___  _ _ _ __  ___ _ _ _ _  __   __   _ _ ___  _   _
                       | | | | |   | , / | |  \| (_ | (_ \  | | |  |  |  |
                      _| | |/_/    | |   |/  __\    | ___/ _|/  |_/   | _|
                                         |          |                 |   
				Small minimal 2line hebrew font:
                          __  ,_  |_ -, _  _  ,_ __ ,_ _ _  __ _   _      
                          |_| |_)  /  | _| ' \_/ ||  | | ,|  | ,\_ _|_ ,\'

                               _  _ _ _ _  -, |/ _ _ (%| __   _ _ __  T  _
                              _||  \|/   | |  |  _\'   | `_| _|/  (_) | _|

This program should compile on virtually any computer with a C compiler.

-------------cut---here-------------------

/**********************************************************************/
/* hebtype.c  --  A program which uses ASCII based Hebrew fonts.      */
/*                                                                    */
/* This is version 2.0 which was released on 7 Adar b 5752  (3/11/92) */
/* "Hebrew Type" was written by Lev Lawrence who hereby declares it   */
/* to be public domain and may be redistributed, provided that no fee */
/* is ever charged.   I also politely request that any programs which */
/* are derived from this code or Hebrew font refer to Lev Lawrence    */
/* as the originator.   If you have any suggestions, or if you find   */
/* any bugs, or make any enhancements that I might be interested in,  */
/* you can reach me by e-mail at lee...@tigger.cs.colorado.edu          */
/*                                                            _  |_   */
/* I hope you enjoy this program.  If so, let me know.        _|_ /   */
/**********************************************************************/

#include <stdio.h>
#define TRUE 1
#define FALSE 0
int MAXCOL=79;   /* maximum number of usable output columns */
char *strchr();

/* NOTE: shifting in font is because of doubled backslash */
char *gadol[] = {  /* this is the default font */
/***
 0....:....1....:....2....:....3....:....4....:....5....:....6....:....7 ***/
" ____ |_  __  ___  _ _  _ ____ ___ _ __  ____ __  __   _ _        ",
" |  |   |   |    | | | /|  | |  /  |   |    |   |   |  ,\\|        ",
" |__|  /  __|    |   |__|  | |  |  | | |    | _/| __|_ | \\        ",
"                 |                                                ",
" ___  _ _ _ __  ___ _ _ _ _  __   __   _ _ ___   _ _  ,__    ''    ",
"  | | | | |   | , /  \\| | | (_ \\ (_ |  | | |  |  |  | |  |        ",
" _| | |/_/    | |   __\\ |/  ___/    | _|/  |_/  _|  | | _| .       ",
"                        |           |               |              "};
char *katan[] = { /* this is the tiny font */
" __  |_ _  -, _  ,_ __ ,_ _ _  __ _   _         ",
" |_|  / _|  | ' \\_/ ||  | | ,|  | ,\\_ _|_ ,\\'   ",
"  _  _ _ _ _  -, _ _ |/ __  (%|  _ _ __   _ T ,_    ,, ",
" _||  \\|/   | |  _\\' |  `_|   | _|/  (_) _| | |_) .    "};
char *trans[2]   = { "MlcCyTHzvhdgba ","tsrkxXpPiSnNm.\"" };  /* mnemonic    */
char *vttrans[2] = { "okflhyjzuvsdct ",",arem.p;gxbin.\"" };  /* vt100 heb   */

int  gpos[2][16] = { 0,5,9,13,18,20,25,30,34,36,40,45,49,54,58,61, 
                     0,5,11,15,19,23,27,32,37,42,47,50,53,58,60,63 };
int  kpos[2][16] = { 0,4,7,10,13,15,19,22,25,27,30,33,37,41,45,47,
                     0,4,10,13,16,20,23,27,31,36,40,43,45,49,51,54 };
int  gval[27]    = { 1,2,3,4,5,6,7,8,9,10,20,20,30,40,40,
                     50,50,60,70,80,80,90,90,100,200,300,400 };
main (argc,argv)
int argc;
char **argv;
{
        int c,i,j,k,p,outpos,lnum,flush=1,center=1;
        int waspos,wbreak,wrap=FALSE,hyphen=FALSE,fsize=4,gem=FALSE;
        char out[4][1024],blank[1024],wbuffer[1024];
        for (i=1;i<argc;i++) {
          if (argv[i][0]!='-' || strlen(argv[i])!=2) c=0;
          else c=argv[i][1];
          switch (c) {
          case 'l':  /* left flush */
               flush=0;
               center=1;
               break;
          case 'c':  /* centered text */
               flush=1;
               center=2;
               break;
          case 'r':  /* right flush */
               flush=1;
               center=1;
               break;
          case 'w':  /* set width */
               if (i+1<argc) {
                 i++;
                 MAXCOL = atoi(argv[i]);
                 if (MAXCOL==0) {
                   fprintf(stderr, "Error: illegal width\n");
                   exit(1);
                 }
               }
               else {
                 fprintf(stderr, "Error: missing width\n");
                 exit(1);
               }
               break;
          case '2':  /* tiny two line mode */
               fsize=2;  /* default is size 4 font */
               break;
          case 'g':  /* gematria mode */
               gem=TRUE;
               break;
          case 'v':  /* VT100 hebrew standard mapping (also IBM PC) */
               strcpy(trans[0],vttrans[0]);
               strcpy(trans[1],vttrans[1]);
               break;
          default:
               fprintf(stderr,
                 "\nUsage: %s [-lcr] [-w width] [-2][-g][-v]\n\n",argv[0]);
               fprintf(stderr,"  l  = left flush\n  c  = centered text\n");
               fprintf(stderr,"  r  = right flush\n  w  = set width\n");
               fprintf(stderr,"  2  = two line font\n  g  = gematria\n");
               fprintf(stderr,"  v  = VT100 key layout\n\n");
               exit(1);
               break;
          }
        }
        if (gem) exit(gematria());  /* do gematria mode and exit */
        for (i=0;i<MAXCOL;i++) blank[i]=' '; 
        blank[MAXCOL]='\0';
        for (j=0;j<4;j++) strcpy(out[j],blank); /* clear output */
        outpos = MAXCOL-1;
        wbreak = MAXCOL-1;
        waspos = MAXCOL-1;
        wbuffer[0]='\0';
        while ((c=getchar())!=EOF) { /* main reading loop */
          if (outpos<-1) {
            ungetc(c,stdin);
            if (wbreak==MAXCOL-1) {  /* word is bigger than margins */
              wbreak=waspos;
              i=strlen(wbuffer)-1;
              ungetc(wbuffer[i],stdin);
              hyphen=TRUE;
            }
            else for (i=strlen(wbuffer)-1;i>=0;i--) ungetc(wbuffer[i],stdin);
            c=0;
            for (j=0;j<4;j++)
              for (i=0;i<=wbreak;i++)
                out[j][i]=' ';
            outpos=wbreak;
            wbreak=MAXCOL-1;
            wbuffer[0]='\0';
            wrap=TRUE;
            if (hyphen) {   /* hyphenate split word */
              if (center==2) { i=outpos; outpos--; }
              else if (flush==1) i=outpos;
              else if (flush==0) i=outpos+1;
              if (i == -1) i=0;
              out[1][i]='_';  
              hyphen=FALSE;
            }
          }
          if (wrap || c=='\n') {
            if (center==2) outpos=outpos/2+1; /* centered    */
            else if (flush==1) outpos=0;      /* right align */
            else outpos++;                    /* left align  */
            printf("%s\n%s\n",out[0]+outpos,out[1]+outpos);
            if (fsize==4) printf("%s\n%s\n",out[2]+outpos,out[3]+outpos);
            for (j=0;j<4;j++) strcpy(out[j],blank); /* clear output */
            outpos = MAXCOL-1;
            wrap = FALSE;
          }
          waspos = outpos;
          if (c==' ' || c=='\n') {
            wbreak=outpos;
            wbuffer[0]='\0';
          }
          else sprintf(wbuffer,"%s%c",wbuffer,c);
          lnum = 0;
          /* note: next two lines do "tanach" conversion */
          if (c>=0200 && c<=0215) c = trans[0][13-(c-0200)];
          if (c>=0216 && c<=0232) c = trans[1][12-(c-0216)];
          if (strchr(trans[lnum],c)==NULL) lnum++;  /* not found 1st? */
          if (strchr(trans[lnum],c)==NULL) {   /* not found 2nd? */
            if (strchr(".,:!?()0123456789",c)!=NULL) { /* pass thru chars */
              out[0][outpos] = ' ';  /* create output   */
              out[1][outpos] = ' ';  /* create output   */
              out[2][outpos] = ' ';  /* create output   */
              out[3][outpos] = ' ';  /* create output   */
              if (fsize==2) out[1][outpos] = c;
              if (fsize==4) out[2][outpos] = c;
              outpos--;
            }
          }
          else {
            p = 15-strlen(strchr(trans[lnum],c));  /* get position    */
            if (fsize==2) {
              for (k=kpos[lnum][p+1]-1;k>=kpos[lnum][p];k--) {/* font columns*/
                for (j=0;j<2;j++) {                          /* font lines   */
                  out[j][outpos] = katan[j+(2*lnum)][k];    /* create output */
                }
                outpos--;
              }
            }
            else {
              for (k=gpos[lnum][p+1]-1;k>=gpos[lnum][p];k--) {/* font columns*/
                for (j=0;j<4;j++) {                          /* font lines   */
                  out[j][outpos] = gadol[j+(4*lnum)][k];    /* create output */
                }
                outpos--;
              }
            }
          }
        }
    return 0;
}

gematria()  /* the gematria mode selected by -g option */
{           /* NOTE: gematria mode only supports mnemonic and 128 codes */
  int c,gsum,old;
  char *ptr;
  gsum=0;
  while ((c=getchar())!=EOF) { /* main reading loop */
    old=gsum;
    if (c>=0200 && c<=0232) gsum += gval[c-0200];     /* tanach style */
    else {
      ptr = strchr("abgdhvzHTyCclMmNnSiPpXxkrst",c);  /* find char */
      if (ptr!=NULL) gsum += gval[27-strlen(ptr)];    /* find value */
    }
    if (old==gsum && gsum>0) {   /* check if word completed */
      printf("%d ",gsum);
      gsum=0;
    }
    if (c=='\n') putchar('\n');
  }
  return 0;
}
/* EOF */

Original message headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f996b,fdaef925080f50ae
X-Google-Attributes: gidf996b,public
X-Google-ArrivalTime: 1994-12-19 19:07:33 PST
Path: nntp.gmd.de!newsserver.jvnc.net!raffles.technet.sg!ntuix.ntu.ac.sg!news.uoregon.edu!europa.eng.gtefsd.com!gatech!bloom-beacon.mit.edu!boulder!csnews!tigger.cs.colorado.edu!leel
From: lee...@tigger.cs.colorado.edu (Lee "Lev" Lawrence)
Newsgroups: alt.ascii-art
Subject: "hebtype" source code was Re: Wanted: Hebrew Characters
Date: 20 Dec 1994 03:07:33 GMT
Organization: University of Colorado, Boulder
Lines: 253
Message-ID: <3d5hpl$nc...@csnews.cs.Colorado.EDU>
References: <syl...@netcom.com>
NNTP-Posting-Host: tigger.cs.colorado.edu

Related ASCII art in the Gallery

Explore these categories from our collection of 11,000+ artworks:

About this message. This message was posted publicly to the newsgroup alt.ascii-art in 1994 and is mirrored here unchanged as part of the Historic Archives – only email addresses are masked. The artwork and text belong to their original authors: if you copy a piece, keep the artist's initials or signature intact and credit them where you can. Are you the author? Contact us to get your posts attributed, connected to your artist profile, or removed.

Report this message

Help us keep the archive clean and accurate. Reports are reviewed by a person – nothing is changed automatically.

Help classify this post