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 Ingo Maas <in...@ebp.de> on 2008/06/03 17:32:14 UTC

Font auto detection combined with font aliases

Hallo,

I have a little problem with the Windows font "Times New Roman". The Word2FO
stylesheet from RenderX does a normalization of font family names, resulting
in "TimesNewRoman" (without spaces) in the XSL-FO which FOP fails to resolve
using its font auto detection feature. 

When using the old style font metrics settings in FOP configuration it
was/is possible to set font family name aliases. Can someone confirm that
it's not possible to use a combination of auto detection and font aliases
without providing any metrics configuration.

Here is the relevant part of my fop.xconf:

<fop version="1.0">

  <!-- Base URL for resolving relative URLs -->
  <!--base>.</base-->
  
  <!-- Source resolution in dpi (dots/pixels per inch) for determining the
size of pixels in SVG and bitmap images, default: 72dpi -->
  <source-resolution>72</source-resolution>
  <!-- Target resolution in dpi (dots/pixels per inch) for specifying the
target resolution for generated bitmaps, default: 72dpi -->
  <target-resolution>200</target-resolution>
  
  <!-- Default page-height and page-width, in case
       value is specified as auto -->
  <default-page-settings height="297mm" width="210mm"/>
  
  <!-- Information for specific renderers -->
  <!-- Uses renderer mime type for renderers -->
  <renderers>
    <renderer mime="application/pdf">
      <filterList>
        <!-- provides compression using zlib flate (default is on) -->
        <value>flate</value>
      </filterList>

      <fonts>
        <!-- embedded fonts -->
        <auto-detect/>
      </fonts>

    </renderer>
    <renderer mime="image/tiff">
      <transparent-page-background>true</transparent-page-background>
      <compression>CCITT T.4</compression>
      <fonts>
        <auto-detect/>
      </fonts>
    </renderer>
...
</fop>

Regards, Ingo


-- 
Ernst Basler + Partner GmbH
Ingo Maas
Tuchmacherstraße 47
DE-14482 Potsdam

+49 331 74 75 9 0  (Zentrale)
+49 331 74 75 9 78 (Direkt)
+49 331 74 75 9 90 (Fax) 

Geschäftsführer: Dr. Ludger Paus
Amtsgericht Potsdam - HRB 6362 P
USt-Id Nr. 152768391

mailto:Ingo.Maas@ebp.de
http://www.ebp.de



AW: Font auto detection combined with font aliases

Posted by Ingo Maas <in...@ebp.de>.
Works great, at least it fixes my TimesNewRoman font problem.

Thanks Jeremias! 

Ingo

> -----Ursprüngliche Nachricht-----
> Von: Jeremias Maerki [mailto:dev@jeremias-maerki.ch] 
> Gesendet: Mittwoch, 4. Juni 2008 08:34
> An: fop-users@xmlgraphics.apache.org
> Betreff: Re: Font auto detection combined with font aliases
> 
> A font substitution facility to handle this requirement has 
> recently been added to FOP Trunk. I've just updated the 
> website but it will take a few hours until the web server is 
> synchronized. So I'll just paste the documentation here for 
> your convenience:
> 
> Substitution
> 
> When a <substitutions/> section is defined in the 
> configuration, FOP will re-map any font-family references 
> found in your FO input to a given substitution font.
> 
>     * If a <substitution/> is declared, it is mandatory that both a
>       <from/> and <to/> child element is declared with a font-family
>       attribute.
>     * Both font-weight and font-style are optional attributes, if they
>       are provided then a value of 'normal' is assumed.
> 
> For example you could make all FO font-family references to 
> 'Arial' with weights between 700 and 900 reference the normal 
> 'Arial Black' font.
> 
> <fop version="1.0">
>    <fonts>
>       <substitutions>
>          <substitution>
>             <from font-family="Arial" font-weight="700..900"/>
>             <to font-family="Arial Black"/>
>          </substitution>
>          <substitution>
>             <from font-family="FrutigerLight"/>
>             <to font-family="Times" font-weight="bold" 
> font-style="italic"/>
>          </substitution>
>       </substitutions>
>    </fonts>
> </fop>
> 
> This will pop up here later:
> http://xmlgraphics.apache.org/fop/trunk/fonts.html
> 
> Feedback is welcome as it's a new feature!
> 
> Jeremias Maerki


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


Re: Font auto detection combined with font aliases

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
A font substitution facility to handle this requirement has recently
been added to FOP Trunk. I've just updated the website but it will take
a few hours until the web server is synchronized. So I'll just paste the
documentation here for your convenience:

Substitution

When a <substitutions/> section is defined in the configuration, FOP
will re-map any font-family references found in your FO input to a given
substitution font.

    * If a <substitution/> is declared, it is mandatory that both a
      <from/> and <to/> child element is declared with a font-family
      attribute.
    * Both font-weight and font-style are optional attributes, if they
      are provided then a value of 'normal' is assumed.

