]> granicus.if.org Git - docbook-dsssl/commitdiff
Removed the FormatDingbatCallout classes, they were the same as the FormatUnicodeCall...
authorNorman Walsh <ndw@nwalsh.com>
Sun, 5 Aug 2001 22:35:38 +0000 (22:35 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Sun, 5 Aug 2001 22:35:38 +0000 (22:35 +0000)
xsl/extensions/saxon642/com/nwalsh/saxon/FormatDingbatCallout.java [deleted file]
xsl/extensions/saxon642/com/nwalsh/saxon/FormatUnicodeCallout.java
xsl/extensions/saxon642/com/nwalsh/saxon/Verbatim.java
xsl/extensions/saxon643/com/nwalsh/saxon/FormatDingbatCallout.java [deleted file]
xsl/extensions/saxon643/com/nwalsh/saxon/FormatUnicodeCallout.java
xsl/extensions/saxon643/com/nwalsh/saxon/Verbatim.java
xsl/fo/callout.xsl
xsl/fo/param.xsl
xsl/html/param.xsl

diff --git a/xsl/extensions/saxon642/com/nwalsh/saxon/FormatDingbatCallout.java b/xsl/extensions/saxon642/com/nwalsh/saxon/FormatDingbatCallout.java
deleted file mode 100644 (file)
index f5a690b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.nwalsh.saxon;
-
-import org.xml.sax.SAXException;
-import org.w3c.dom.*;
-
-import javax.xml.transform.TransformerException;
-
-import com.icl.saxon.om.NamePool;
-import com.icl.saxon.output.Emitter;
-import com.icl.saxon.tree.AttributeCollection;
-
-import com.nwalsh.saxon.Callout;
-
-/**
- * <p>Utility class for the Verbatim extension (ignore this).</p>
- *
- * <p>$Id$</p>
- *
- * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
- *
- * <p><b>Change Log:</b></p>
- * <dl>
- * <dt>1.0</dt>
- * <dd><p>Initial release.</p></dd>
- * </dl>
- *
- * @author Norman Walsh
- * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
- *
- * @see Verbatim
- *
- * @version $Id$
- **/
-
-public class FormatDingbatCallout extends FormatCallout {
-  int graphicsMax = 0;
-
-  public FormatDingbatCallout(NamePool nPool, int max, boolean fo) {
-    super(nPool, fo);
-    graphicsMax = max;
-  }
-
-  public void formatCallout(Emitter rtfEmitter,
-                           Callout callout) {
-    Element area = callout.getArea();
-    int num = callout.getCallout();
-    String userLabel = areaLabel(area);
-    String label = "";
-
-    if (userLabel != null) {
-      label = userLabel;
-    }
-
-    try {
-      if (userLabel == null && num <= graphicsMax) {
-       int inName = 0;
-       AttributeCollection inAttr = null;
-       int namespaces[] = new int[1];
-
-       if (foStylesheet) {
-         inName = namePool.allocate("fo", foURI, "inline");
-         inAttr = new AttributeCollection(namePool);
-         inAttr.addAttribute("", "", "font-family", "CDATA", "ZapfDingbats");
-       } else {
-         inName = namePool.allocate("", "", "font");
-         inAttr = new AttributeCollection(namePool);
-         inAttr.addAttribute("", "", "face", "CDATA", "ZapfDingbats");
-       }
-
-       startSpan(rtfEmitter);
-       rtfEmitter.startElement(inName, inAttr, namespaces, 0);
-
-       char chars[] = new char[1];
-       chars[0] = (char) (0x2775 + num);
-       rtfEmitter.characters(chars, 0, 1);
-
-       rtfEmitter.endElement(inName);
-       endSpan(rtfEmitter);
-      } else {
-       formatTextCallout(rtfEmitter, callout);
-      }
-    } catch (TransformerException e) {
-      System.out.println("Transformer Exception in graphic formatCallout");
-    }
-  }
-}
index bf3b16d8efe168b7a6cf58c193ba01d839e5a863..e51e1c074c7f139640748ec42490dd25ae667803 100644 (file)
@@ -35,28 +35,59 @@ import com.nwalsh.saxon.Callout;
 public class FormatUnicodeCallout extends FormatCallout {
   int unicodeMax = 0;
   int unicodeStart = 0;
+  String unicodeFont = "";
 
-  public FormatUnicodeCallout(NamePool nPool, int start, int max, boolean fo) {
+  public FormatUnicodeCallout(NamePool nPool,
+                             String font,
+                             int start,
+                             int max,
+                             boolean fo) {
     super(nPool, fo);
+    unicodeFont = font;
     unicodeMax = max;
     unicodeStart = start;
   }
 
   public void formatCallout(Emitter rtfEmitter,
                            Callout callout) {
-
     Element area = callout.getArea();
     int num = callout.getCallout();
-    String label = areaLabel(area);
+    String userLabel = areaLabel(area);
+    String label = "";
+
+    if (userLabel != null) {
+      label = userLabel;
+    }
 
     try {
-      if (label == null && num <= unicodeMax) {
+      if (userLabel == null && num <= unicodeMax) {
+       int inName = 0;
+       AttributeCollection inAttr = null;
+       int namespaces[] = new int[1];
+
+       if (!unicodeFont.equals("")) {
+         if (foStylesheet) {
+           inName = namePool.allocate("fo", foURI, "inline");
+           inAttr = new AttributeCollection(namePool);
+           inAttr.addAttribute("", "", "font-family", "CDATA", unicodeFont);
+         } else {
+           inName = namePool.allocate("", "", "font");
+           inAttr = new AttributeCollection(namePool);
+           inAttr.addAttribute("", "", "face", "CDATA", unicodeFont);
+         }
+
+         startSpan(rtfEmitter);
+         rtfEmitter.startElement(inName, inAttr, namespaces, 0);
+       }
+
        char chars[] = new char[1];
        chars[0] = (char) (unicodeStart + num - 1);
-
-       startSpan(rtfEmitter);
        rtfEmitter.characters(chars, 0, 1);
-       endSpan(rtfEmitter);
+
+       if (!unicodeFont.equals("")) {
+         rtfEmitter.endElement(inName);
+         endSpan(rtfEmitter);
+       }
       } else {
        formatTextCallout(rtfEmitter, callout);
       }
index 9585b89897a58efb8769b25df530896b2c8c05c8..b2fae63b4c93e501088b442fba26d4bbf4fd64b0 100644 (file)
@@ -295,11 +295,11 @@ public class Verbatim {
 
     boolean useGraphics = false;
     boolean useUnicode = false;
-    boolean useDingbats = false;
 
     int unicodeStart = 49;
     int unicodeMax = 0;
-    int dingbatMax = 10;
+
+    String unicodeFont = "";
 
     // Hardcoded defaults
     defaultColumn = 60;
@@ -333,10 +333,6 @@ public class Verbatim {
     varString = getVariable(context, "callout.unicode");
     useUnicode = !(varString.equals("0") || varString.equals(""));
 
-    // Use dingbats at all?
-    varString = getVariable(context, "callout.dingbats");
-    useDingbats = !(varString.equals("0") || varString.equals(""));
-
     if (useGraphics) {
       // Get the graphics path
       varString = getVariable(context, "callout.graphics.path");
@@ -382,14 +378,17 @@ public class Verbatim {
        unicodeStart = 0;
       }
 
+      // Get the font
+      unicodeFont = getVariable(context, "callout.unicode.font");
+      if (unicodeFont == null) {
+       unicodeFont = "";
+      }
+
       fCallout = new FormatUnicodeCallout(namePool,
+                                         unicodeFont,
                                          unicodeStart,
                                          unicodeMax,
                                          foStylesheet);
-    } else if (useDingbats) {
-      fCallout = new FormatDingbatCallout(namePool,
-                                         dingbatMax,
-                                         foStylesheet);
     } else {
       fCallout = new FormatTextCallout(namePool, foStylesheet);
     }
diff --git a/xsl/extensions/saxon643/com/nwalsh/saxon/FormatDingbatCallout.java b/xsl/extensions/saxon643/com/nwalsh/saxon/FormatDingbatCallout.java
deleted file mode 100644 (file)
index f5a690b..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-package com.nwalsh.saxon;
-
-import org.xml.sax.SAXException;
-import org.w3c.dom.*;
-
-import javax.xml.transform.TransformerException;
-
-import com.icl.saxon.om.NamePool;
-import com.icl.saxon.output.Emitter;
-import com.icl.saxon.tree.AttributeCollection;
-
-import com.nwalsh.saxon.Callout;
-
-/**
- * <p>Utility class for the Verbatim extension (ignore this).</p>
- *
- * <p>$Id$</p>
- *
- * <p>Copyright (C) 2000, 2001 Norman Walsh.</p>
- *
- * <p><b>Change Log:</b></p>
- * <dl>
- * <dt>1.0</dt>
- * <dd><p>Initial release.</p></dd>
- * </dl>
- *
- * @author Norman Walsh
- * <a href="mailto:ndw@nwalsh.com">ndw@nwalsh.com</a>
- *
- * @see Verbatim
- *
- * @version $Id$
- **/
-
-public class FormatDingbatCallout extends FormatCallout {
-  int graphicsMax = 0;
-
-  public FormatDingbatCallout(NamePool nPool, int max, boolean fo) {
-    super(nPool, fo);
-    graphicsMax = max;
-  }
-
-  public void formatCallout(Emitter rtfEmitter,
-                           Callout callout) {
-    Element area = callout.getArea();
-    int num = callout.getCallout();
-    String userLabel = areaLabel(area);
-    String label = "";
-
-    if (userLabel != null) {
-      label = userLabel;
-    }
-
-    try {
-      if (userLabel == null && num <= graphicsMax) {
-       int inName = 0;
-       AttributeCollection inAttr = null;
-       int namespaces[] = new int[1];
-
-       if (foStylesheet) {
-         inName = namePool.allocate("fo", foURI, "inline");
-         inAttr = new AttributeCollection(namePool);
-         inAttr.addAttribute("", "", "font-family", "CDATA", "ZapfDingbats");
-       } else {
-         inName = namePool.allocate("", "", "font");
-         inAttr = new AttributeCollection(namePool);
-         inAttr.addAttribute("", "", "face", "CDATA", "ZapfDingbats");
-       }
-
-       startSpan(rtfEmitter);
-       rtfEmitter.startElement(inName, inAttr, namespaces, 0);
-
-       char chars[] = new char[1];
-       chars[0] = (char) (0x2775 + num);
-       rtfEmitter.characters(chars, 0, 1);
-
-       rtfEmitter.endElement(inName);
-       endSpan(rtfEmitter);
-      } else {
-       formatTextCallout(rtfEmitter, callout);
-      }
-    } catch (TransformerException e) {
-      System.out.println("Transformer Exception in graphic formatCallout");
-    }
-  }
-}
index bf3b16d8efe168b7a6cf58c193ba01d839e5a863..e51e1c074c7f139640748ec42490dd25ae667803 100644 (file)
@@ -35,28 +35,59 @@ import com.nwalsh.saxon.Callout;
 public class FormatUnicodeCallout extends FormatCallout {
   int unicodeMax = 0;
   int unicodeStart = 0;
+  String unicodeFont = "";
 
-  public FormatUnicodeCallout(NamePool nPool, int start, int max, boolean fo) {
+  public FormatUnicodeCallout(NamePool nPool,
+                             String font,
+                             int start,
+                             int max,
+                             boolean fo) {
     super(nPool, fo);
+    unicodeFont = font;
     unicodeMax = max;
     unicodeStart = start;
   }
 
   public void formatCallout(Emitter rtfEmitter,
                            Callout callout) {
-
     Element area = callout.getArea();
     int num = callout.getCallout();
-    String label = areaLabel(area);
+    String userLabel = areaLabel(area);
+    String label = "";
+
+    if (userLabel != null) {
+      label = userLabel;
+    }
 
     try {
-      if (label == null && num <= unicodeMax) {
+      if (userLabel == null && num <= unicodeMax) {
+       int inName = 0;
+       AttributeCollection inAttr = null;
+       int namespaces[] = new int[1];
+
+       if (!unicodeFont.equals("")) {
+         if (foStylesheet) {
+           inName = namePool.allocate("fo", foURI, "inline");
+           inAttr = new AttributeCollection(namePool);
+           inAttr.addAttribute("", "", "font-family", "CDATA", unicodeFont);
+         } else {
+           inName = namePool.allocate("", "", "font");
+           inAttr = new AttributeCollection(namePool);
+           inAttr.addAttribute("", "", "face", "CDATA", unicodeFont);
+         }
+
+         startSpan(rtfEmitter);
+         rtfEmitter.startElement(inName, inAttr, namespaces, 0);
+       }
+
        char chars[] = new char[1];
        chars[0] = (char) (unicodeStart + num - 1);
-
-       startSpan(rtfEmitter);
        rtfEmitter.characters(chars, 0, 1);
-       endSpan(rtfEmitter);
+
+       if (!unicodeFont.equals("")) {
+         rtfEmitter.endElement(inName);
+         endSpan(rtfEmitter);
+       }
       } else {
        formatTextCallout(rtfEmitter, callout);
       }
index 4c2a19b83a93f520bda29338c3a5b8509ba8d5c5..1ba7532d6317e1fdf1b1ac520c2ab8bf23bdf2b2 100644 (file)
@@ -298,11 +298,11 @@ public class Verbatim {
 
     boolean useGraphics = false;
     boolean useUnicode = false;
-    boolean useDingbats = false;
 
     int unicodeStart = 49;
     int unicodeMax = 0;
-    int dingbatMax = 10;
+
+    String unicodeFont = "";
 
     // Hardcoded defaults
     defaultColumn = 60;
@@ -336,10 +336,6 @@ public class Verbatim {
     varString = getVariable(context, "callout.unicode");
     useUnicode = !(varString.equals("0") || varString.equals(""));
 
-    // Use dingbats at all?
-    varString = getVariable(context, "callout.dingbats");
-    useDingbats = !(varString.equals("0") || varString.equals(""));
-
     if (useGraphics) {
       // Get the graphics path
       varString = getVariable(context, "callout.graphics.path");
@@ -385,14 +381,17 @@ public class Verbatim {
        unicodeStart = 0;
       }
 
+      // Get the font
+      unicodeFont = getVariable(context, "callout.unicode.font");
+      if (unicodeFont == null) {
+       unicodeFont = "";
+      }
+
       fCallout = new FormatUnicodeCallout(namePool,
+                                         unicodeFont,
                                          unicodeStart,
                                          unicodeMax,
                                          foStylesheet);
-    } else if (useDingbats) {
-      fCallout = new FormatDingbatCallout(namePool,
-                                         dingbatMax,
-                                         foStylesheet);
     } else {
       fCallout = new FormatTextCallout(namePool, foStylesheet);
     }
index ef456ff68e800a3dcbd8ff6ae45480059fc24dc5..c40fe3d59041c19c2b241651d3c6467cf3690c37 100644 (file)
 
     <xsl:when test="$callout.unicode != 0
                     and $conum &lt;= $callout.unicode.number.limit">
-      <xsl:choose>
-        <xsl:when test="$callout.unicode.start.character = 10102">
-          <xsl:choose>
-            <xsl:when test="$conum = 1">&#10102;</xsl:when>
-            <xsl:when test="$conum = 2">&#10103;</xsl:when>
-            <xsl:when test="$conum = 3">&#10104;</xsl:when>
-            <xsl:when test="$conum = 4">&#10105;</xsl:when>
-            <xsl:when test="$conum = 5">&#10106;</xsl:when>
-            <xsl:when test="$conum = 6">&#10107;</xsl:when>
-            <xsl:when test="$conum = 7">&#10108;</xsl:when>
-            <xsl:when test="$conum = 8">&#10109;</xsl:when>
-            <xsl:when test="$conum = 9">&#10110;</xsl:when>
-            <xsl:when test="$conum = 10">&#10111;</xsl:when>
-          </xsl:choose>
-        </xsl:when>
-        <xsl:otherwise>
-          <xsl:message>
-            <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
-            <xsl:text>when $callout.unicode.start.character is </xsl:text>
-            <xsl:value-of select="$callout.unicode.start.character"/>
-          </xsl:message>
-          <fo:inline background-color="#404040"
-                     color="white"
-                     padding-top="0.1em"
-                     padding-bottom="0.1em"
-                     padding-start="0.2em"
-                     padding-end="0.2em"
-                     baseline-shift="0.1em"
-                     font-family="{$body.font.family}"
-                     font-weight="bold"
-                     font-size="75%">
-            <xsl:value-of select="$conum"/>
-          </fo:inline>
-        </xsl:otherwise>
-      </xsl:choose>
-    </xsl:when>
-
-    <!-- Pick callouts from Zapf Dingbats - max 10 -->
-    <xsl:when test="$callout.dingbats != '0' and $conum &lt;= 10">
-      <fo:inline font-family="ZapfDingbats">
+      <xsl:variable name="comarkup">
         <xsl:choose>
-          <xsl:when test="$conum=1">&#x2776;</xsl:when>
-          <xsl:when test="$conum=2">&#x2777;</xsl:when>
-          <xsl:when test="$conum=3">&#x2778;</xsl:when>
-          <xsl:when test="$conum=4">&#x2779;</xsl:when>
-          <xsl:when test="$conum=5">&#x277A;</xsl:when>
-          <xsl:when test="$conum=6">&#x277B;</xsl:when>
-          <xsl:when test="$conum=7">&#x277C;</xsl:when>
-          <xsl:when test="$conum=8">&#x277D;</xsl:when>
-          <xsl:when test="$conum=9">&#x277E;</xsl:when>
-          <xsl:when test="$conum=10">&#x277F;</xsl:when>
-          <xsl:otherwise><!-- overflow -->
-            <xsl:attribute name="color">red</xsl:attribute>
-            <xsl:text>&#x25CF;</xsl:text>
+          <xsl:when test="$callout.unicode.start.character = 10102">
+            <xsl:choose>
+              <xsl:when test="$conum = 1">&#10102;</xsl:when>
+              <xsl:when test="$conum = 2">&#10103;</xsl:when>
+              <xsl:when test="$conum = 3">&#10104;</xsl:when>
+              <xsl:when test="$conum = 4">&#10105;</xsl:when>
+              <xsl:when test="$conum = 5">&#10106;</xsl:when>
+              <xsl:when test="$conum = 6">&#10107;</xsl:when>
+              <xsl:when test="$conum = 7">&#10108;</xsl:when>
+              <xsl:when test="$conum = 8">&#10109;</xsl:when>
+              <xsl:when test="$conum = 9">&#10110;</xsl:when>
+              <xsl:when test="$conum = 10">&#10111;</xsl:when>
+            </xsl:choose>
+          </xsl:when>
+          <xsl:otherwise>
             <xsl:message>
-              <xsl:text>A callout list contains more than 10 callouts;</xsl:text>
-              <xsl:text> callout numbering truncated.</xsl:text>
+              <xsl:text>Don't know how to generate Unicode callouts </xsl:text>
+              <xsl:text>when $callout.unicode.start.character is </xsl:text>
+              <xsl:value-of select="$callout.unicode.start.character"/>
             </xsl:message>
+            <fo:inline background-color="#404040"
+                       color="white"
+                       padding-top="0.1em"
+                       padding-bottom="0.1em"
+                       padding-start="0.2em"
+                       padding-end="0.2em"
+                       baseline-shift="0.1em"
+                       font-family="{$body.font.family}"
+                       font-weight="bold"
+                       font-size="75%">
+              <xsl:value-of select="$conum"/>
+            </fo:inline>
           </xsl:otherwise>
         </xsl:choose>
-      </fo:inline>
+      </xsl:variable>
+
+      <xsl:choose>
+        <xsl:when test="$callout.unicode.font != ''">
+          <fo:inline font-family="{$callout.unicode.font}">
+            <xsl:copy-of select="$comarkup"/>
+          </fo:inline>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:copy-of select="$comarkup"/>
+        </xsl:otherwise>
+      </xsl:choose>
     </xsl:when>
 
     <!-- Most safe: draw a dark gray square with a white number inside -->
                  baseline-shift="0.1em"
                  font-family="{$body.font.family}"
                  font-weight="bold"
-                 font-size="75%"><xsl:value-of select="$conum"/></fo:inline>
+                 font-size="75%">
+        <xsl:value-of select="$conum"/>
+      </fo:inline>
     </xsl:otherwise>
   </xsl:choose>
 </xsl:template>
index 9e85993f0326577eaa7f649a84e397d02c62b6da..a5c72761a84a842faeafc4893a87751e671342aa 100644 (file)
@@ -359,12 +359,13 @@ callouts should not be used.
 </doc:param>
 
 <!-- ==================================================================== -->
-<xsl:param name="callout.dingbats" select="'0'"/>
+<xsl:param name="callout.unicode.font" select="'ZapfDingbats'"/>
 
-<doc:param name="callout.dingbats" xmlns="">
-<refpurpose>Use Zapf Dingbats for callouts?</refpurpose>
+<doc:param name="callout.unicode.font" xmlns="">
+<refpurpose>Font to use for Unicode dingbats</refpurpose>
 <refdescription>
-<para>If non-zero, callouts are presented with Zapf Dingbats.
+<para>The name of the font to specify around Unicode callout glyphs.
+If set to the empty string, no font change will occur.
 </para>
 </refdescription>
 </doc:param>
index 38e94733a8e4b7e3f57bfc4d9b06c1eab9664f4f..526c084d0122e0813c4eac4b3dc46064feb3d6fe 100644 (file)
@@ -1059,12 +1059,13 @@ be used.
 </doc:param>
 
 <!-- ==================================================================== -->
-<xsl:param name="callout.dingbats" select="'0'"/>
+<xsl:param name="callout.unicode.font" select="'ZapfDingbats'"/>
 
-<doc:param name="callout.dingbats" xmlns="">
-<refpurpose>Use Zapf Dingbats for callouts?</refpurpose>
+<doc:param name="callout.unicode.font" xmlns="">
+<refpurpose>Font to use for Unicode dingbats</refpurpose>
 <refdescription>
-<para>If non-zero, callouts are presented with Zapf Dingbats.
+<para>The name of the font to specify around Unicode callout glyphs.
+If set to the empty string, no font change will occur.
 </para>
 </refdescription>
 </doc:param>