Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j26bk-00039g-S4 for pgsql-docs@arkaria.postgresql.org; Thu, 13 Feb 2020 05:00:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j26bj-0007jO-6h for pgsql-docs@arkaria.postgresql.org; Thu, 13 Feb 2020 05:00:11 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1j26bi-0007jG-PO for pgsql-docs@lists.postgresql.org; Thu, 13 Feb 2020 05:00:11 +0000 Received: from mail-lj1-x234.google.com ([2a00:1450:4864:20::234]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1j26bg-0007CH-1f for pgsql-docs@lists.postgresql.org; Thu, 13 Feb 2020 05:00:09 +0000 Received: by mail-lj1-x234.google.com with SMTP id x14so4995470ljd.13 for ; Wed, 12 Feb 2020 21:00:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=M58foep/v/Lcz+NDOTneiYI1vd1ULGn3BPJvJgFU77I=; b=tAs9mYKnFWNr+fquJasxU4GxWJxih93m+3oalP5LBY32LKgYLtIug0vw6j2uvV2nhO aqHTMrL7p31m+9JqMmdbWSZa5h56A7i6ybxYAFtStfXfaOGapFhKg3N2SpyCRU7mRn4z 627/fFrOJpRSBdhQcTAt5KfDDnEUq7VN0F38TLofkX7uJB62gTWmRGgffcbMbexO/7/T KYc73eUo3LlwyLSFTG161PedE60b5fgqBS6d3dH7Gkz8ucvrVFoYlKPsFv49UDdLMoh4 4M11BSWFo6pFxr9P/dM1f4kz62Rn4PTKW9l/TqbIs7a53ol6MFArL1EVCDxCLhu7ELvx 35LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=M58foep/v/Lcz+NDOTneiYI1vd1ULGn3BPJvJgFU77I=; b=sl7gRVjvalgZkHGgM4Cg5xCCI4bQDevD/lxwuqjpX+38nTSaPb0Nwu/SZTLxAIHyin xwGK+z8oCnEsKbogC+wu0BEsrHLoo8atFYo+JLxDDnV4Y/skyyAKqKYBmFF9CkrGr+2M itLP+UZLLY21eLb4Ip+Uui1k6FNzc7vUqqxpCoW7dImevkB2QjKMTwB9df9rZgz2Ujmp 7bqWKrtiie3CcNrxq4wTPcYu9pGTkkyKXMMPRy6cKz9UzvWqsRXQTQmyVOLH9qG+wIQ4 TozYaGzeQ8nxfdqIcoh29SsD83RaNW+Z/O+Y8hb3ZMxC7CSGmDB7xhrrL4YLu/hCcASh 7m1g== X-Gm-Message-State: APjAAAX3xmoZtTP30ZYJEOdqjIJy1s20qkDOL3Pryavj01n+IzT0QB6a 5LCYklDXz9j9NXD5Y3AzKHkuZEex X-Google-Smtp-Source: APXvYqyclzWGmE9jjilSwT0FmRa6uXBlQCLxt8PUGixLcDej9AWoLqbcERPQHLjmkKyVNCfKpqTlMg== X-Received: by 2002:a2e:85cd:: with SMTP id h13mr10219587ljj.191.1581570004557; Wed, 12 Feb 2020 21:00:04 -0800 (PST) Received: from [1.0.0.7] ([178.155.4.213]) by smtp.gmail.com with ESMTPSA id u23sm489325lfg.89.2020.02.12.21.00.03 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 12 Feb 2020 21:00:03 -0800 (PST) Subject: Re: Getting our tables to render better in PDF output To: Tom Lane Cc: pgsql-docs@lists.postgresql.org References: <9326.1581457869@sss.pgh.pa.us> <8a99bdca-85ab-27d6-83b4-9fc7113839f2@gmail.com> <14006.1581541092@sss.pgh.pa.us> From: Alexander Lakhin Message-ID: <8e615fea-f7f2-3772-26f0-35478c60dfcb@gmail.com> Date: Thu, 13 Feb 2020 08:00:02 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: <14006.1581541092@sss.pgh.pa.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 12.02.2020 23:58, Tom Lane wrote: > Alexander Lakhin writes: >> Please look at a less invasive approach that we use at Postgres Pro for >> some time (mainly for improving the translated documentation, but it >> works for the original one too). The idea is to add zero-width spaces >> after/before some chars ('(', ',', '[', etc) to let fop split lines >> where desired. It has one disadvantage - it's not search-friendly >> (though maybe that is application-dependent). >> But if it's feasible, I think this approach can at least complement a >> manual tables reformatting. Decreasing a font size in the tables seems >> appropriate to me too. > Hmm, interesting proposal. I experimented and verified that injecting > zero-width space (​) does allow line breaking to occur in both > HTML and PDF output, so this could be a route to improving the situation > for overlength example texts. I do not think I like the idea of > automatically injecting tons of them, though. As you say, it might > hinder searching; and it would allow some silly breaks; and there are > cases where it still wouldn't find a break, such as the examples for > sha256() et al. I'd be happier about manually inserting breaks just > in the places we really need them. To keep the source readable, I'd > want to write something like "&zwsp;" not a numeric entity code, > but it looks like we can define custom entities if we want. Yes, I was starting with manual &zwsp; insertions into the translation, but later I reduced such insertions just to several dozens. (For example, we still have "3.1415926535&zwsp;8979323846" in the translation.) The main issue of the manual approach was that I needed to recheck that zwsp placement on updates, and I can't see where it's desired until I generate pdf. Fortunately, fop prints warning like that: [WARN] FOUserAgent - The contents of fo:block line 2 exceed the available area in the inline-progression direction by 22725 millipoints. (See position 127769:983) It's not very user-friendly, but still useful when we have a pair or two of them. (For now, I see 559 such warnings in REL_12_STABLE.) Second issue is that the placement can depend on the page size and in fact most of that zwsps are not needed for html or other formats (moreover, some formats can require different placements (if we're not just implementing some common rules)). Third (minor) issue is with translation - when I will see some break in the English source, e.g. "split_part('abc~@~def&zwsp;~@~ghi', '~@~', 2)", should I leave the break in the same place, or it's better to move it because adjacent text has different length and the table columns have different width? For me this approach expresses a belief that the line breaking rules should be slightly different in our context. For example, having line break after an opening bracket is feasible and common in function calls and declarations. Maybe the rules in the proposed xslt could be improved/restricted, but I think that if fop would allow us to enable an imaginary 'programming language line breaking rules' mode, we would use it for our tables (some or all). Maybe some of the rules can be implemented explicitly in the DocBook source, just to reduce tons of zwsp in the generated output, or the "fo:table-cell/fo:block//text()" condition can be improved to filter some (text-only?) tables out, but I think that the idea of our specific line breaking rules could work. Best regards, Alexander