For example you could make all FO font-family references to 'Arial' with
weights between 700 and 900 reference the normal 'Arial Black' font.

<fop version="1.0">
   <fonts>
      <substitutions>
         <substitution>
            <from font-family="Arial" font-weight="700..900"/>
            <to font-family="Arial Black"/>
         </substitution>
         <substitution>
            <from font-family="FrutigerLight"/>
            <to font-family="Times" font-weight="bold" font-style="italic"/>
         </substitution>
      </substitutions>
   </fonts>
</fop>

This will pop up here later:
http://xmlgraphics.apache.org/fop/trunk/fonts.html

Feedback is welcome as it's a new feature!

HTH

On 03.06.2008 17:32:14 Ingo Maas wrote:
> Hallo,
> 
> I have a little problem with the Windows font "Times New Roman". The Word2FO
> stylesheet from RenderX does a normalization of font family names, resulting
> in "TimesNewRoman" (without spaces) in the XSL-FO which FOP fails to resolve
> using its font auto detection feature. 
> 
> When using the old style font metrics settings in FOP configuration it
> was/is possible to set font family name aliases. Can someone confirm that
> it's not possible to use a combination of auto detection and font aliases
> without providing any metrics configuration.
> 
> Here is the relevant part of my fop.xconf:
> 
> <fop version="1.0">
> 
>   <!-- Base URL for resolving relative URLs -->
>   <!--base>.</base-->
>   
>   <!-- Source resolution in dpi (dots/pixels per inch) for determining the
> size of pixels in SVG and bitmap images, default: 72dpi -->
>   <source-resolution>72</source-resolution>
>   <!-- Target resolution in dpi (dots/pixels per inch) for specifying the
> target resolution for generated bitmaps, default: 72dpi -->
>   <target-resolution>200</target-resolution>
>   
>   <!-- Default page-height and page-width, in case
>        value is specified as auto -->
>   <default-page-settings height="297mm" width="210mm"/>
>   
>   <!-- Information for specific renderers -->
>   <!-- Uses renderer mime type for renderers -->
>   <renderers>
>     <renderer mime="application/pdf">
>       <filterList>
>         <!-- provides compression using zlib flate (default is on) -->
>         <value>flate</value>
>       </filterList>
> 
>       <fonts>
>         <!-- embedded fonts -->
>         <auto-detect/>
>       </fonts>
> 
>     </renderer>
>     <renderer mime="image/tiff">
>       <transparent-page-background>true</transparent-page-background>
>       <compression>CCITT T.4</compression>
>       <fonts>
>         <auto-detect/>
>       </fonts>
>     </renderer>
> ...
> </fop>
> 
> Regards, Ingo
> 
> 
> -- 
> Ernst Basler + Partner GmbH
> Ingo Maas
> Tuchmacherstraße 47
> DE-14482 Potsdam
> 
> +49 331 74 75 9 0  (Zentrale)
> +49 331 74 75 9 78 (Direkt)
> +49 331 74 75 9 90 (Fax) 
> 
> Geschäftsführer: Dr. Ludger Paus
> Amtsgericht Potsdam - HRB 6362 P
> USt-Id Nr. 152768391
> 
> mailto:Ingo.Maas@ebp.de
> http://www.ebp.de
> 
> 




Jeremias Maerki


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


Re: Font auto detection combined with font aliases

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

Ingo Maas wrote:
> Hallo,
> 
> I have a little problem with the Windows font "Times New Roman". The Word2FO
> stylesheet from RenderX does a normalization of font family names, resulting
> in "TimesNewRoman" (without spaces) in the XSL-FO which FOP fails to resolve
> using its font auto detection feature. 
> 
> When using the old style font metrics settings in FOP configuration it
> was/is possible to set font family name aliases. Can someone confirm that
> it's not possible to use a combination of auto detection and font aliases
> without providing any metrics configuration.

FWIW, you can still use the old style configuration without providing
the XML metrics files. For the Times New Roman font you would do
something like this:
    <font embed-url="path/to/TimesNewRoman.ttf">
      <font-triplet name="TimesNewRoman" style="normal" weight="normal"/>
    </font>
    <font embed-url="path/to/TimesNewRoman-Italic.ttf">
      <font-triplet name="TimesNewRoman" style="italic" weight="normal"/>
    </font>
    <font embed-url="path/to/TimesNewRoman-Bold.ttf">
      <font-triplet name="TimesNewRoman" style="normal" weight="bold"/>
    </font>
    <font embed-url="path/to/TimesNewRoman-BoldItalic.ttf">
      <font-triplet name="TimesNewRoman" style="italic" weight="bold"/>
    </font>

This method will also work with versions 0.94 and 0.95.

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