[NTG-pdftex] [ pdftex-Bugs-747 ] \letterspacefont and \pdffontexpand, again

noreply at sarovar.org noreply at sarovar.org
Thu Jun 28 20:42:21 CEST 2007


Bugs item #747, was opened at 2007-03-09 03:09
You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=493&aid=747&group_id=106

Category: hz
Group: v1.40.1
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Robert (schlcht)
Assigned to: The Thanh Han (hanthethanh)
Summary: \letterspacefont and \pdffontexpand, again

Initial Comment:
When expanding a letterspaced font, the base font will
be expanded, too, resulting in the error `font has been
expanded with different parameters' when the base font
is expanded again:

\letterspacefont\lsfont\font 100
\pdffontexpand\lsfont 20 20 5 autoexpand
\pdffontexpand\font   20 20 5 autoexpand
Z\bye


----------------------------------------------------------------------

>Comment By: The Thanh Han (hanthethanh)
Date: 2007-06-28 18:42

Message:
Logged In: YES 
user_id=710

expanding a letterspaced fonts always implies that the base
font is expanded. In other words, it's impossible *not* to
expand the base font when expanding a letterspaced font.

thanks for further testing. It looks like a bug in checking
font expansion spec. fwiw, font stretch limit is always
fixed to [0..1000] and font shrink limit to [0..500]. Thus
giving a negative value has the same effect like giving 0.

I will play with \copyfont to see if it helps.


----------------------------------------------------------------------

Comment By: Robert (schlcht)
Date: 2007-06-28 14:01

Message:
Logged In: YES 
user_id=2217

If we can get rid of the error message, I think it can be
left at that. Mind you, the problem is not how to expand a
letterspaced font but how to *not* expand the base font when
expanding a letterspaced font. That expanding a letterspaced
font results in expansion of the base font
can be documented as a feature, IMO.

Here are some more clues: The error message seems to be
related to the sign of the stretch parameter.
First of all, with

\letterspacefont\lsfont\font 100
\pdffontexpand\lsfont 20 20 5 autoexpand

the base font will be expanded, however it will never be
shrunk. Then,

\letterspacefont\lsfont\font 100
\pdffontexpand\lsfont 20  20 5 autoexpand
\pdffontexpand\font   20 -20 5 autoexpand

doesn't yield an error. Neither does:

\pdffontexpand\lsfont 20 -20 5 autoexpand
\pdffontexpand\font   20 -20 5 autoexpand

However, here comes the error again:

\pdffontexpand\lsfont 20 -20 5 autoexpand
\pdffontexpand\font   20  20 5 autoexpand

If you expand the base font first, it's OK in any case, also
with different signs.


----------------------------------------------------------------------

Comment By: Taco Hoekwater (taco)
Date: 2007-06-28 07:37

Message:
Logged In: YES 
user_id=1608

That sounds nice, I like it.

----------------------------------------------------------------------

Comment By: The Thanh Han (hanthethanh)
Date: 2007-06-28 06:45

Message:
Logged In: YES 
user_id=710

I agree this is an ugly solution, which has its origin in a
design mistake. However the problem here is not only how to
deal with the error message, but the point is how to use
font expansion with a letterspaced font. Please give it a
thought so we can come up with an acceptable workaround. If
we want everything to be clean, there are more things that
have to be thrown away.

what about this: have a primitive \copyfont which creates a
copy of a font. Example:

\letterspacefont\lsfont\font 100
\copyfont\lsxfont\lsfont
\pdffontexpand\lsxfont 20 20 5 autoexpand



----------------------------------------------------------------------

Comment By: Taco Hoekwater (taco)
Date: 2007-06-27 11:43

Message:
Logged In: YES 
user_id=1608


If there is no clean way of solving the problem, I'd rather
just document the error message as a feature. I find
\pdfnewexpandfont very ugly (sorry Thanh).

----------------------------------------------------------------------

Comment By: The Thanh Han (hanthethanh)
Date: 2007-06-24 10:46

Message:
Logged In: YES 
user_id=710

here is a patch that introduces a new primitive
\pdfnewexpandfont. Usage:

\font\f=cmr10
\pdfnewexpandfont\fx \f 20 20 5 autoexpand

Note that \pdfnewexpandfont generates \fx by loading a TFM
corresponding to \f first, then applies font expansion in
the same way like "\pdffontexpand\fx 20 20 5". So when \f is
a font that doesn't have a corresponding TFM (for example,
because it was generated in pdftex memory only), the above
command won't work. In particular, the following doesn't work:

\font\f=cmr10
\letterspacefont\lsfont\f 100
\pdfnewexpandfont\fx \lsfont 20 20 5 autoexpand

since \lsfont doesn't have a corresponding TFM but was
generated by \letterspacefont. To create a
letterspaced+expanded font, one can use:

\font\f=cmr10
\letterspacefont\fx\f 100
\pdffontexpand\fx 20 20 5 autoexpand

things are gettting messy... sorry about that.
Testing/comments welcome.

----------------------------------------------------------------------

Comment By: Robert (schlcht)
Date: 2007-04-01 00:44

Message:
Logged In: YES 
user_id=2217

Fine for me and microtype. 

----------------------------------------------------------------------

Comment By: The Thanh Han (hanthethanh)
Date: 2007-03-31 09:52

Message:
Logged In: YES 
user_id=710

either name is ok with me. We need a new pritimive to load a
new font and expand it, since the current one doesn't load a
new font and hence is making trouble. I would wait for a
while to see how Robert sees it before making any change.

----------------------------------------------------------------------

Comment By: Nobody (None)
Date: 2007-03-19 11:07

Message:
Logged In: NO 

Hello,

I do not think that \pdfexpandfont is a good name for a new 
primitive, as it is too easy to confuse with \pdffontexpand. 
What about \pdfexpandnewfont, as -- if I understand 
correctly -- a new font is loaded?


Jonathan

P.S: Thank you for creating pdfTeX!

----------------------------------------------------------------------

Comment By: The Thanh Han (hanthethanh)
Date: 2007-03-10 20:18

Message:
Logged In: YES 
user_id=710

Phil Taylor has a suggestion that seems great to me:
introduce a new primitive \pdfexpandfont instead. How do you
see it?

----------------------------------------------------------------------

Comment By: Martin Schröder (oneiros)
Date: 2007-03-10 19:24

Message:
Logged In: YES 
user_id=421

Forget that comment. Of course a change of \pdffontexpand
has to be considered carefully. By you. :-)

----------------------------------------------------------------------

Comment By: Martin Schröder (oneiros)
Date: 2007-03-10 19:22

Message:
Logged In: YES 
user_id=421

No. It's an undocumented primitive. ;-)

----------------------------------------------------------------------

Comment By: The Thanh Han (hanthethanh)
Date: 2007-03-09 17:28

Message:
Logged In: YES 
user_id=710

sigh. A mistake when implementing the \pdffontexpand
primitive: it should load a new font for expansion, instead
of expanding a loaded font. Too late for change now?

----------------------------------------------------------------------

You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=493&aid=747&group_id=106


More information about the ntg-pdftex mailing list