Jean-Fran├žois ROLLAND created FOP-2665:
------------------------------------------

             Summary: Bug when using the bold version of an otf font - maybe 
bad fullName computation in OTFFile
                 Key: FOP-2665
                 URL: https://issues.apache.org/jira/browse/FOP-2665
             Project: FOP
          Issue Type: Bug
          Components: unqualified
    Affects Versions: 2.1
         Environment: Windows 7 Service Pack 1, jdk1.7.0_40, fop-2.1, 
fontbox-1.8.12
            Reporter: Jean-Fran├žois ROLLAND
             Fix For: 2.1


Overview
I get this message when using the bold version of Noto Sans CJK JP :
Font "Noto Sans CJK JP,normal,700" not found. Substituting with "Noto Sans CJK 
JP,normal,400".


Steps to reproduce

1. Use this xconf :

<fop version="1.0">
  <use-cache>false</use-cache>
  <renderers>
    <renderer mime="application/pdf">
      <fonts>
        <!-- register all the fonts found in a directory -->
        <directory recursive="true">path to font directory</directory>
      </fonts>
    </renderer>
  </renderers>
</fop>

2. Set a valid path for "path to font directory", and set there the Noto Sans 
CJK JP fonts, that you can get from there :
https://noto-website-2.storage.googleapis.com/pkgs/NotoSansCJKjp-hinted.zip

3. Use the code from this page :
https://xmlgraphics.apache.org/fop/2.1/embedding.html

4. Use this "myfile.fo" as input :

<?xml version="1.0" encoding="ISO-8859-1"?>
<fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format";>
  <!-- defines the layout master -->
  <fo:layout-master-set>
    <fo:simple-page-master master-name="first" page-height="29.7cm" 
page-width="21cm" margin-top="1cm" margin-bottom="2cm" margin-left="2.5cm" 
margin-right="2.5cm">
      <fo:region-body margin-top="1cm"/>
      <fo:region-before extent="1cm"/>
      <fo:region-after extent="1.5cm"/>
    </fo:simple-page-master>
  </fo:layout-master-set>

  <!-- starts actual layout -->
  <fo:page-sequence master-reference="first">
    <fo:flow flow-name="xsl-region-body">
      <fo:block font-family="Noto Sans CJK JP" font-size="12pt" 
font-weight="bold">
        Some special characters:
       </fo:block>
    </fo:flow>
  </fo:page-sequence>
</fo:root>

Actual Results:
I get this message :
Font "Noto Sans CJK JP,normal,700" not found. Substituting with "Noto Sans CJK 
JP,normal,400".
And my text in the generated pdf is not bold.

Expected Results:
The message should not appear, and the text in the generated pdf should be bold.


Additional Information:
If I change the OTFFile.readName() method with this code:
        @Override
        protected void readName() throws IOException {
                Object familyName = fileFont.getProperty("FamilyName");
                if (familyName != null && !familyName.equals("")) {
                        familyNames.add(familyName.toString());
                        fullName = fileFont.getName();
                } else {
                        fullName = fileFont.getName();
                        familyNames.add(fullName);
                }
        }

More precisely :
I replace
fullName = familyName.toString();
by
fullName = fileFont.getName();
        
it solves the bug.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to