You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by _zachary_ <zd...@mac.com> on 2008/05/23 19:39:23 UTC

Fop.94 MathML Fonts Not Changing

I have set up my conf file for fop and use it via the -c option.  I have
specified my custom font in the pdf renderer, and the font does not seem to
change my MathML instream-objects?  Am I doing something wrong, or does fop
not change the font of my MathML stuff?

my conf file
============================
<?xml version="1.0"?>
<!-- NOTE: This is the version of the configuration -->
<fop version="1.0">
        <base>./</base>
        <font-base>fonts</font-base>
        <source-resolution>72</source-resolution>
        <target-resolution>72</target-resolution>
        <use-cache>true</use-cache>
        <cache-file>cache/fop.cache</cache-file>
        <renderers>
                <renderer mime="application/pdf">
                        <filterList>
                                <value>flate</value>
                        </filterList>
                        <fonts>
                                
                                        <font-triplet name="DejaVu"
style="normal" weight="normal"/>
                                
                                
                                        <font-triplet name="DejaVu"
style="normal" weight="bold"/>
                                
                                
                                        <font-triplet name="DejaVu"
style="italic" weight="bold"/>
                                
                                
                                        <font-triplet name="DejaVu"
style="italic" weight="normal"/>
                                
                        </fonts>
                </renderer>
                <renderer mime="image/svg+xml">
                        <format type="paginated"/>
                        <link value="true"/>
                        <strokeText value="false"/>
                </renderer>
                <renderer mime="application/awt">

                </renderer>
                <renderer mime="image/png">
                       
<!--transparent-page-background>true</transparent-page-background-->
                </renderer>
                <renderer mime="image/tiff">
                       
<!--transparent-page-background>true</transparent-page-background-->
                        <!--compression>CCITT T.6</compression-->
                </renderer>
                <renderer mime="text/xml">

                </renderer>
                <renderer mime="text/plain">
                        <pageSize columns="80"/>
                </renderer>
        </renderers>
</fop>

sample file
================================================
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:m="http://www.w3.org/1998/Math/MathML" font-family="DejaVu"
font-size="16pt">
    <fo:layout-master-set>
        <fo:simple-page-master master-name="only">
            <fo:region-body region-name="xsl-region-body" margin="0.7in"/>
            <fo:region-before region-name="xsl-region-before" extent="0.7in"
display-align="before"/>
            <fo:region-after region-name="xsl-region-after"
display-align="after" extent="0.7in"/>
        </fo:simple-page-master>
    </fo:layout-master-set>
    <fo:page-sequence master-reference="only">
        <fo:flow flow-name="xsl-region-body">
            <fo:block>
        A sample equation:
        <fo:instream-foreign-object>
        <m:math>
        <m:mrow>
          <m:mrow>
            <m:mo>(</m:mo>
            <m:mrow>
              <m:mn>6</m:mn>
              <m:msup>

                <m:mi>y</m:mi>
                <m:mn>3</m:mn>
              </m:msup>
              <m:mo>+</m:mo>
              <m:mn>2</m:mn>
              <m:msup>
                <m:mi>y</m:mi>

                <m:mn>2</m:mn>
              </m:msup>
              <m:mo>&#8722;</m:mo>
              <m:mi>y</m:mi>
              <m:mo>&#8722;</m:mo>
              <m:mn>12</m:mn>

            </m:mrow>
            <m:mo>)</m:mo>
          </m:mrow>
        </m:mrow>
      </m:math>
      </fo:instream-foreign-object>
            </fo:block>
        </fo:flow>
    </fo:page-sequence>
</fo:root>

========================================================

NOTE: That the font size of the mathml does not change either.  Is this
supposed to happen?
-- 
View this message in context: http://www.nabble.com/Fop.94-MathML-Fonts-Not-Changing-tp17430134p17430134.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop.94 MathML Fonts Not Changing

Posted by Vincent Hennebert <vi...@anyware-tech.com>.
Hi,

_zachary_ wrote:
> I have set up my conf file for fop and use it via the -c option.  I have
> specified my custom font in the pdf renderer, and the font does not seem to
> change my MathML instream-objects?  Am I doing something wrong, or does fop
> not change the font of my MathML stuff?
> 
> my conf file
> ============================
>                                 
>    <font-triplet name="DejaVu" style="normal" weight="normal"/>
>    <font-triplet name="DejaVu" style="normal" weight="bold"/>
>    <font-triplet name="DejaVu" style="italic" weight="bold"/>
>    <font-triplet name="DejaVu" style="italic" weight="normal"/>

