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


Groups > comp.lang.postscript > #2749 > unrolled thread

Re: findfont vs selectfont

Started byjdaw1 <jdawiseman@gmail.com>
First post2016-08-11 04:39 -0700
Last post2016-08-12 14:09 -0700
Articles 8 — 4 participants

Back to article view | Back to comp.lang.postscript

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: findfont vs selectfont jdaw1 <jdawiseman@gmail.com> - 2016-08-11 04:39 -0700
    Re: findfont vs selectfont Carlos <angus@quovadis.com.ar> - 2016-08-11 17:05 +0200
      Re: findfont vs selectfont jdaw1 <jdawiseman@gmail.com> - 2016-08-12 02:28 -0700
        Re: findfont vs selectfont Carlos <angus@quovadis.com.ar> - 2016-08-12 12:26 +0200
          Re: findfont vs selectfont ken <ken@spamcop.net> - 2016-08-12 11:36 +0100
            Re: findfont vs selectfont Carlos <angus@quovadis.com.ar> - 2016-08-12 16:17 +0200
              Re: findfont vs selectfont ken <ken@spamcop.net> - 2016-08-12 15:53 +0100
                Re: findfont vs selectfont luser droog <luser.droog@gmail.com> - 2016-08-12 14:09 -0700

#2749 — Re: findfont vs selectfont

Fromjdaw1 <jdawiseman@gmail.com>
Date2016-08-11 04:39 -0700
SubjectRe: findfont vs selectfont
Message-ID<31807400-680f-4f6f-a96d-3a79e79d474d@googlegroups.com>
It could be that ‘/Helvetica 10 selectfont’ checks whether the current font is Helvetica 10, and only if it isn’t does it do the ‘… findfont … scalefont setfont’. That alone might remove from the execution time many instances, perhaps many many instances, of ‘findfont’.

[toc] | [next] | [standalone]


#2750

FromCarlos <angus@quovadis.com.ar>
Date2016-08-11 17:05 +0200
Message-ID<noi472$b7k$1@dont-email.me>
In reply to#2749
On 11/08/2016 13:39, jdaw1 wrote:
> It could be that ‘/Helvetica 10 selectfont’ checks whether the
> current font is Helvetica 10, and only if it isn’t does it do the ‘…
> findfont … scalefont setfont’. That alone might remove from the
> execution time many instances, perhaps many many instances, of
> ‘findfont’.
>

Does this mean there is a simple way to get the current font size? What 
is it?

(The "not simple" way would be dividing the y component of the current 
font matrix by the one of the original font.)

-- 

[toc] | [prev] | [next] | [standalone]


#2756

Fromjdaw1 <jdawiseman@gmail.com>
Date2016-08-12 02:28 -0700
Message-ID<01d6de9f-c5b5-4c9e-b54e-f2aab0f6e4f7@googlegroups.com>
In reply to#2750
From www.jdawiseman.com/papers/placemat/placemat.ps (which I know isn’t what you want):


% http://bugs.ghostscript.com/show_bug.cgi?id=689664
/CurrentFontSize
{
	DeBugLevel 5 le {(+CurrentFontSize) OutputToLog} if
	currentfont dup
	/FontMatrix get 3 get  % current y scale
	exch /FontName get findfont /FontMatrix get 3 get  % original y scale
	div
	DeBugLevel 5 le {(-CurrentFontSize) OutputToLog} if
} bind def  % /CurrentFontSize
% https://groups.google.com/forum/#!topic/comp.lang.postscript/cteFkRmWMVg
/CurrentFontName {currentfont /FontName get} bind def

[toc] | [prev] | [next] | [standalone]


#2757

FromCarlos <angus@quovadis.com.ar>
Date2016-08-12 12:26 +0200
Message-ID<nok88d$qc7$1@dont-email.me>
In reply to#2756
On 12/08/2016 11:28, jdaw1 wrote:
>  From www.jdawiseman.com/papers/placemat/placemat.ps (which I know isn’t what you want):
>
>
> % http://bugs.ghostscript.com/show_bug.cgi?id=689664
> /CurrentFontSize
> {
> 	DeBugLevel 5 le {(+CurrentFontSize) OutputToLog} if
> 	currentfont dup
> 	/FontMatrix get 3 get  % current y scale
> 	exch /FontName get findfont /FontMatrix get 3 get  % original y scale
> 	div
> 	DeBugLevel 5 le {(-CurrentFontSize) OutputToLog} if
> } bind def  % /CurrentFontSize
> % https://groups.google.com/forum/#!topic/comp.lang.postscript/cteFkRmWMVg
> /CurrentFontName {currentfont /FontName get} bind def
>

