You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by tango ray <ra...@yahoo.fr> on 2004/07/01 16:42:25 UTC

Font ttf -> xml -> java

Hi,
 
Thanks to the mailing list, I succeded in using the 3Of9 codebar font. I ve created the 3of9.xml file with ttfReader.java. Then I ve updated my userconfig.xml  and execute fop in command line as this : fop -cd font/usercongif.xml -xml toto.xml -xsl toto.xsl -pdf toto.pdf.
That s all right.
 
But I want to integrate my fonts in my java project that already can create pdf and rtf with fop and the base fonts.
 
As I don t want to have my own fop.jar + (3of9.ttf + 3of9.xml+ etc...) and I want all my files in my fop.jar, I want to create my own font 3of9.JAVA such as Helvetica.java....
It first seemed easy, because I saw in the header of helvetica.java : "this file was generated by font-file.xsl.
 
Here is the probleme, 
1. I ve tried the xsl file on the helvetica.xml include in fop, and the result seems light ( there is width[0x41] = 667........ ) compare to the helvetica.java that is given in fop.
2. Even if the first problem is not one, my own helvetica.xml created with the ttfReader.java has not the same structure and the tags are differents, so the font-file.xsl will never work with my own xml files.

Here is what is written in the header of the xsl file
This files writes the class files for the fonts (Courier.java, Helvetica.java etc.). 
It uses the information in the font description files (Courier.xml, Helvetica.xml) to this
In these font description files each character is referenced by its adobe name:
      <char name="A" width="667"/>
To resolve this name and to find the code for this character it looks up the adobe name in the
file charlist.xml and extracts the WinAnsi code.
.
 
 
But my xml file has no <char name="A" width="667"/>
 
it looks like :
 <?xml version="1.0" encoding="UTF-8" ?> - <font-metrics type="TYPE0">
  <font-name>Arial</font-name> 

  <embed /> 

  <cap-height>715</cap-height> 

  <x-height>518</x-height> 

  <ascender>905</ascender> 

  <descender>-211</descender> 

- <bbox>
  <left>-664</left> 

  <bottom>-324</bottom> 

  <right>2000</right> 

  <top>1005</top> 

  </bbox>


  <flags>32</flags> 

  <stemv>0</stemv> 

  <italicangle>0</italicangle> 

  <subtype>TYPE0</subtype> 

- <multibyte-extras>
  <cid-type>CIDFontType2</cid-type> 

  <default-width>0</default-width> 

- <bfranges>
  <bf us="32" ue="126" gi="3" /> 

  <bf us="160" ue="160" gi="3" /> 

  <bf us="161" ue="161" gi="163" /> 

  <bf us="162" ue="163" gi="132" /> 

  <bf us="164" ue="164" gi="862" /> 

  <bf us="165" ue="165" gi="150" /> 

  .............
 
</bfranges>- <cid-widths start-index="0">
  <wx w="750" /> 

  <wx w="0" /> 

  <wx w="277" /> 

  <wx w="277" /> 

  <wx w="277" /> 

  <wx w="354" /> 

  <wx w="556" /> 

  <wx w="556" /> 

  <wx w="889" /> 

  ....
 </cid-widths>  </multibyte-extras>
- <kerning kpx1="543">
  <pair kpx2="543" kern="-26" /> 

  <pair kpx2="528" kern="-26" /> 

  <pair kpx2="305" kern="-26" /> 
....
</kerning>  </font-metrics>
 
 
Thanks for your help !!!!!!!!!!!
 
Edouard


















		
---------------------------------
Créez GRATUITEMENT votre Yahoo! Mail avec 100 Mo de stockage !
Créez votre Yahoo! Mail

Dialoguez en direct avec vos amis grâce à Yahoo! Messenger !