Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.postscript > #1771
| From | Helge Blischke <h.blischke@acm.org> |
|---|---|
| Newsgroups | comp.lang.postscript |
| Subject | Re: YA Type 3 Hershey font |
| Followup-To | comp.lang.postscript |
| Date | 2014-01-07 19:23 +0100 |
| Message-ID | <bj2v1oFqlgbU1@mid.individual.net> (permalink) |
| References | <a0f71504-9d3a-4a9a-bca3-03388af7e32b@googlegroups.com> |
Followups directed to: comp.lang.postscript
luser- -droog wrote:
> I've been playing with the Hershey font data, using the description at:
> http://paulbourke.net/dataformats/hershey/
> but not the files from there.
> All of the .jhf (John(Hunt)'s Hershey Font (Format)) use 12345 as the
> declared character code. Apparently the glyphs in these files are
> arranged positionally to match the printable ascii range, 33-126.
>
> I got my data file somewhere else (not finding it right now), but it
> appears to be the "older" single-file version, where the declared codes
> have semantic meaning as described in the old Hershey report (not finding
> that either, but if I found a pdf (and I did), it's out there somewhere).
> It appears to be the format Bourke is talking about, too. Char #8 matches
> his example.
>
> So, this program will read the Hershey font data into a dictionary,
> keyed by the "Occidental" character code.
>
> That's all I've got for now.
>
> %!
> /hersheyfile (hershey_occ)(r)file def
> /buf 72 string def
> /charcodes 1 dict def
>
> /strcat { % a b . a+b
> 2 copy length exch length add string % a b new
> dup 4 3 roll 2 copy 0 exch putinterval % b new' new' a
> length 4 3 roll putinterval % new''
> } def
>
> /processline {
> dup length 0 gt { % non-blank line
> dup length 5 gt {
> dup 4 get % line line[4]
> dup 48 ge
> exch 57 le % line '0'<=line[4]<='9'
> and
> { % new glyph
> dup 1 4 getinterval cvi % line idx
> dup /lastcode exch def
> exch 5 1 index length 5 sub getinterval % idx line
> charcodes 3 1 roll put
> }{
> charcodes lastcode get exch strcat % append to previous
> line charcodes exch lastcode exch put
> } ifelse
> }{
> charcodes lastcode get exch strcat
> charcodes exch lastcode exch put
> } ifelse
> }{ % blank line
> pop
> } ifelse
> } def
>
> {
> hersheyfile buf readline {
> processline
> }{
> processline
> exit
> } ifelse
> } loop
>
>
> I just realized there's a better way to
> detect multi-line glyphs. Here I use a heuristic I came up with by
> examining the data. The first column is blank followed by a 4-digit
> character code on a new line. Continuation lines use the first column,
> so anything not starting with space is a continuation. BUT ' R' is a
> valid data point, and it starts with a space, so NOT ALL lines
> beginning with space are in fact new characters. BUT all data points
> will be upper-case characters, biased around ascii 'R'.
>
> So the heuristic is: a new glyph line must be at least 5 characters
> (longer, really, but at least 5) and contain a digit in position 4
> (0-based). Anything else is a continuation, or nothing if it's a
> totally blank line.
>
> A better way would be to check count field and read until the glyph
> is complete. This avoids all use of "heuristic", but may actually be
> more complicated to implement. :/
>
> ...to be continued...
I just found a short description of the file format and a list of
downloadable fonts at
http://emergent.unpythonic.net/software/hershey
Helge
Back to comp.lang.postscript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
YA Type 3 Hershey font luser- -droog <mijoryx@yahoo.com> - 2014-01-06 11:52 -0800
Re: YA Type 3 Hershey font Helge Blischke <h.blischke@acm.org> - 2014-01-07 19:23 +0100
Re: YA Type 3 Hershey font Helge Blischke <h.blischke@acm.org> - 2014-01-07 20:40 +0100
Re: YA Type 3 Hershey font luser- -droog <mijoryx@yahoo.com> - 2014-01-07 22:04 -0800
Re: YA Type 3 Hershey font luser- -droog <mijoryx@yahoo.com> - 2014-01-07 23:42 -0800
Re: YA Type 3 Hershey font luser- -droog <mijoryx@yahoo.com> - 2014-01-07 23:53 -0800
Re: YA Type 3 Hershey font scruss@gmail.com - 2014-04-19 08:47 -0700
Re: YA Type 3 Hershey font tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2014-04-20 01:12 -0400
Re: YA Type 3 Hershey font scruss@gmail.com - 2014-04-22 17:29 -0700
Re: YA Type 3 Hershey font tlvp <mPiOsUcB.EtLlLvEp@att.net> - 2014-04-22 21:42 -0400
Re: YA Type 3 Hershey font scruss@gmail.com - 2014-04-29 14:56 -0700
csiph-web