[prev in list] [next in list] [prev in thread] [next in thread] 

List:       fop-dev
Subject:    [jira] [Updated] (FOP-3023) Simulated Bold Errors in Adobe Acrobat
From:       "Nicholas Moser (Jira)" <jira () apache ! org>
Date:       2021-08-12 15:23:00
Message-ID: JIRA.13394934.1628781655000.878722.1628781780032 () Atlassian ! JIRA
[Download RAW message or body]


     [ https://issues.apache.org/jira/browse/FOP-3023?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel \
]

Nicholas Moser updated FOP-3023:
--------------------------------
    Description: 
In some cases, simulated bold text seems to throw an error in Adobe Acrobat. It's \
been erroring in every Adobe Acrobat version released in what seems like the last \
year, possibly more. h2. The Problem

For example (version 2021.005.20060; Windows 10.0.19042 Build 19042):

!image-2021-08-12-10-10-13-731.png!

It's hard to tell exactly why this issue occurs, but it appears to be related to the \
fact that simulated bold pushes (q) and pops (Q) the graphics state. Furthermore, it \
appears that this may cause issues only when on the last row of a table.

You can reproduce the issue by using the following fonts:
 * [https://fonts.google.com/specimen/Open+Sans]
 * [https://fonts.google.com/specimen/Noto+Sans]
 * [https://fonts.google.com/specimen/Source+Code+Pro]

Along with the following FOP configuration file:

  
{code:java}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fop version="1.0">
	<renderers>
		<renderer mime="application/pdf">
			<fonts>
				<font embed-url="file:/C:/Open_Sans/OpenSans-Regular.ttf" kerning="yes" \
simulate-style="true">  <font-triplet name="sans-serif" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif" style="normal" weight="bold"/>
					<font-triplet name="sans-serif" style="italic" weight="normal"/>
					<font-triplet name="sans-serif" style="italic" weight="bold"/>
				</font>
				<font embed-url="file:/C:/Noto_Sans/NotoSans-Regular.ttf" kerning="yes" \
simulate-style="true">  <font-triplet name="sans-serif2" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif2" style="normal" weight="bold"/>
					<font-triplet name="sans-serif2" style="italic" weight="normal"/>
					<font-triplet name="sans-serif2" style="italic" weight="bold"/>
				</font>
				<font embed-url="file:/C:/Source_Code_Pro/SourceCodePro-Regular.ttf" \
kerning="yes" simulate-style="true">  <font-triplet name="sans-serif3" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif3" style="normal" weight="bold"/>
					<font-triplet name="sans-serif3" style="italic" weight="normal"/>
					<font-triplet name="sans-serif3" style="italic" weight="bold"/>
				</font>
			</fonts>
		</renderer>
	</renderers>
</fop>
{code}
  

And using this FO file:
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="main-page" margin="0.5in" \
                page-height="11.0in" page-width="8.5in">
      <fo:region-body margin-bottom="0.25in + 1mm" margin-top="0.70in + 1mm"/>
      <fo:region-before extent="0.70in"/>
      <fo:region-after extent="0.25in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="main-page">
    <fo:flow flow-name="xsl-region-body">
      <fo:table table-layout="fixed" width="100%" font-size="10pt" \
font-family="sans-serif">  <fo:table-column \
column-width="proportional-column-width(1)"/>  <fo:table-column \
column-width="proportional-column-width(1)"/>  <fo:table-header>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
background-color="#eeeeee">  <fo:block>
                <fo:inline font-weight="bold">Patient Name:</fo:inline> Moser, \
Nicholas</fo:block>  </fo:table-cell>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
background-color="#eeeeee">  <fo:block>
                <fo:inline font-weight="bold">Request Date/Time:</fo:inline> \
8/11/2021 18:02 CDT</fo:block>  </fo:table-cell>
          </fo:table-row>
        </fo:table-header>
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2">  <fo:block>
                <fo:inline font-weight="bold">Requesting Person:</fo:inline> Moser, \
Nicholas</fo:block>  </fo:table-cell>
          </fo:table-row>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2" font-style="italic">  <fo:block>Release Details</fo:block>
            </fo:table-cell>
          </fo:table-row>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2">  <fo:block>
                <fo:inline font-weight="bold">Comments:</fo:inline>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
{code}
Replace *font-family="sans-serif"* with *font-family="sans-serif2"* or \
*font-family="sans-serif3"* to test the two other fonts. h2. Proposed Solution

The actual solution here should be reaching out to Adobe to figure out why only their \
PDF reader seems to throw this error. I don't see the error when using Firefox, \
Chrome, or Foxit to view the PDF.

With that being said, I've found a code change that seems to remove the error while \
maintaining the simulated styling.

[^fix.patch]

Basically, instead of pushing and popping the graphics state before simulating bold, \
just reset the text rendering mode to 0 when done simulating bold text. I've done \
quite a bit of testing, and this seems to work fine. Curious to hear from others if \
there are any issues with this change.

Here are some examples of before the change and after the change:

[^OpenSans-before.pdf]

[^OpenSans-after.pdf]

[^NotoSans-before.pdf]

[^NotoSans-after.pdf]

[^SourceCodePro-before.pdf]

[^SourceCodePro-after.pdf]

  

  was:
In some cases, simulated bold text seems to throw an error in Adobe Acrobat. It's \
been erroring in every Adobe Acrobat version released in what seems like the last \
year, possibly more. h2. The Problem

For example (version 2021.005.20060; Windows 10.0.19042 Build 19042):

!image-2021-08-12-10-10-13-731.png!

It's hard to tell exactly why this issue occurs, but it appears to be related to the \
fact that simulated bold pushes (q) and pops (Q) the graphics state. Furthermore, it \
appears that this may cause issues only when on the last row of a table.

You can reproduce the issue by using the following fonts:
 * [https://fonts.google.com/specimen/Open+Sans]
 * [https://fonts.google.com/specimen/Noto+Sans]
 * [https://fonts.google.com/specimen/Source+Code+Pro]

Along with the following FOP configuration file:

  
{code:java}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<fop version="1.0">
	<renderers>
		<renderer mime="application/pdf">
			<fonts>
				<font embed-url="file:/C:/Open_Sans/OpenSans-Regular.ttf" kerning="yes" \
simulate-style="true">  <font-triplet name="sans-serif" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif" style="normal" weight="bold"/>
					<font-triplet name="sans-serif" style="italic" weight="normal"/>
					<font-triplet name="sans-serif" style="italic" weight="bold"/>
				</font>
				<font embed-url="file:/C:/Noto_Sans/NotoSans-Regular.ttf" kerning="yes" \
simulate-style="true">  <font-triplet name="sans-serif2" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif2" style="normal" weight="bold"/>
					<font-triplet name="sans-serif2" style="italic" weight="normal"/>
					<font-triplet name="sans-serif2" style="italic" weight="bold"/>
				</font>
				<font embed-url="file:/C:/Source_Code_Pro/SourceCodePro-Regular.ttf" \
kerning="yes" simulate-style="true">  <font-triplet name="sans-serif3" style="normal" \
weight="normal"/>  <font-triplet name="sans-serif3" style="normal" weight="bold"/>
					<font-triplet name="sans-serif3" style="italic" weight="normal"/>
					<font-triplet name="sans-serif3" style="italic" weight="bold"/>
				</font>
			</fonts>
		</renderer>
	</renderers>
</fop>
{code}
  

  

And using this FO file:

  
{code:java}
<?xml version="1.0" encoding="UTF-8"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="main-page" margin="0.5in" \
                page-height="11.0in" page-width="8.5in">
      <fo:region-body margin-bottom="0.25in + 1mm" margin-top="0.70in + 1mm"/>
      <fo:region-before extent="0.70in"/>
      <fo:region-after extent="0.25in"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="main-page">
    <fo:flow flow-name="xsl-region-body">
      <fo:table table-layout="fixed" width="100%" font-size="10pt" \
font-family="sans-serif">  <fo:table-column \
column-width="proportional-column-width(1)"/>  <fo:table-column \
column-width="proportional-column-width(1)"/>  <fo:table-header>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
background-color="#eeeeee">  <fo:block>
                <fo:inline font-weight="bold">Patient Name:</fo:inline> Moser, \
Nicholas</fo:block>  </fo:table-cell>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
background-color="#eeeeee">  <fo:block>
                <fo:inline font-weight="bold">Request Date/Time:</fo:inline> \
8/11/2021 18:02 CDT</fo:block>  </fo:table-cell>
          </fo:table-row>
        </fo:table-header>
        <fo:table-body>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2">  <fo:block>
                <fo:inline font-weight="bold">Requesting Person:</fo:inline> Moser, \
Nicholas</fo:block>  </fo:table-cell>
          </fo:table-row>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2" font-style="italic">  <fo:block>Release Details</fo:block>
            </fo:table-cell>
          </fo:table-row>
          <fo:table-row>
            <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
number-columns-spanned="2">  <fo:block>
                <fo:inline font-weight="bold">Comments:</fo:inline>
              </fo:block>
            </fo:table-cell>
          </fo:table-row>
        </fo:table-body>
      </fo:table>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
{code}
Replace *font-family="sans-serif"* with *font-family="sans-serif2"* or \
*font-family="sans-serif"* to test the two other fonts.

  

  
h2. Proposed Solution

The actual solution here should be reaching out to Adobe to figure out why only their \
PDF reader seems to throw this error. I don't see the error when using Firefox, \
Chrome, or Foxit to view the PDF.

With that being said, I've found a code change that seems to remove the error while \
maintaining the simulated styling.

[^fix.patch]

Basically, instead of pushing and popping the graphics state before simulating bold, \
just reset the text rendering mode to 0 when done. I've done quite a bit of testing, \
and this seems to work fine. Curious to hear from others if there are any issues with \
this change.

Here are some examples of before the change and after the change:

[^OpenSans-before.pdf]

[^OpenSans-after.pdf]

[^NotoSans-before.pdf]

[^NotoSans-after.pdf]

[^SourceCodePro-before.pdf]

[^SourceCodePro-after.pdf]

  


> Simulated Bold Errors in Adobe Acrobat
> --------------------------------------
> 
> Key: FOP-3023
> URL: https://issues.apache.org/jira/browse/FOP-3023
> Project: FOP
> Issue Type: Improvement
> Reporter: Nicholas Moser
> Priority: Minor
> Attachments: NotoSans-after.pdf, NotoSans-before.pdf, OpenSans-after.pdf, \
> OpenSans-before.pdf, SourceCodePro-after.pdf, SourceCodePro-before.pdf, fix.patch, \
> image-2021-08-12-10-10-13-731.png 
> 
> In some cases, simulated bold text seems to throw an error in Adobe Acrobat. It's \
> been erroring in every Adobe Acrobat version released in what seems like the last \
> year, possibly more. h2. The Problem
> For example (version 2021.005.20060; Windows 10.0.19042 Build 19042):
> !image-2021-08-12-10-10-13-731.png!
> It's hard to tell exactly why this issue occurs, but it appears to be related to \
> the fact that simulated bold pushes (q) and pops (Q) the graphics state. \
> Furthermore, it appears that this may cause issues only when on the last row of a \
> table. You can reproduce the issue by using the following fonts:
> * [https://fonts.google.com/specimen/Open+Sans]
> * [https://fonts.google.com/specimen/Noto+Sans]
> * [https://fonts.google.com/specimen/Source+Code+Pro]
> Along with the following FOP configuration file:
> 
> {code:java}
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <fop version="1.0">
> 	<renderers>
> 		<renderer mime="application/pdf">
> 			<fonts>
> 				<font embed-url="file:/C:/Open_Sans/OpenSans-Regular.ttf" kerning="yes" \
> simulate-style="true">  <font-triplet name="sans-serif" style="normal" \
> weight="normal"/>  <font-triplet name="sans-serif" style="normal" weight="bold"/>
> 					<font-triplet name="sans-serif" style="italic" weight="normal"/>
> 					<font-triplet name="sans-serif" style="italic" weight="bold"/>
> 				</font>
> 				<font embed-url="file:/C:/Noto_Sans/NotoSans-Regular.ttf" kerning="yes" \
> simulate-style="true">  <font-triplet name="sans-serif2" style="normal" \
> weight="normal"/>  <font-triplet name="sans-serif2" style="normal" weight="bold"/>
> 					<font-triplet name="sans-serif2" style="italic" weight="normal"/>
> 					<font-triplet name="sans-serif2" style="italic" weight="bold"/>
> 				</font>
> 				<font embed-url="file:/C:/Source_Code_Pro/SourceCodePro-Regular.ttf" \
> kerning="yes" simulate-style="true">  <font-triplet name="sans-serif3" \
> style="normal" weight="normal"/>  <font-triplet name="sans-serif3" style="normal" \
> weight="bold"/>  <font-triplet name="sans-serif3" style="italic" weight="normal"/>
> 					<font-triplet name="sans-serif3" style="italic" weight="bold"/>
> 				</font>
> 			</fonts>
> 		</renderer>
> 	</renderers>
> </fop>
> {code}
> 
> And using this FO file:
> {code:java}
> <?xml version="1.0" encoding="UTF-8"?>
> <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
> <fo:layout-master-set>
> <fo:simple-page-master master-name="main-page" margin="0.5in" page-height="11.0in" \
> page-width="8.5in"> <fo:region-body margin-bottom="0.25in + 1mm" margin-top="0.70in \
> + 1mm"/> <fo:region-before extent="0.70in"/>
> <fo:region-after extent="0.25in"/>
> </fo:simple-page-master>
> </fo:layout-master-set>
> <fo:page-sequence master-reference="main-page">
> <fo:flow flow-name="xsl-region-body">
> <fo:table table-layout="fixed" width="100%" font-size="10pt" \
> font-family="sans-serif"> <fo:table-column \
> column-width="proportional-column-width(1)"/> <fo:table-column \
> column-width="proportional-column-width(1)"/> <fo:table-header>
> <fo:table-row>
> <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
> background-color="#eeeeee"> <fo:block>
> <fo:inline font-weight="bold">Patient Name:</fo:inline> Moser, Nicholas</fo:block>
> </fo:table-cell>
> <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
> background-color="#eeeeee"> <fo:block>
> <fo:inline font-weight="bold">Request Date/Time:</fo:inline> 8/11/2021 18:02 \
> CDT</fo:block> </fo:table-cell>
> </fo:table-row>
> </fo:table-header>
> <fo:table-body>
> <fo:table-row>
> <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
> number-columns-spanned="2"> <fo:block>
> <fo:inline font-weight="bold">Requesting Person:</fo:inline> Moser, \
> Nicholas</fo:block> </fo:table-cell>
> </fo:table-row>
> <fo:table-row>
> <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
> number-columns-spanned="2" font-style="italic"> <fo:block>Release \
> Details</fo:block> </fo:table-cell>
> </fo:table-row>
> <fo:table-row>
> <fo:table-cell border="0.3mm solid #dddddd" padding="0.5mm" \
> number-columns-spanned="2"> <fo:block>
> <fo:inline font-weight="bold">Comments:</fo:inline>
> </fo:block>
> </fo:table-cell>
> </fo:table-row>
> </fo:table-body>
> </fo:table>
> </fo:flow>
> </fo:page-sequence>
> </fo:root>
> {code}
> Replace *font-family="sans-serif"* with *font-family="sans-serif2"* or \
> *font-family="sans-serif3"* to test the two other fonts. h2. Proposed Solution
> The actual solution here should be reaching out to Adobe to figure out why only \
> their PDF reader seems to throw this error. I don't see the error when using \
> Firefox, Chrome, or Foxit to view the PDF. With that being said, I've found a code \
> change that seems to remove the error while maintaining the simulated styling. \
> [^fix.patch] Basically, instead of pushing and popping the graphics state before \
> simulating bold, just reset the text rendering mode to 0 when done simulating bold \
> text. I've done quite a bit of testing, and this seems to work fine. Curious to \
> hear from others if there are any issues with this change. Here are some examples \
> of before the change and after the change: [^OpenSans-before.pdf]
> [^OpenSans-after.pdf]
> [^NotoSans-before.pdf]
> [^NotoSans-after.pdf]
> [^SourceCodePro-before.pdf]
> [^SourceCodePro-after.pdf]
> 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic