From: Mauritz Jeanson Date: Thu, 19 Jul 2007 17:07:39 +0000 (+0000) Subject: Added modifications so that the new callout.icon.size parameter is taken into account... X-Git-Tag: release/1.79.1~6^2~1910 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7bb7cfba87f23a420e2aabb6dd98c16a19620241;p=docbook-dsssl Added modifications so that the new callout.icon.size parameter is taken into account. This parameter is used for FO output (where SVG now is the default graphics format for callouts). --- diff --git a/xsl-java/saxon65/src/com/nwalsh/saxon/FormatGraphicCallout.java b/xsl-java/saxon65/src/com/nwalsh/saxon/FormatGraphicCallout.java index c72b9bf53..1ea084217 100644 --- a/xsl-java/saxon65/src/com/nwalsh/saxon/FormatGraphicCallout.java +++ b/xsl-java/saxon65/src/com/nwalsh/saxon/FormatGraphicCallout.java @@ -36,12 +36,14 @@ public class FormatGraphicCallout extends FormatCallout { String graphicsPath = ""; String graphicsExt = ""; int graphicsMax = 0; + String iconSize = ""; - public FormatGraphicCallout(NamePool nPool, String path, String ext, int max, boolean fo) { + public FormatGraphicCallout(NamePool nPool, String path, String ext, int max, String size, boolean fo) { super(nPool, fo); graphicsPath = path; graphicsExt = ext; graphicsMax = max; + iconSize = size; } public void formatCallout(Emitter rtfEmitter, @@ -68,6 +70,8 @@ public class FormatGraphicCallout extends FormatCallout { imgAttr.addAttribute("", "", "src", "CDATA", "url(" + graphicsPath + num + graphicsExt + ")"); imgAttr.addAttribute("", "", "id", "CDATA", id); + imgAttr.addAttribute("", "", "content-width", "CDATA", iconSize); + imgAttr.addAttribute("", "", "width", "CDATA", iconSize); // HTML } else { diff --git a/xsl-java/saxon65/src/com/nwalsh/saxon/Verbatim.java b/xsl-java/saxon65/src/com/nwalsh/saxon/Verbatim.java index 2bff9a02e..9470f8acf 100644 --- a/xsl-java/saxon65/src/com/nwalsh/saxon/Verbatim.java +++ b/xsl-java/saxon65/src/com/nwalsh/saxon/Verbatim.java @@ -78,6 +78,8 @@ public class Verbatim { private static String graphicsExt = null; /** The largest callout number that can be represented graphically. */ private static int graphicsMax = 10; + /** The size of the callout icon. */ + private static String iconSize = null; /** The FormatCallout object to use for formatting callouts. */ private static FormatCallout fCallout = null; @@ -317,7 +319,7 @@ public class Verbatim { int unicodeStart = 49; int unicodeMax = 0; - + String unicodeFont = ""; // Hardcoded defaults @@ -325,6 +327,7 @@ public class Verbatim { graphicsPath = null; graphicsExt = null; graphicsMax = 0; + iconSize = "7pt"; foStylesheet = false; calloutsSetup = true; @@ -371,10 +374,15 @@ public class Verbatim { graphicsMax = 0; } + // Get the callout icon size + varString = getVariable(context, "callout.icon.size"); + iconSize = varString; + fCallout = new FormatGraphicCallout(namePool, graphicsPath, graphicsExt, graphicsMax, + iconSize, foStylesheet); } else if (useUnicode) { // Get the starting character diff --git a/xsl-java/xalan27/src/com/nwalsh/xalan/FormatGraphicCallout.java b/xsl-java/xalan27/src/com/nwalsh/xalan/FormatGraphicCallout.java index bdbf35b01..33f412405 100644 --- a/xsl-java/xalan27/src/com/nwalsh/xalan/FormatGraphicCallout.java +++ b/xsl-java/xalan27/src/com/nwalsh/xalan/FormatGraphicCallout.java @@ -32,12 +32,17 @@ public class FormatGraphicCallout extends FormatCallout { String graphicsPath = ""; String graphicsExt = ""; int graphicsMax = 0; + String iconSize = ""; - public FormatGraphicCallout(String path, String ext, int max, boolean fo) { + public FormatGraphicCallout(String path, String ext, int max, String size, boolean fo) { graphicsPath = path; graphicsExt = ext; graphicsMax = max; stylesheetFO = fo; + iconSize = size; + + //System.out.println("Size: " + size); + } public void formatCallout(DOMBuilder rtf, @@ -61,6 +66,8 @@ public class FormatGraphicCallout extends FormatCallout { imgAttr.addAttribute("", "src", "src", "CDATA", "url(" + graphicsPath + num + graphicsExt + ")"); imgAttr.addAttribute("", "id", "id", "ID", id); + imgAttr.addAttribute("", "content-width", "content-width", "CDATA", iconSize); + imgAttr.addAttribute("", "width", "width", "CDATA", iconSize); } else { ns = ""; diff --git a/xsl-java/xalan27/src/com/nwalsh/xalan/Verbatim.java b/xsl-java/xalan27/src/com/nwalsh/xalan/Verbatim.java index 51f369b5f..8b868ea70 100644 --- a/xsl-java/xalan27/src/com/nwalsh/xalan/Verbatim.java +++ b/xsl-java/xalan27/src/com/nwalsh/xalan/Verbatim.java @@ -94,6 +94,8 @@ public class Verbatim { private String graphicsExt = null; /** The largest callout number that can be represented graphically. */ private int graphicsMax = 10; + /** The size of the callout icon. */ + private static String iconSize = null; /** Should graphic callouts use fo:external-graphics or imgs. */ private boolean graphicsFO = false; @@ -440,9 +442,10 @@ public class Verbatim { String gPath = Params.getString(context, "callout.graphics.path"); String gExt = Params.getString(context, "callout.graphics.extension"); int gMax = Params.getInt(context, "callout.graphics.number.limit"); + String gSize = Params.getString(context, "callout.icon.size"); return insertGraphicCallouts(areaspecNodeSet, xalanNI, defaultColumn, - gPath, gExt, gMax, useFO); + gPath, gExt, gMax, gSize, useFO); } else if (Params.getBoolean(context, "callout.unicode")) { int uStart = Params.getInt(context, "callout.unicode.start.character"); @@ -469,8 +472,9 @@ public class Verbatim { String gPath, String gExt, int gMax, + String gSize, boolean useFO) { - FormatGraphicCallout fgc = new FormatGraphicCallout(gPath,gExt,gMax,useFO); + FormatGraphicCallout fgc = new FormatGraphicCallout(gPath,gExt,gMax, gSize, useFO); return insertCallouts(areaspecNodeSet, xalanNI, defaultColumn, fgc); }