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


Groups > comp.lang.postscript > #2261

Re: . bbox of a set of glyphs

From ken <ken@spamcop.net>
Newsgroups comp.lang.postscript
Subject Re: . bbox of a set of glyphs
Date 2015-05-12 16:36 +0100
Message-ID <MPG.2fbc2e5fdc27bbb9898f7@usenet.plus.net> (permalink)
References <e960544e-41e2-4c87-bda4-dca56daf7c41@googlegroups.com> <5ffcd84c-36e3-4081-9835-dbea724090c7@googlegroups.com>

Show all headers | View raw


In article <5ffcd84c-36e3-4081-9835-dbea724090c7@googlegroups.com>, 
jodun@mail.com says...

> Thanks jdaw1, luser droug,  and of course Ken who took the time to 
code.
> 
> Ken, your code seems to work for fonts,
> but for other graphics it is cut off.  Please see my humble  take :

Its only designed to work for fonts/text, because that's what you posted 
as an example....

All that code does is convert text into paths so that we can do a 
pathbbox on it. For other types of marking operations, different (but 
related) approaches are required.

For example, fill and rectfill could be redefined to simply take the 
bbox of their respective paths, and then execute a newpath. Likewise 
stroke and rectstroke. Images require calculation based on the declared 
width and height, the image matrix and teh current CTM, and so on. If 
you want a fully general approach then there's a lot of work still to 
do.

At all times you need to respect the current clip, which the code above 
doesn't do for text either, note. You would also need to redefine the 
other 9 members of the show family of operators.

If you are going to draw off the media, then you don't have a lot of 
choice about redefining the operators in order to find out the extent of 
the content. This is because in order to find the true, accurate, extent 
we need to convert into device space, and device space, unlike user 
space, is limited to 'real' co-ordinates. THat is, you can't draw off 
the page.

If you can arrange for all your content to be drawn on the page, then 
you can simply use the bbox debice in Ghostscript. If you are going to 
draw all over the place, and not track it yourself, then you need to 
write a PostScript program to do it instead. Its possible, but its not 
trivial.


				Ken

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


Thread

.   bbox of a set of glyphs jodun@mail.com - 2015-04-30 15:05 -0700
  Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-01 07:48 +0100
  Re: .   bbox of a set of glyphs jdaw1 <jdawiseman@gmail.com> - 2015-05-01 01:50 -0700
  Re: .   bbox of a set of glyphs jodun@mail.com - 2015-05-02 06:48 -0700
    Re: .   bbox of a set of glyphs jdaw1 <jdawiseman@gmail.com> - 2015-05-02 14:13 -0700
      Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-04 08:00 +0100
        Re: .   bbox of a set of glyphs jdaw1 <jdawiseman@gmail.com> - 2015-05-08 01:34 -0700
          Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-08 10:44 +0100
            Re: .   bbox of a set of glyphs jdaw1 <jdawiseman@gmail.com> - 2015-05-08 05:06 -0700
          Re: .   bbox of a set of glyphs SaGS <sags5495@gmail.com> - 2015-05-11 01:40 -0700
            Re: .   bbox of a set of glyphs jdaw1 <jdawiseman@gmail.com> - 2015-05-11 02:58 -0700
    Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-04 08:50 +0100
  Re: .   bbox of a set of glyphs jodun@mail.com - 2015-05-04 11:22 -0700
  Re: .   bbox of a set of glyphs jodun@mail.com - 2015-05-07 14:01 -0700
    Re: .   bbox of a set of glyphs luser- -droog <mijoryx@yahoo.com> - 2015-05-07 21:19 -0700
    Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-08 08:21 +0100
    Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-08 12:06 +0100
  Re: .   bbox of a set of glyphs jodun@mail.com - 2015-05-12 07:44 -0700
    Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-12 16:36 +0100
  Re: .   bbox of a set of glyphs jodun@mail.com - 2015-05-14 08:18 -0700
    Re: .   bbox of a set of glyphs ken <ken@spamcop.net> - 2015-05-14 17:31 +0100

csiph-web