Bug 15541 - Font Support Bug In "embed-file" Attribute
Summary: Font Support Bug In "embed-file" Attribute
Status: CLOSED WONTFIX
Alias: None
Product: Fop - Now in Jira
Classification: Unclassified
Component: general (show other bugs)
Version: 0.20.4
Hardware: PC All
: P3 blocker
Target Milestone: ---
Assignee: fop-dev
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-12-19 17:57 UTC by Sergei Nemchaninov
Modified: 2012-04-01 13:51 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sergei Nemchaninov 2002-12-19 17:57:33 UTC
As it is stated on your site (http://xml.apache.org/fop/fonts.html) embed-file 
attribute is optional but when I removed this attribute I catched an exception.
The method org.apache.fop.configuration.FontInfo.getEmbedFile() throws 
exception because if there is no attribute "embed-file" in tag "font" in 
config.xml then variable "private String embedFile" is null and there is no 
need of further actions.
To solve the problem you need change
    public String getEmbedFile() throws FOPException
    {
        try{
            embedFile = (new URL(embedFile)).getFile();
        }
        catch(MalformedURLException _ex) { }
        if((new File(embedFile)).isAbsolute())
            return embedFile;
        else
            return getBaseDir() + embedFile;
    }
to 
    public String getEmbedFile() throws FOPException
    {
	if(embedFile == null) return null;
        try{
            embedFile = (new URL(embedFile)).getFile();
        }
        catch(MalformedURLException _ex) { }
        if((new File(embedFile)).isAbsolute())
            return embedFile;
        else
            return getBaseDir() + embedFile;
    }

So I added line "if(embedFile == null) return null;" in the beginning of method 
getEmbedFile() in class org.apache.fop.configuration.FontInfo and solved this 
problem.

Yours sincerely,
Sergei Nemchaninov
Comment 1 Jeremias Maerki 2002-12-19 19:20:06 UTC
Would you please try the newly published release candidate 0.20.5rc? There have 
been fixes in this area since 0.20.4 so maybe the problem you're experiencing 
is already fixed. I'm closing this entry, but feel free to reopen if 0.20.5rc 
doesn't work as expected.
Comment 2 Glenn Adams 2012-04-01 13:51:52 UTC
batch transition to closed remaining pre-FOP1.0 resolved bugs