Max Berger a écrit :
> Vincent Hennebert schrieb:
>> Your idea of using manifest.xml looks fine. A quick Google search didn't
>> give me any result regarding a standard way of bundling fonts with Java
>> apps. It looks like you did also search for that before going with the
>> manifest.xml approach. Can you just confirm? We wouldn't like to miss
>> any pure Java standard way.
> I could not find one. Aamof, I could not find any standard way to
> include resources in the classpath, and unfortunately the classloader
> does not have any notion of "directory listing".
> I have, however, missed the most obvious format: the META-INF/MANIFEST
> file . It can also contain information about the enclosed files and
> its attributes, in pairs such as:
> Name: somefont.ttf
> Content-Type: application/x-font
> Also, this format is already implemented .
>  http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html
>  http://java.sun.com/j2se/1.4.2/docs/api/java/util/jar/Manifest.html
You will use the ClassLoader.getResources method, right?
> I personally prefer the syntax of the manifest.xml file, however for
> standards compliance I now think the plain MANIFEST file would be a
> better solution.
Well, that's up to you, but for sure the MANIFEST syntax is simpler to
write and to parse (not yet another XML format). Perhaps the jar tool
even performs validation on such files before bundling them. If that
were me I would probably go with it 8^)
>> Doing the job in XML Graphics Commons would be good, as the font library
>> should ultimately rely there. But I'm not sure if this will be easy to
>> do without moving the whole font stuff now. If that causes you any
>> problem stay in the FOP codebase.
> My idea was to have a method simliar to this in commons:
> List getResourcesOfMimeType(String mimetype)
> where List would be a List<URL>
> And in FOP:
> Font autodetection would then be changed to use URLs instead of Files
> (can handle both files found on disk and in Jars, and avoids loading the
> whole file content), and then simply adding the resources of the known
> font type to the autoconfig list should do the trick.
That looks fine to me.