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 1j2i4N-0004Ep-4u for pgsql-docs@arkaria.postgresql.org; Fri, 14 Feb 2020 21:00:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j2i4L-0002Im-Qz for pgsql-docs@arkaria.postgresql.org; Fri, 14 Feb 2020 21:00:13 +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 1j2i4L-0002Gn-7v for pgsql-docs@lists.postgresql.org; Fri, 14 Feb 2020 21:00:13 +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 1j2i4E-0001CW-Eu for pgsql-docs@lists.postgresql.org; Fri, 14 Feb 2020 21:00:12 +0000 Received: by mail-lj1-x234.google.com with SMTP id e18so12129273ljn.12 for ; Fri, 14 Feb 2020 13:00:06 -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-language; bh=hnAHPG+IoIwanRiDeoLHtjDDcIcwuprEQuZmfet7mbs=; b=oCFgjFao7NgKUFqdu8F52KEyahe+LlCImo49iJT07fanGf5Yam4N7P8R5uAUV0JT1W t2IUSG4y9Spf8brpq/zvWLTGNjr+jzSVFv89uDFTlYkjeLTw799TBOrkSbnhNWQZCuXS qnjXW/DNmHxgiwHyXoyqopgFVpHui/u5BZhIvYUTDW6rQSelngGeNT+x4Xm10lDu6dpF WX9pOCd2c724pLejGQnPbPJteHavcfBVK/kmvuiaPz1vcOeMo9APjcPNmfR5bUWNIrrn YiDC1fkmE454U18T7CNa+LKxaNwUDKlok4jv2Pmy4g/ZdnI8SGHh/Cd5gpLe6N3LE+op ehAA== 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-language; bh=hnAHPG+IoIwanRiDeoLHtjDDcIcwuprEQuZmfet7mbs=; b=ra2WGrrq4l8+ewI243DuTgjnb+vlIWIV8fd7feNsQh79TaI/u04mnYcEv5lZaLQ6Ka KIgGdgB5X7vNFGGWDATyMIff15dM7M2GWOCoJqgAlxzNR1Gvd0O2EZJEz1C4MhqIuZbB CwH+ToNKHmaLJ0tn2TMAAHxMguDlNUzlL7Cr4BccEOce12CSrb4iWkwy7Z7DKiaRT9HV fpGyuXYFhGexKCV9jFQefSf4dRCI4RbL05Jl/WrCb8YFJCrPOe/A3qxhJ1TVNjwP//8F F3J3NKWbRqTIoas2xCZh3zTnPe/+dIhl1yNMhP0oyIwC0ABGNJj+s8KWAS+BP6/fs0xq Jvwg== X-Gm-Message-State: APjAAAVD8kw+lAa/t+YUbXNZDp2J5D4dRuB9ZW2CqLAQTdnmeYm3LqAN FmNRvwC5bdzK+79rhzAQ5uoL3gw1 X-Google-Smtp-Source: APXvYqxbPZDdVxkt+YvL7qSzIm70x/BjyjdFFRg+Spyx92fY0EtqQgizODRDIQ52Fo5EBhBvkJFBaw== X-Received: by 2002:a2e:89d4:: with SMTP id c20mr3119057ljk.228.1581714003621; Fri, 14 Feb 2020 13:00:03 -0800 (PST) Received: from [1.0.0.7] ([178.155.4.213]) by smtp.gmail.com with ESMTPSA id b64sm3465534lfg.7.2020.02.14.13.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 14 Feb 2020 13:00:02 -0800 (PST) Subject: Re: Getting our tables to render better in PDF output To: Alvaro Herrera Cc: Tom Lane , pgsql-docs@lists.postgresql.org References: <20200214201642.GA12832@alvherre.pgsql> From: Alexander Lakhin Message-ID: Date: Sat, 15 Feb 2020 00:00:00 +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: <20200214201642.GA12832@alvherre.pgsql> Content-Type: multipart/alternative; boundary="------------65DD587082088D1BD0E57F23" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------65DD587082088D1BD0E57F23 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Hello Alvaro, 14.02.2020 23:16, Alvaro Herrera wrote: > On 2020-Feb-13, Alexander Lakhin wrote: > >> 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. > It seems to me that a productive way forward would be to fix the layout > to make these warning disappear. Then it will be relatively easy to find > where to fix, if new ones appear. > > Now I suppose you're complaining about the "position 127769:983" part of > the error message which tells you with zero clarity where the problem > is. Maybe what we need is to figure out what the numbers mean, and how > to use them; for example if they are byte offsets into the file, then it > should be possible to tell your editor to go to that byte in the > complete XML file. I'm not complaining about the cryptic position of the problems, I'm concerned with their number. The position is specified as {line_number}:{character_postition} in postgres-*.fo (not in the DocBook source). For example, when performing `make postgres-A4.pdf` on REL_12_STABLE I get: [WARN] FOUserAgent - The contents of fo:block line 1 exceed the available area in the inline-progression direction by more than 50 points. (See position 28808:374) To find an exact problematic text you can look at the specified line(s) of postgres-A4.fo: /$ sed -n '28808,28811p' postgres-A4.fo / EXPLAIN SELECT * FROM tenk1 WHERE unique1 < 100; Searching this text in pdf gets you to page 467 where you can see a long line of '---' going of the page... >> 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? > If the English version is warning-clean, then it should be possible to > keep the zwsps in the same location in the translation, and then tweak > the translation according to any new warnings that appear there. > My guess is that the majority of zwsps are going to want to stay in the > same place. Yes, that's why I consider this as minor issue, but some kind of an automatic solution can eliminate it at 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. > Maybe we can mark-up specific table cells/columns as being subject to > the special line breaking rules. Things made complicated by the xslt preprocessor, because you can't see Docbook tags and attributes on a FOP level, but I can explore possible resolutions if we choose to go this way. Best regards, Alexander --------------65DD587082088D1BD0E57F23 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
Hello Alvaro,
14.02.2020 23:16, Alvaro Herrera wrote:
On 2020-Feb-13, Alexander Lakhin wrote:

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.
It seems to me that a productive way forward would be to fix the layout
to make these warning disappear. Then it will be relatively easy to find
where to fix, if new ones appear.

