Double arrows

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Double arrows

metro
I am rendering double arrows using the adoc -> docbook -> pdf flow using fop and I am having issues with double arrows: as can be seen below, double arrows show up too low, while single arrows are OK.

I have tried different fonts, but all show the same problem.

docbook xml seems ok:
<simpara>Test &#8658; test &#169; test &#8594; test &#8656; test &#8658; test</simpara>

fo code seems ok as well:
<fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Test ⇒ test © test → test ⇐ test ⇒ test</fo:block>

Any idea what might be causing this?

MT
--
Reply | Threaded
Open this post in threaded view
|

Re: Double arrows

kibukj
metro wrote
I am rendering double arrows using the adoc -> docbook -> pdf flow using fop and I am having issues with double arrows: as can be seen below, double arrows show up too low, while single arrows are OK.

I have tried different fonts, but all show the same problem.

docbook xml seems ok:
<simpara>Test &#8658; test &#169; test &#8594; test &#8656; test &#8658; test</simpara>

fo code seems ok as well:
<fo:block space-before.optimum="1em" space-before.minimum="0.8em" space-before.maximum="1.2em">Test ⇒ test © test → test ⇐ test ⇒ test</fo:block>

Any idea what might be causing this?

MT
--
I see the same issue using Apache FOP raw:
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="page">
      <fo:region-body margin="20mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="page">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>
        <fo:table width="100%" table-layout="fixed">
          <fo:table-header>
            <fo:table-row>
              <fo:table-cell>
                <fo:block font-weight="bold">font-family</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block font-weight="bold">Output</fo:block>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-header>
          <fo:table-body>
            <fo:table-row>
              <fo:table-cell>
                <fo:block>any,Symbol</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block font-family="any,Symbol">A &#x21D0; B &#x21D2; C</fo:block>
              </fo:table-cell>
            </fo:table-row>
            <fo:table-row>
              <fo:table-cell>
                <fo:block>any,DejaVu Sans</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block font-family="any,DejaVu Sans">A &#x21D0; B &#x21D2; C</fo:block>
              </fo:table-cell>
            </fo:table-row>
            <fo:table-row>
              <fo:table-cell>
                <fo:block>DejaVu Sans</fo:block>
              </fo:table-cell>
              <fo:table-cell>
                <fo:block font-family="DejaVu Sans">A &#x21D0; B &#x21D2; C</fo:block>
              </fo:table-cell>
            </fo:table-row>
          </fo:table-body>
        </fo:table>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
This is what it looks like in the output (using Apache FOP 2.3):



Using the built-in Symbol font, it definitely looks too low, but with some other fonts it looks okay to me. What other fonts did you try?

Interestingly, in the example document demonstrating the built-in fonts, the arrows look okay:



But in this case, the text on the left in Helvetica font is segregated in to an fo:inline:
<fo:inline font-family="Helvetica">&#x21D0; :</fo:inline> ⇐
<fo:inline font-family="Helvetica">&#x21D1; :</fo:inline> ⇑
<fo:inline font-family="Helvetica">&#x21D2; :</fo:inline> ⇒
<fo:inline font-family="Helvetica">&#x21D3; :</fo:inline> ⇓
So, the issue only seems to occur when you mix the two fonts in the same element? Maybe it has something to do with Apache FOP's lack of support for character-by-character font selection?

You might be able to get better answers from the Apache FOP mailing list.
Reply | Threaded
Open this post in threaded view
|

Re: Double arrows

metro
Thanks for the detailed reply.

I did try to use the inline wrapping method shown in http://www.sagehill.net/docbookxsl/SpecialChars.html, but this did not seem to work.

I ended up replacing the symbol font with DejaVu Sans and this fixed the issue.

MT
--
Reply | Threaded
Open this post in threaded view
|

Re: Double arrows

kibukj
metro wrote
Thanks for the detailed reply.

I did try to use the inline wrapping method shown in http://www.sagehill.net/docbookxsl/SpecialChars.html, but this did not seem to work.

I ended up replacing the symbol font with DejaVu Sans and this fixed the issue.

MT
--
That's odd, that inline wrapping method actually seems to work for me:
<?xml version="1.0"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
  <fo:layout-master-set>
    <fo:simple-page-master master-name="page">
      <fo:region-body margin="2mm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>
  <fo:page-sequence master-reference="page">
    <fo:flow flow-name="xsl-region-body">
      <fo:block>
        <fo:block font-family="Courier"><![CDATA[<fo:block>A &#x21D2; B</fo:block>]]></fo:block>
        <fo:block>A &#x21D2; B</fo:block>
        <fo:block font-family="Courier" space-before="20pt"><![CDATA[<fo:block>A <fo:inline font-family="Symbol">&#x21D2;</fo:inline> B</fo:block>]]></fo:block>
        <fo:block>A <fo:inline font-family="Symbol">&#x21D2;</fo:inline> B</fo:block>
      </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>
Reply | Threaded
Open this post in threaded view
|

Re: Double arrows

metro
The docbook customization part did not work for me: the inline statement did not end up in the generated fo file. I did not try handcoding the fo directly.

Did you handcode the fo file or did this come from the docbook xsl transformation?

MT
--
Reply | Threaded
Open this post in threaded view
|

Re: Double arrows

kibukj
metro wrote
Did you handcode the fo file or did this come from the docbook xsl transformation?
Those were hand-coded examples.

metro wrote
The docbook customization part did not work for me: the inline statement did not end up in the generated fo file. I did not try handcoding the fo directly.
After you add the customization from http://www.sagehill.net/docbookxsl/SpecialChars.html:
<xsl:template match="symbol[@role = 'symbolfont']">
  <fo:inline font-family="Symbol">
    <xsl:call-template name="inline.charseq"/>
  </fo:inline>
</xsl:template>
You would need to wrap the special characters in a <symbol role="symbolfont"> tag in the DocBook XML in order to use it:
<simpara>A <symbol role="symbolfont">&#x21D2</symbol> B</simpara>

I'm not sure if AsciiDoc has syntax for the <symbol> element, but you could use the <phrase> element instead like this:
A [symbolfont]#&#x21D2;# B
This will produce DocBook like this from Asciidoctor:
<simpara>A <phrase role="symbolfont">&#x21D2;</phrase> B</simpara>
And now you just have to modify the customization slightly to use the <phrase> element instead of <symbol>:
<xsl:template match="phrase[@role = 'symbolfont']">
  <fo:inline font-family="Symbol">
    <xsl:call-template name="inline.charseq"/>
  </fo:inline>
</xsl:template>