xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Van den Branden <ron.vandenbran...@kantl.be>
Subject Re: struggling with "bulk font configuration"
Date Wed, 13 Sep 2017 12:43:41 GMT
Hi Szeak,

Thanks for the pointers. Let me clarify: I knew how to register 
individual fonts in a config file and refer to them in an XSL-FO file, 
but it wasn't clear how to refer to bulk-registered fonts. Some further 
digging has made me find the answer, so if it can help others, I'll try 
to clarify with a concrete example.

Suppose I register an additional font in a configuration file:

     <renderer mime="application/pdf">
         <font embed-url="fonts/noto/NotoSansCJKjp-Regular.otf">
           <font-triplet name="NotoSansCJKjp" style="normal" weight="normal"/>

When using this configuration file, I can refer to this font in an 
XSL-FO file as follows:

   <fo:block font-family="Helvetica,NotoSansCJKjp">
     a test character: あ

...thus making FOP select the Helvetica font for all glyphs it supports 
(the string "a test character: "), and fall back to the NotoSansCKjp 
font for displaying the "あ" character.

So far, so good. Now, suppose that instead of this single font, I'd want 
to register all Noto fonts in that folder in bulk. According to the 
documentation, this can be done with the <directory> instruction in the 
configuration file:

     <renderer mime="application/pdf">
       <directory recursive="true">F:\fop\noto</directory>

[NOTE: despite correct <base> and <font-base> settings, <directory> 
doesn't seem to work with relative paths...]

Perhaps I have overlooked, but from the documentation it wasn't clear to 
me how these fonts should be referred to in an XSL-FO file.

Yet, it appears that the full font name should be used for the 
"font-family" attribute. So, if the XSL-FO snippet above is adjusted to:

   <fo:block font-family="Helvetica,Noto Sans CJK JP">
     a test character: あ

...it works!



Op 13/09/2017 om 11:53 schreef Szeak (Register Man):
> Hi,
> First of all, you may need to read:
> - "Missing Glyphs" section in 
> https://xmlgraphics.apache.org/fop/2.1/fonts.html
> - font-base configuration element in 
> https://xmlgraphics.apache.org/fop/2.1/configuration.html
> - https://xmlgraphics.apache.org/fop/2.1/fonts.html#font_substitution
> - https://xmlgraphics.apache.org/fop/2.1/fonts.html#selection
> I'm not sure, it can FOP configuring for auto font switching by 
> characters (glyphs), because of as a Missing Glyphs section also wrote:
> "A better way is to use a font that has all the necessary glyphs. This 
> glyph substitution is only a last resort."
> AND:
> "There are two font selection strategies: character-by-character or 
> auto. The default is auto.
> ...
> Character-by-Character is NOT yet supported!"
> Best regards, Szeak

View raw message