Re: Everything on a single page
Kamil Rytarowski <[email protected]>
| Newsgroups | gmane.comp.type-setting.lout |
|---|---|
| Message-ID | <[email protected]> |
On 12.06.2013 00:33, Valery Ushakov wrote:
> On Tue, Jun 11, 2013 at 19:50:34 +0200, Kamil Rytarowski wrote:
>
>> internal error: assert failed in MinSize: fwd(x, dim) < 0!
> Hmm, interesting. The first error that valgrind tells me about is
> that lout is confused by egonek in "Wste,p" (in the chapter title)
> when table of contents is produced on the thrid run:
>
> Conditional jump or move depends on uninitialised value(s)
> at 0x4F7B6C: FontWordSize (z37.c:1683)
> by 0x47B096: MinSize (z12.c:1093)
> [...]
> Uninitialised value was created by a heap allocation
> at 0x4C2B6CD: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
> by 0x4F2FD8: FontRead (z37.c:729)
> by 0x4F5876: FontChange (z37.c:1347)
> [...]
>
> and many more. Depending on the garbage you've got in the
> uninitialised memory you either get that error or a crash.
>
> A quick kludge to change z37.c:729 from malloc to calloc (that zeroes
> the memory):
>
> --- z37.c~ 2010-09-10 00:55:04.000000000 +0400
> +++ 37.c 2013-06-12 01:11:42.317596802 +0400
> @@ -726,7 +726,7 @@
> /* initialise font metrics table for the new font */
> ifdebug(DMA, D,
> DebugRegisterUsage(MEM_FONTS, 1, MAX_CHARS * sizeof(struct metrics)));
> - fnt = (struct metrics *) malloc(MAX_CHARS * sizeof(struct metrics));
> + fnt = (struct metrics *) calloc(MAX_CHARS, sizeof(struct metrics));
> if( fnt == (struct metrics *) NULL )
> Error(37, 25, "run out of memory while reading font file %s",
> FATAL, &fpos(err), FileName(fnum));
>
> papers over the internal error, but produces incorrectly formatted
> document.
>
>
> This is where it gets even more interesting.
>
> To begin with, it looks like extra metric files (Ti-Rm+ &c) mostly
> contain subset of Latin2 used for Czech. "eogonek" is found only in
> two files,
>
> Ti-It+:5:C -1 ; WX 444 ; N eogonek ; B 25 -10 424 460 ;
> Ti-Rm+:5:C -1 ; WX 444 ; N eogonek ; B 25 -10 424 460 ;
>
> But consider attached minimized document that has
>
> @Chapter
> @Title { @Show { Wst{@Char eogonek}p } test }
>
> When "Wste,p test" is printed in the chapter title itself, it's
> printed correctly and the bounding box around "Wste,p" (drawn by
> @Show) is correct.
>
> When "Wste,p test" is printed in the TOC, "test" runs into "Wste,p"
> and the bounding box is incorrect. This is where valgrind complained
> about uninitialised value, and where now zero bounding box for eogonek
> is picked up. Of course the font itself is recoded correctly, so
> eogonek in "Wste,p" is printed, but since Lout thinks it's zero-width,
> it positions "test" based on incorrect size of "Wste,p".
>
> But both of them are in the same TimesCE Bold! And valgrind doesn't
> complain on the first two runs (when chapter title is printed, but TOC
> is not). So I'm puzzled. Unfortunately I don't have time right now
> to debug it further. If anyone can pick this up, minimized test case
> is attached and valgrind, -dddft, and -dddcm are your friends :).
>
> -uwe
Hello,
I have reproduced this behaviour locally for the given eogonek.lt example.
Changing {@Char eogonek} from "Wst{@Char eogonek}p" to [of course in
ISO-Latin2] one of ź/ć/ń produces the internal error,changing to one of
ą/ś/ż results with: "437,24: 668.2c object too high for 24.7c space;
will try elsewhere" and the ó/ł are accepted as a valid character.
Regards,