Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.postscript > #1482

Re: Programmable bitmap hack

Newsgroups comp.lang.postscript
Date 2013-07-19 00:34 -0700
References <c79e49e9-37e8-42d3-9e08-0cee983fc459@googlegroups.com> <eli$1301311734@qz.little-neck.ny.us> <d26539de-eafd-44e2-957c-3f1c9d7a7cb9@googlegroups.com>
Message-ID <fef02c29-e54f-4e7a-8ff7-498bb915bba4@googlegroups.com> (permalink)
Subject Re: Programmable bitmap hack
From luser- -droog <mijoryx@yahoo.com>

Show all headers | View raw


On Friday, February 1, 2013 1:54:42 AM UTC-6, luser- -droog wrote:
> On Thursday, January 31, 2013 5:01:59 PM UTC-6, Eli the Bearded wrote:
> 
> > In comp.lang.postscript, luser- -droog  <mijoryx@yahoo.com> wrote:
> 
> > > But you could easily do sthg like
> > > /_ (\0) def
> > > /# (\377) def
> > > _ _ _ # 
> > > _ _ # _ 
> > > _ # _ _ 
> > > # _ _ _ 
> > > 4 4 8 
> > > [.1 0 0 .1 0 0]{}image
> > > Now PS art is as easy as ASCII art. Have fun!
> 
> > It's like xpm images in postscript! I like this. If you changed your matrix
> > to flip the image side-to-side, though, so the ASCII art matches the
> > orientation of the output, it would be easier to use: 
> 
> >   [-.1 0 0 .1 0 0] 
> 
> Yes. That's much better. But I'm now thinking there's no
> advantage in leaving stuff on the stack and passing an 
> empty procedure (except perhaps in Level-1 interpreters).
> The image data might just as well be *in* the procedure.

This is wrong. Remember that the procedure gets called each time `image` wants a new piece of data. The procedure *must*
do nothing. That's the whole trick here.

Here's the idea extended to an editable Type 3 bitmap font.

/bitfont <<
    /FontType 3
    /FontMatrix [.01 0 0 .01 0 0]
    /FontBBox [ 0 0 50 70]
    /Encoding 128 array
    /_ (\377)
    /# (\0)
    /charprocs <<

        /.notdef { 
            # # # # #
            # _ _ # #
            # _ _ # #
            # _ # _ #
            # _ # _ #
            # # _ _ #
            # # # # #
        }

        32 { 
            _ _ _ _ _
            _ _ _ _ _
            _ _ _ _ _
            _ _ _ _ _
            _ _ _ _ _
            _ _ _ _ _
            _ _ _ _ _
        }
        48 { 
            _ # # # _
            # _ _ _ #
            # _ _ # #
            # _ # _ #
            # # _ _ #
            _ # # # _
            _ _ _ _ _
        }
        49 { 
            _ _ # _ _
            _ # # _ _
            _ _ # _ _
            _ _ # _ _
            _ _ # _ _
            _ # # # _
            _ _ _ _ _
        }

    >>
    /BuildChar {
        %100 0 0 0 50 70 setcachedevice
        100 0 setcharwidth
        -1 1 scale
        exch begin
            charprocs exch
            2 copy known not{pop/.notdef}if
            get exec
            5 7 8 FontMatrix {} image
        end
    }
>> definefont pop

100 100 moveto
/bitfont 20 selectfont
(0 1 0 1 ?) show

showpage

Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Programmable bitmap hack luser- -droog <mijoryx@yahoo.com> - 2013-01-23 23:42 -0800
  Re: Programmable bitmap hack Eli the Bearded <*@eli.users.panix.com> - 2013-01-31 23:01 +0000
    Re: Programmable bitmap hack Eli the Bearded <*@eli.users.panix.com> - 2013-01-31 23:29 +0000
    Re: Programmable bitmap hack luser- -droog <mijoryx@yahoo.com> - 2013-01-31 23:54 -0800
      Re: Programmable bitmap hack luser- -droog <mijoryx@yahoo.com> - 2013-07-19 00:34 -0700
      Re: Programmable bitmap hack luser- -droog <mijoryx@yahoo.com> - 2013-10-29 02:50 -0700

csiph-web