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


Groups > comp.lang.postscript > #2584

Re: wanted: kcharpath ...

From Carlos <angus@quovadis.com.ar>
Newsgroups comp.lang.postscript
Subject Re: wanted: kcharpath ...
Date 2016-05-22 14:20 +0200
Organization A noiseless patient Spider
Message-ID <20160522142030.2ad51c0f@samara.DOMA> (permalink)
References <slrnnjfrfs.2bk.peter@box8.pjb.com.au> <20160518230051.164da369@samara.DOMA> <slrnnjvgqe.1tl.peter@box8.pjb.com.au>

Show all headers | View raw


[Peter Billam <peter@www.pjb.com.au>, 2016-05-21 02:09]
[...]
> > The proc gets the current and next character *names* (not codes)
> > in the stack.  
> 
> Where is that most likely to bother me ?
> (ie: once I get past the ` {pop pop ` stage)

I figured character codes are mostly useless if you are using
reencoded fonts. Also, if you load kerning tables, they usually have
pairs of glyph names, not codes.

If you discard them they are not going to bother you at all,
regardless of their type ;).

[...]
> > /ASCIISmallCaps <<
> >     /FontType 0
> >     /FontMatrix [ 1 0 0 1 0 0 ]
> >     /FMapType 6
> >     /SubsVector <00 61 1a>
> >     /Encoding [ 0 1 2 ]
> >     /FDepVector [
> >         /Times-Roman findfont
> >         /Times-SC /Times-Roman findfont dup length dict copy
> >           dup /FontName /Times-SC put
> >           dup /Encoding [ 65 1 90 {
> >                               1 string dup 0  4 -1 roll put  cvn
> >                           } for
> >                         ] put
> >           definefont 0.8 scalefont
> >         /Times-end /Times-Roman findfont dup length dict copy
> >           dup /FontName /Times-end put
> >           dup /Encoding [ /bracketleft /bar /bracketright
> >                           /tilde /.notdef ] put
> >           definefont
> >     ]  
> > >> definefont pop  
> 
> I'm still not sure how that works.  How does it turn lower-case
> into small uppercase?  It must be in the SubsVector, since 61 hex
> is "A" ascii, and 1a is 26, the length of the alphabet;
> but I don't see a `32 sub` or `32 add` anywhere.
> And how does `0.8 scalefont` only get applied to former a-z chars ?
> And the `/Encoding [ 65 1 90`  (PLRM: "an array of integers, each
> used as an index to extract a font dictionary from the FDepVector")
> I think it was at that point that I got brain-overload :-( ...

SubsVector defines character code ranges by their size, the last being
implicit. The ranges are:

        size      range
  16#61 = 97        0 -  96;  \000 - `
  16#1A = 26       97 - 122;  a    - z
  implicit        123 - 256;  {    - \377

When show (or cshow) meets an 'a' in a string (code 97), it finds it
belongs to the second range (index 1). It looks up the number at index
1 in the Encoding vector (it's 1 again). Then uses that number to find
which subfont to use from FDepVector (it's the font at index 1). Then
it subtracts the start of the range from the char code (97-97=0) and
uses the glyph at that index in the subfont's Encoding vector.

The font at index 1 in FDepVector is reencoded, it's Encoding vector
is simply [ /A /B /C /D /E ... /Z ]. I made it looping from 'A' (65)
to 'Z' (90), creating a string with that letter and then converting it
to a name... it was a silly thing to do, using getinterval/putinterval
to copy the range from Times-Roman's encoding, or even writing /A /B
... /Z would have been faster and more readable.

Anyway, to get back... the subtraction you were missing is done
automatically by the composite font system. And scalefont is only
applied to the font on top of the stack, which is the font we just
created by copying Times-Roman, and changing its Encoding vector.

HTH

-- 

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


Thread

wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-15 03:33 +0000
  Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-15 14:16 -0700
    Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-16 06:51 +0000
      Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-18 02:01 +0000
        Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-17 20:41 -0700
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-17 20:44 -0700
            Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-18 06:59 +0000
      Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-18 22:29 -0700
  Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-05-18 23:00 +0200
    Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-21 02:09 +0000
      Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-21 03:13 +0000
      Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-05-22 14:20 +0200
        Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-05-29 06:24 +0000
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-28 23:43 -0700
          Re: wanted: kcharpath ... luser- -droog <mijoryx@yahoo.com> - 2016-05-29 01:10 -0700
            from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-05-31 08:51 +0000
              Re: from image to imagemask luser- -droog <mijoryx@yahoo.com> - 2016-06-01 00:53 -0700
                Re: from image to imagemask luser- -droog <mijoryx@yahoo.com> - 2016-06-01 01:10 -0700
                Re: from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-06-02 01:26 +0000
                Re: from image to imagemask Peter Billam <peter@www.pjb.com.au> - 2016-06-03 07:53 +0000
          Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-06-03 14:38 +0200
            Re: wanted: kcharpath ... Peter Billam <peter@www.pjb.com.au> - 2016-06-06 02:43 +0000
              Re: wanted: kcharpath ... Carlos <angus@quovadis.com.ar> - 2016-06-06 07:53 +0200

csiph-web