struggling with "bulk font configuration"

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

struggling with "bulk font configuration"

ron.vandenbranden
Hi,

I'm using FOP 2.1 for a journal whose submissions may occasionally
contain all kinds of exotic characters, such as Japanese, Ethiopian,
etc. I've been able to fix missing glyphs by defining specific fonts in
the FOP configuration file and referring to them by means of a list of
"font-family" values. Yet, it's hard to know exactly what font will
cover all glyphs for every language, and adding new fonts requires both
expanding the FOP configuration file and the "font-family" list in the
XSL-FO files.

Hence, I'm trying to find a more flexible solution, and I'm trying out
the "bulk font configuration", documented at
https://xmlgraphics.apache.org/fop/2.2/fonts.html#bulk. I don't know if
I'm misinterpreting this "bulk font configuration" as a means to
register a lot of fonts without having to define them separately, so
they can be used as a pool of fallback fonts for glyphs that aren't
supported by the standard font?

So far, I haven't been able to figure out how those "bulk-registered"
fonts should be referred to in an XSL-FO file.

Suppose I have a "noto" subfolder next to the FOP configuration file,
with Google's Noto fonts, such as e.g. NotoSansCJKjp-Black.otf.

In the FOP config file, I have following entry:

   <renderers>
     <renderer mime="application/pdf">
       <!-- doesn't work with relative paths? -->
       <directory recursive="true">F:\fop\noto</directory>
       </fonts>
     </renderer>
   </renderers>

(Btw, the <directory> setting apparently doesn't work with a relative path?)

Basically, I'm not sure how I can now use the NotoSansCJKjp-Black.otf font:
     -can I just specify "font-family='NotoSansCJKjp-Black'" in the
XSL-FO file?
     -or should all fonts still be registered separately in the config
file with a <font> definition? (In which case, what's the point of "bulk
registration"?)

So far, I've noticed that just bulk-registrering the "noto" subfolder,
and specifying "font-family='Arial'" (or even variants of
"font-family='Arial,NotoSansCJKjp-Black'") doesn't make FOP fall back to
the NotoSansCJKjp-Black.ttf font for Japanese characters that aren't
available in Arial.

Could anyone help me out here?

Best,

Ron


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: struggling with "bulk font configuration"

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

2017-09-12 16:44 keltezéssel, Ron Van den Branden írta:
Hi,

I'm using FOP 2.1 for a journal whose submissions may occasionally contain all kinds of exotic characters, such as Japanese, Ethiopian, etc. I've been able to fix missing glyphs by defining specific fonts in the FOP configuration file and referring to them by means of a list of "font-family" values. Yet, it's hard to know exactly what font will cover all glyphs for every language, and adding new fonts requires both expanding the FOP configuration file and the "font-family" list in the XSL-FO files.

Hence, I'm trying to find a more flexible solution, and I'm trying out the "bulk font configuration", documented at https://xmlgraphics.apache.org/fop/2.2/fonts.html#bulk. I don't know if I'm misinterpreting this "bulk font configuration" as a means to register a lot of fonts without having to define them separately, so they can be used as a pool of fallback fonts for glyphs that aren't supported by the standard font?

So far, I haven't been able to figure out how those "bulk-registered" fonts should be referred to in an XSL-FO file.

Suppose I have a "noto" subfolder next to the FOP configuration file, with Google's Noto fonts, such as e.g. NotoSansCJKjp-Black.otf.

In the FOP config file, I have following entry:

  <renderers>
    <renderer mime="application/pdf">
      <!-- doesn't work with relative paths? -->
      <directory recursive="true">F:\fop\noto</directory>
      </fonts>
    </renderer>
  </renderers>

(Btw, the <directory> setting apparently doesn't work with a relative path?)

Basically, I'm not sure how I can now use the NotoSansCJKjp-Black.otf font:
    -can I just specify "font-family='NotoSansCJKjp-Black'" in the XSL-FO file?
    -or should all fonts still be registered separately in the config file with a <font> definition? (In which case, what's the point of "bulk registration"?)

So far, I've noticed that just bulk-registrering the "noto" subfolder, and specifying "font-family='Arial'" (or even variants of "font-family='Arial,NotoSansCJKjp-Black'") doesn't make FOP fall back to the NotoSansCJKjp-Black.ttf font for Japanese characters that aren't available in Arial.

Could anyone help me out here?

Best,

Ron


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


--------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: struggling with "bulk font configuration"

ron.vandenbranden

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:
  <renderers>
    <renderer mime="application/pdf">
      <fonts>
        <font embed-url="fonts/noto/NotoSansCJKjp-Regular.otf">
          <font-triplet name="NotoSansCJKjp" style="normal" weight="normal"/>
        </font>
      </fonts>
    </renderer>
  </renderers>
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: あ
  </fo:block>
...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:
  <renderers>
    <renderer mime="application/pdf">
      <directory recursive="true">F:\fop\noto</directory>
    </renderer>
  </renderers>
[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: あ
  </fo:block>
...it works!

Best,

Ron

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

Reply | Threaded
Open this post in threaded view
|

Re: struggling with "bulk font configuration"

Szeak (Register Man)
Hi,

Yes, nice example.

... and i always prefer referring fonts by it's family name. When they are registered as bulk, you may need refer by font-triplet's name attribute, but i also prefer to use the real family name in font-triplet configuration.

Have a nice day,

Szeak

2017-09-13 14:43 keltezéssel, Ron Van den Branden írta:

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:
  <renderers>
    <renderer mime="application/pdf">
      <fonts>
        <font embed-url="fonts/noto/NotoSansCJKjp-Regular.otf">
          <font-triplet name="NotoSansCJKjp" style="normal" weight="normal"/>
        </font>
      </fonts>
    </renderer>
  </renderers>
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: あ
  </fo:block>
...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:
  <renderers>
    <renderer mime="application/pdf">
      <directory recursive="true">F:\fop\noto</directory>
    </renderer>
  </renderers>
[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: あ
  </fo:block>
...it works!

Best,

Ron

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


--------------------------------------------------------------------- To unsubscribe, e-mail: [hidden email] For additional commands, e-mail: [hidden email]