You have to surround each font-triplet element with a font element:
    <font kerning="yes" embed-url="/path/to/DejaVuSans.ttf">
      <font-triplet name="DejaVu" style="normal" weight="normal"/>
    </font>
But instead you can simply point to the directory that contains the
DejaVu fonts:
    <directory>/path/to/deja/vu/fonts/</directory>
and all the variants will be automatically configured. (Then you will
also have to change the font-family property in the FO file to
‘DejaVuSans’, or ‘DejaVuSerif’, for example.)


> NOTE: That the font size of the mathml does not change either.  Is this
> supposed to happen?

I think this is not implemented in the Jeuclid plug-in for FOP 0.94
(this should be available in the version that will be compatible with
the upcoming 0.95 release). As a workaround, you have to add an mstyle
element:
    <m:math>
      <m:mstyle mathsize="16pt">
        <m:mrow>
        ...
        </m:mrow>
      </m:mstyle>
    </m:math>

See also the following thread on the jeuclid-users mailing list:
http://sourceforge.net/mailarchive/forum.php?thread_name=x8tsl1ln8e7.fsf%40tool.montefiore.ulg.ac.be&forum_name=jeuclid-users

HTH,
Vincent

-- 
Vincent Hennebert                            Anyware Technologies
http://people.apache.org/~vhennebert         http://www.anyware-tech.com
Apache FOP Committer                         FOP Development/Consulting

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop.94 MathML Fonts Not Changing

Posted by Andreas Delmelle <an...@telenet.be>.
On May 27, 2008, at 18:55, _zachary_ wrote:

Hi

> I am using the jeuclid plugin for fop.
> Where would I override a bind() method?  The files are .jar, so I  
> can't really modify them.  Maybe this is a
> jeuclid issue?

Just checked, and the code for the extension is located in the FOP  
repository:
http://svn.apache.org/viewvc/xmlgraphics/fop/trunk/examples/mathml/ 
src/org/apache/fop/mathml/

The file MathMLElement.java is the 'extension node' I was talking  
about. processNode() is already overridden.
To gain access to the font-related properties, you could add an  
override like:

public void bind(PropertyList pList) {

   CommonFont fontProps = pList.getFontProps();
   ...

}

CommonFont then, has accessors for the first font-family, an array of  
all specified font-families, font-size etc.
Somehow this info needs to make its way to the SVG document that is  
created.

If you succeed in making the necessary modifications, of course we'd  
welcome a patch... ;-)


HTH!

Andreas

---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop.94 MathML Fonts Not Changing

Posted by _zachary_ <zd...@mac.com>.
Hey Andreas,
I am using the jeuclid plugin for fop.  Where would I override a bind()
method?  The files are .jar, so I can't really modify them.  Maybe this is a
jeuclid issue?

~ zach


Andreas Delmelle-2 wrote:
> 
> On May 23, 2008, at 19:39, _zachary_ wrote:
> 
> Hi
> 
>> I have set up my conf file for fop and use it via the -c option.  I  
>> have
>> specified my custom font in the pdf renderer, and the font does not  
>> seem to
>> change my MathML instream-objects?  Am I doing something wrong, or  
>> does fop
>> not change the font of my MathML stuff?
> 
> I'm afraid I can't be of much help here, as I don't know the code of  
> the MathML extension by heart.
> 
> Anyway: in theory, the extension node does have access to the  
> inherited Common Font properties, so it should be possible to route  
> this info through to Batik (which is used in the background: the  
> MathML is converted to SVG). This would be possible by overriding the  
> bind() method in the extension node.
> 
> 
> Cheers
> 
> Andreas
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
> For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Fop.94-MathML-Fonts-Not-Changing-tp17430134p17495094.html
Sent from the FOP - Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org


Re: Fop.94 MathML Fonts Not Changing

Posted by Andreas Delmelle <an...@telenet.be>.
On May 23, 2008, at 19:39, _zachary_ wrote:

Hi

> I have set up my conf file for fop and use it via the -c option.  I  
> have
> specified my custom font in the pdf renderer, and the font does not  
> seem to
> change my MathML instream-objects?  Am I doing something wrong, or  
> does fop
> not change the font of my MathML stuff?

I'm afraid I can't be of much help here, as I don't know the code of  
the MathML extension by heart.

Anyway: in theory, the extension node does have access to the  
inherited Common Font properties, so it should be possible to route  
this info through to Batik (which is used in the background: the  
MathML is converted to SVG). This would be possible by overriding the  
bind() method in the extension node.


Cheers

Andreas


---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org