xmlgraphics-fop-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Szeak (Register Man)" <szea...@gmail.com>
Subject Re: struggling with "bulk font configuration"
Date Wed, 13 Sep 2017 13:29:12 GMT
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      Yes, nice example.<br>
      <br>
      ... 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.<br>
      <br>
      Have a nice day,<br>
      <br>
      Szeak<br>
      <br>
      2017-09-13 14:43 keltezéssel, Ron Van den Branden írta:<br>
    </div>
    <blockquote type="cite"
      cite="mid:3ca206be-e3fd-1fac-f02e-645760eecb39@kantl.be">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <p>Hi Szeak,</p>
      <p>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.<br>
      </p>
      Suppose I register an additional font in a configuration file:
      <pre>  &lt;renderers&gt;
    &lt;renderer mime="application/pdf"&gt;
      &lt;fonts&gt;
        &lt;font embed-url="fonts/noto/NotoSansCJKjp-Regular.otf"&gt;
          &lt;font-triplet name="NotoSansCJKjp" style="normal" weight="normal"/&gt;
        &lt;/font&gt;
      &lt;/fonts&gt;
    &lt;/renderer&gt;
  &lt;/renderers&gt;
</pre>
      When using this configuration file, I can refer to this font in an
      XSL-FO file as follows:<br>
      <pre>  &lt;fo:block font-family="Helvetica,NotoSansCJKjp"&gt;
    a test character: あ
  &lt;/fo:block&gt;
</pre>
      ...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.<br>
      <br>
      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
      &lt;directory&gt; instruction in the configuration file:<br>
      <pre>  &lt;renderers&gt;
    &lt;renderer mime="application/pdf"&gt;
      &lt;directory recursive="true"&gt;F:\fop\noto&lt;/directory&gt;
    &lt;/renderer&gt;
  &lt;/renderers&gt;
</pre>
      [NOTE: despite correct &lt;base&gt; and &lt;font-base&gt;
      settings, &lt;directory&gt; doesn't seem to work with relative
      paths...]<br>
      <br>
      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. <br>
      <br>
      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:<br>
      <pre>  &lt;fo:block font-family="Helvetica,Noto Sans CJK JP"&gt;
    a test character: あ
  &lt;/fo:block&gt;
</pre>
      ...it works!<br>
      <br>
      Best,<br>
      <br>
      Ron<br>
      <br>
      <div class="moz-cite-prefix">Op 13/09/2017 om 11:53 schreef Szeak
        (Register Man):<br>
      </div>
      <blockquote type="cite"
        cite="mid:f0ef749d-d669-2c0a-387f-2a2e7afe0a17@gmail.com">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <div class="moz-cite-prefix">Hi,<br>
          <br>
          First of all, you may need to read:<br>
          - "Missing Glyphs" section in <a
            class="moz-txt-link-freetext"
            href="https://xmlgraphics.apache.org/fop/2.1/fonts.html"
            moz-do-not-send="true">https://xmlgraphics.apache.org/fop/2.1/fonts.html</a><br>
          - font-base configuration element in <a
            class="moz-txt-link-freetext"
            href="https://xmlgraphics.apache.org/fop/2.1/configuration.html"
            moz-do-not-send="true">https://xmlgraphics.apache.org/fop/2.1/configuration.html</a><br>
          - <a class="moz-txt-link-freetext"
href="https://xmlgraphics.apache.org/fop/2.1/fonts.html#font_substitution"
            moz-do-not-send="true">https://xmlgraphics.apache.org/fop/2.1/fonts.html#font_substitution</a><br>
          - <a class="moz-txt-link-freetext"
            href="https://xmlgraphics.apache.org/fop/2.1/fonts.html#selection"
            moz-do-not-send="true">https://xmlgraphics.apache.org/fop/2.1/fonts.html#selection</a><br>
          <br>
          I'm not sure, it can FOP configuring for auto font switching
          by characters (glyphs), because of as a Missing Glyphs section
          also wrote:<br>
          "<span style="color: rgb(51, 51, 51); font-family: Tahoma,
            Verdana, Geneva, sans-serif; font-size: 14.6667px;
            font-style: normal; font-variant-ligatures: normal;
            font-variant-caps: normal; font-weight: normal;
            letter-spacing: normal; line-height: normal; orphans: 2;
            text-align: start; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            -webkit-text-stroke-width: 0px; display: inline !important;
            float: none; background-color: rgb(255, 255, 255);">A better
            way is to use a font that has all the necessary glyphs. This
            glyph substitution is only a last resort.</span>"<br>
          AND:<br>
          "<span style="color: rgb(51, 51, 51); font-family: Tahoma,
            Verdana, Geneva, sans-serif; font-size: 14.6667px;
            font-style: normal; font-variant-ligatures: normal;
            font-variant-caps: normal; font-weight: normal;
            letter-spacing: normal; line-height: normal; orphans: 2;
            text-align: start; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            -webkit-text-stroke-width: 0px; display: inline !important;
            float: none; background-color: rgb(255, 255, 255);">There
            are two font selection strategies: character-by-character or
            auto. The default is auto.<br>
            ...<br>
          </span><span style="color: rgb(51, 51, 51); font-family:
            Tahoma, Verdana, Geneva, sans-serif; font-size: 14.6667px;
            font-style: normal; font-variant-ligatures: normal;
            font-variant-caps: normal; font-weight: normal;
            letter-spacing: normal; line-height: normal; orphans: 2;
            text-align: start; text-indent: 0px; text-transform: none;
            white-space: normal; widows: 2; word-spacing: 0px;
            -webkit-text-stroke-width: 0px; display: inline !important;
            float: none; background-color: rgb(255, 255, 255);">Character-by-Character
            is NOT yet supported!</span>"<br>
          <br>
          Best regards, Szeak</div>
      </blockquote>
      <br>
    </blockquote>
    <p><br>
    </p>
  </body>
</html>

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


Mime
View raw message