Now I suppose you're complaining about the "position 127769:983" part of
the error message which tells you with zero clarity where the problem
is.  Maybe what we need is to figure out what the numbers mean, and how
to use them; for example if they are byte offsets into the file, then it
should be possible to tell your editor to go to that byte in the
complete XML file.
I'm not complaining about the cryptic position of the problems, I'm concerned with their number.
The position is specified as {line_number}:{character_postition} in postgres-*.fo (not in the DocBook source).
For example, when performing `make postgres-A4.pdf` on REL_12_STABLE I get:
[WARN] FOUserAgent - The contents of fo:block line 1 exceed the available area in the inline-progression direction by more than 50 points. (See position 28808:374)

To find an exact problematic text you can look at the specified line(s) of postgres-A4.fo:
$ sed -n '28808,28811p' postgres-A4.fo
<fo:block id="id-1.5.13.4.7.12.1" wrap-option="wrap" text-align="start" space-before.minimum="0.8em" space-before.optimum="1em" space-before.maximum="1.2em" space-after.minimum="0.8em" space-after.optimum="1em" space-after.maximum="1.2em" hyphenate="false" white-space-collapse="false" white-space-treatment="preserve" linefeed-treatment="preserve" font-family="monospace">
EXPLAIN SELECT * FROM tenk1 WHERE unique1 &lt; 100;

Searching this text in pdf gets you to page 467 where you can see a long line of '---' going of the page...
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?
If the English version is warning-clean, then it should be possible to
keep the zwsps in the same location in the translation, and then tweak
the translation according to any new warnings that appear there.
My guess is that the majority of zwsps are going to want to stay in the
same place.
Yes, that's why I consider this as minor issue, but some kind of an automatic solution can eliminate it at 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.
Maybe we can mark-up specific table cells/columns as being subject to
the special line breaking rules.
Things made complicated by the xslt preprocessor, because you can't see Docbook tags and attributes on a FOP level, but I can explore possible resolutions if we choose to go this way.

Best regards,
Alexander
--------------65DD587082088D1BD0E57F23--