[ pdftex-Bugs-747 ] \letterspacefont and \pdffontexpand, again
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: Robert (schlcht) Date: 2007-06-30 16:12
Message: Logged In: YES user_id=2217 the patch is missing... ---------------------------------------------------------------------- Comment By: The Thanh Han (hanthethanh) Date: 2007-06-29 15:58 Message: Logged In: YES user_id=710 patch updated again. I have tested it with the following: \font\f=cmr10 \pdfcopyfont\fA=\f \letterspacefont\fB=\fA 100 \pdffontexpand\fB 30 30 5 autoexpand \fB \input tufte.tex and it seems to work. But the following doesn't: \letterspacefont\fC=\f 100 \pdfcopyfont\fD=\fC \pdffontexpand\fD 30 30 5 autoexpand probably it's possible with some more effort to make the latter case work too, but it doesn't seem needed. ---------------------------------------------------------------------- Comment By: The Thanh Han (hanthethanh) Date: 2007-06-29 13:32 Message: Logged In: YES user_id=710 patch deleted. Needs more testing. ---------------------------------------------------------------------- Comment By: The Thanh Han (hanthethanh) Date: 2007-06-29 09:56 Message: Logged In: YES user_id=710 sorry, I didn't test it carefully enough. Here is another attempt (tested with the microtype manual). ---------------------------------------------------------------------- Comment By: Martin Schröder (oneiros) Date: 2007-06-29 08:52 Message: Logged In: YES user_id=421 Taco, the new_font_type -> real_font_type is from the fix for bug #722. We need an svn... :-( ---------------------------------------------------------------------- Comment By: Taco Hoekwater (taco) Date: 2007-06-29 07:22 Message: Logged In: YES user_id=1608 On my (fairly) clean sources, one hunk is rejected because of this: else begin if pdf_font_type[f] <> new_font_type then pdf_warning("font expansion", "font should be expanded before its first use", true, true); end; My pdftex.web uses pdf_font_type[f] = real_font_type in that test. I fixed the hunk, but I also get a crash on Robert's test file. ---------------------------------------------------------------------- Comment By: Robert (schlcht) Date: 2007-06-28 23:17 Message: Logged In: YES user_id=2217 Now this yields a core dump with: \pdfadjustspacing2 \pdffontexpand\font 20 20 5 autoexpand \hsize10em Lorem ipsum dolor sit amet, \bye (unless I've messed up pdftex.web with all them patches) ---------------------------------------------------------------------- Comment By: The Thanh Han (hanthethanh) Date: 2007-06-28 20:17 Message: Logged In: YES user_id=710 here is another patch, which introduces \pdfcopyfont. Example: \letterspacefont\lsfont\font 100 \pdfcopyfont\lsxfont\lsfont \pdffontexpand\lsxfont 20 20 5 autoexpand This patch also fixed a bug in expanding local font from virtual fonts: font shrinking didn't work. Big thanks to Robert for help with testing. ---------------------------------------------------------------------- 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
participants (1)
-
noreply@sarovar.org