You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

font-file.xsl 2.0KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <xsl:stylesheet version="1.0"
  2. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  3. xmlns:lxslt="http://xml.apache.org/xslt"
  4. xmlns:redirect="org.apache.xalan.xslt.extensions.Redirect"
  5. extension-element-prefixes="redirect">
  6. <xsl:output method="text" />
  7. <xsl:template match="font-metrics">
  8. <xsl:variable name="class-name" select="class-name"/>
  9. <!--<redirect:write select="concat('org/apache/fop/render/pdf/fonts/', $class-name, '.java')">-->
  10. package org.apache.fop.render.pdf.fonts;
  11. import org.apache.fop.render.pdf.Font;
  12. public class <xsl:value-of select="class-name"/> extends Font {
  13. private final static String fontName = "<xsl:value-of select="font-name"/>";
  14. private final static String encoding = "<xsl:value-of select="encoding"/>";
  15. private final static int capHeight = <xsl:value-of select="cap-height"/>;
  16. private final static int xHeight = <xsl:value-of select="x-height"/>;
  17. private final static int ascender = <xsl:value-of select="ascender"/>;
  18. private final static int descender = <xsl:value-of select="descender"/>;
  19. private final static int[] width;
  20. static {
  21. width = new int[256];
  22. <xsl:for-each select="widths/char"><xsl:variable name="char-name" select="@name"/><xsl:variable name="char-num" select="document('charlist.xml')/font-mappings/map[@adobe-name=$char-name]/@win-ansi"/><xsl:if test="$char-num!='-1'"> width[<xsl:value-of select="$char-num"/>] = <xsl:value-of select="@width"/>;
  23. </xsl:if></xsl:for-each>
  24. }
  25. public String encoding() {
  26. return encoding;
  27. }
  28. public String fontName() {
  29. return fontName;
  30. }
  31. public int getAscender() {
  32. return ascender;
  33. }
  34. public int getCapHeight() {
  35. return capHeight;
  36. }
  37. public int getDescender() {
  38. return descender;
  39. }
  40. public int getXHeight() {
  41. return xHeight;
  42. }
  43. public int width(int i) {
  44. return width[i];
  45. }
  46. }
  47. <!--</redirect:write>-->
  48. </xsl:template>
  49. </xsl:stylesheet>