* jars inside that folder are also searched for fonts.
*/
public Font parse(String webInfLibPath, String name)
throws IOException
{
MergePath mergePath = new MergePath();
mergePath.addClassPath();
File webInfLibFile = new File(webInfLibPath);
if(webInfLibPath != null && !webInfLibPath.isEmpty() && webInfLibFile.isDirectory())
{
Path webInfPath = Vfs.lookup(webInfLibFile.getAbsolutePath());
for( File f : webInfLibFile.listFiles())
{
/*
only look for files that are either jars or zips
*/
if(f.isFile() && (f.getAbsolutePath().endsWith(".jar") || f.getAbsolutePath().endsWith(".zip")))
{
/*
get a path object with the Jar relative to WEB-INF/lib
*/
Path jarPath = webInfPath.lookup(f.getName());
/*
Encapsulate it as a JarPath, else mergePath.lookup does not look
"into" the jar when looking for resources
*/
mergePath.addMergePath(JarPath.create(jarPath));
}
}
}
Path path = mergePath.lookup("com/caucho/quercus/lib/pdf/font/" + name + ".afm");
if (! path.canRead())
throw new FileNotFoundException(L.l("Can't find font {0}", name));
_is = path.openRead();