I was using this

/currentfontheight {
     currentfont /FontMatrix get 3 get
     currentfont /OrigFont get /FontMatrix get 3 get
     div
} bind def

but now I wonder whether all fonts have an OrigFont entry...

-- 

[toc] | [prev] | [next] | [standalone]


#2758

Fromken <ken@spamcop.net>
Date2016-08-12 11:36 +0100
Message-ID<MPG.3217b6f27413bcc698990c@usenet.plus.net>
In reply to#2757
In article <nok88d$qc7$1@dont-email.me>, angus@quovadis.com.ar says...

> /currentfontheight {
>      currentfont /FontMatrix get 3 get
>      currentfont /OrigFont get /FontMatrix get 3 get
>      div
> } bind def
> 
> but now I wonder whether all fonts have an OrigFont entry...

No, they don't. Are you using Ghostscript by any chance ?

[toc] | [prev] | [next] | [standalone]


#2759

FromCarlos <angus@quovadis.com.ar>
Date2016-08-12 16:17 +0200
Message-ID<noklpl$6nl$1@dont-email.me>
In reply to#2758
On 12/08/2016 12:36, ken wrote:
> In article <nok88d$qc7$1@dont-email.me>, angus@quovadis.com.ar says...
>
>> /currentfontheight {
>>       currentfont /FontMatrix get 3 get
>>       currentfont /OrigFont get /FontMatrix get 3 get
>>       div
>> } bind def
>>
>> but now I wonder whether all fonts have an OrigFont entry...
>
> No, they don't. Are you using Ghostscript by any chance ?

Yes. So, I assume this is a ghostscriptism?

-- 

[toc] | [prev] | [next] | [standalone]


#2760

Fromken <ken@spamcop.net>
Date2016-08-12 15:53 +0100
Message-ID<MPG.3217f33c53d3211a98990d@usenet.plus.net>
In reply to#2759
In article <noklpl$6nl$1@dont-email.me>, angus@quovadis.com.ar says...
> 
> On 12/08/2016 12:36, ken wrote:
> > In article <nok88d$qc7$1@dont-email.me>, angus@quovadis.com.ar says...
> >
> >> /currentfontheight {
> >>       currentfont /FontMatrix get 3 get
> >>       currentfont /OrigFont get /FontMatrix get 3 get
> >>       div
> >> } bind def
> >>
> >> but now I wonder whether all fonts have an OrigFont entry...
> >
> > No, they don't. Are you using Ghostscript by any chance ?
> 
> Yes. So, I assume this is a ghostscriptism?


Its added by the Ghostscript font machinery for internal purposes. It is 
not guaranteed to be present on any other interpreter. As it is a 
Ghostscript internal feature (not part of the API) it may change without 
notice, you sholdn't use it.


				Ken

[toc] | [prev] | [next] | [standalone]


#2761

Fromluser droog <luser.droog@gmail.com>
Date2016-08-12 14:09 -0700
Message-ID<95e6f255-29c9-4516-85a9-ef4347d50879@googlegroups.com>
In reply to#2760
On Friday, August 12, 2016 at 9:53:39 AM UTC-5, ken wrote:
> In article <noklpl$6nl$1@dont-email.me>, angus@quovadis.com.ar says...
> > 
> > On 12/08/2016 12:36, ken wrote:
> > > In article <nok88d$qc7$1@dont-email.me>, angus@quovadis.com.ar says...
> > >
> > >> /currentfontheight {
> > >>       currentfont /FontMatrix get 3 get
> > >>       currentfont /OrigFont get /FontMatrix get 3 get
> > >>       div
> > >> } bind def
> > >>
> > >> but now I wonder whether all fonts have an OrigFont entry...
> > >
> > > No, they don't. Are you using Ghostscript by any chance ?
> > 
> > Yes. So, I assume this is a ghostscriptism?
> 
> 
> Its added by the Ghostscript font machinery for internal purposes. It is 
> not guaranteed to be present on any other interpreter. As it is a 
> Ghostscript internal feature (not part of the API) it may change without 
> notice, you sholdn't use it.
> 

/findfont yields the "OrigFont". This may be less 
efficient, but should be portable[1].

/currentfontheight {
    currentfont dup /FontMatrix get 3 get
    exch /FontName get findfont /FontMatrix get 3 get
    div
} bind def

[1] but not (yet) with xpost, which does not (currently)
expose the internals of Type 1 fonts, and does not
(currently) correctly handle multiple instances of Type 3
fonts.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.postscript


csiph-web