/*
ASCII2MathML-SVGPensFonts.js v3.41, May 13th 2009
=====================================================================
Copyright Dr.ir. S.A. Miedema, www.Fullxml.org

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT 
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License 
(at http://www.gnu.org/licences/lgpl.html) for more details.
*/

//Start of Pen, Stroke and Fill commands
function setDot(setDot,setRadius,setStrokeWidth,setStroke,setStrokeDashArray,setStrokeOpacity,setFill,setFillOpacity) {
  dottype = setDot;
  if (setRadius!=null) dotradius = setRadius;
  if (setStrokeWidth!=null) dotstrokewidth = setStrokeWidth;
  if (setStroke!=null) dotstroke = setStroke;
  if (setStrokeDashArray!=null) dotstrokedasharray=setStrokeDashArray;
  if (setStrokeOpacity!=null) dotstrokeopacity=setStrokeOpacity;
  if (setFill!=null) dotfill = setFill;
  if (setFillOpacity!=null) dotfillopacity = setFillOpacity;
}

function setMarker(setMarker,setSize,setStrokeWidth,setStroke,setStrokeDashArray,setStrokeOpacity,setFill, setFillOpacity) {
  marker = setMarker;
  if (setSize!=null) markersize = setSize;
  if (setStrokeWidth!=null) markerstrokewidth = setStrokeWidth;
  if (setStroke!=null) markerstroke = setStroke;
  if (setStrokeDashArray!=null) markerstrokedasharray=setStrokeDashArray;
  if (setStrokeOpacity!=null) markerstrokeopacity=setStrokeOpacity;
  if (setFill!=null) markerfill = setFill;
  if (setFillOpacity!=null) markerfillopacity = setFillOpacity;
}

function setPen(setStrokeWidth,setStroke,setStrokeDashArray,setStrokeOpacity) {
  strokewidth=setStrokeWidth;
  stroke=setStroke;
  if (setStrokeDashArray!=null) strokedasharray=setStrokeDashArray;
  if (setStrokeOpacity!=null) strokeopacity=setStrokeOpacity;
}

function setGridPen(setGridStrokeWidth,setGridStroke,setGridStrokeDashArray,setGridStrokeOpacity) {
  gridstrokewidth=setGridStrokeWidth;
  gridstroke=setGridStroke;
  if (setGridStrokeDashArray!=null) gridstrokedasharray=setGridStrokeDashArray;
  if (setGridStrokeOpacity!=null) gridstrokeopacity=setGridStrokeOpacity;
}

function setAxesPen(setAxesStrokeWidth,setAxesStroke,setAxesStrokeDashArray,setAxesStrokeOpacity) {
  axesstrokewidth=setAxesStrokeWidth;
  axesstroke=setAxesStroke;
  if (setAxesStrokeDashArray!=null) axesstrokedasharray=setAxesStrokeDashArray;
  if (setAxesStrokeOpacity!=null) axesstrokeopacity=setAxesStrokeOpacity;
}

function setFill(setFillColor,setFillOpacity) {
  fill = setFillColor;
  fillopacity = setFillOpacity;
}

function setBackgroundFill(setFillColor,setFillOpacity) {
  backgroundfill = setFillColor;
  backgroundfillopacity = setFillOpacity;
}

function setSVGStroke(node) {
  node.setAttribute("stroke", stroke);
  node.setAttribute("stroke-width", strokewidth);
  node.setAttribute("stroke-opacity", strokeopacity);
  if (strokedasharray!=null && strokedasharray!="") node.setAttribute("stroke-dasharray", strokedasharray);
}
function setSVGGridStroke(node) {
  node.setAttribute("stroke", gridstroke);
  node.setAttribute("stroke-width", gridstrokewidth);
  node.setAttribute("stroke-opacity", gridstrokeopacity);
  if (gridstrokedasharray!=null && gridstrokedasharray!="") node.setAttribute("stroke-dasharray", gridstrokedasharray);
}
function setSVGAxesStroke(node) {
  node.setAttribute("stroke", axesstroke);
  node.setAttribute("stroke-width", axesstrokewidth);
  node.setAttribute("stroke-opacity", axesstrokeopacity);
  if (axesstrokedasharray!=null && axesstrokedasharray!="") node.setAttribute("stroke-dasharray", axesstrokedasharray);
}
function setSVGMarkerStroke(node) {
  node.setAttribute("stroke", markerstroke);
  node.setAttribute("stroke-width", markerstrokewidth);
  node.setAttribute("stroke-opacity", markerstrokeopacity);
  if (markerstrokedasharray!=null && markerstrokedasharray!="") node.setAttribute("stroke-dasharray", markerstrokedasharray);
}
function setSVGDotStroke(node) {
  node.setAttribute("stroke", dotstroke);
  node.setAttribute("stroke-width", dotstrokewidth);
  node.setAttribute("stroke-opacity", dotstrokeopacity);
  if (dotstrokedasharray!=null && dotstrokedasharray!="") node.setAttribute("stroke-dasharray", dotstrokedasharray);
}

function setSVGFill(node){
  node.setAttribute("fill", fill);
  node.setAttribute("fill-opacity", fillopacity);
}
function setSVGMarkerFill(node){
  node.setAttribute("fill", markerfill);
  node.setAttribute("fill-opacity", markerfillopacity);
}
function setSVGDotFill(node){
  node.setAttribute("fill", dotfill);
  node.setAttribute("fill-opacity", dotfillopacity);
}
function setSVGStrokeFill(node){
  node.setAttribute("fill", dotstroke);
  node.setAttribute("fill-opacity", dotstrokeopacity);
}
function setSVGNoFill(node){
  node.setAttribute("fill", "none");
  node.setAttribute("fill-opacity", 0);
}
//End of Pen, Stroke and Fill commands

//Start of Font commands
function setFont(setFamily,setSize,setFill,setWeight,setStyle,setStroke) {
  fontfamily=setFamily;
  fontsize=setSize;
  fontfill=setFill;
  if (setWeight!=null) fontweight=setWeight;
  if (setStyle!=null) fontstyle=setStyle;
  if (setStroke!=null) fontstroke=setStroke;
}

function setlabelfont() { 
  fontstyle = labelfontstyle;
  fontfamily = labelfontfamily;
  fontsize = labelfontsize;
  fontweight = labelfontweight;
  fontstroke = labelfontstroke;
  fontfill = labelfontfill;
}

function settitlefont() { 
  fontstyle = titlefontstyle;
  fontfamily = titlefontfamily;
  fontsize = titlefontsize;
  fontweight = titlefontweight;
  fontstroke = titlefontstroke;
  fontfill = titlefontfill;
}

function setaxisfont() { 
  fontstyle = axisfontstyle;
  fontfamily = axisfontfamily;
  fontsize = axisfontsize;
  fontweight = axisfontweight;
  fontstroke = axisfontstroke;
  fontfill = axisfontfill;
  mathcolor = fontfill;      			
  mathfontsize = fontsize+"px";   					
  mathfontweight = fontweight;   				
  mathfontfamily = fontfamily; 					
}

function setLabelFont(setFamily,setSize,setFill,setWeight,setStyle,setStroke) {
  labelfontfamily=setFamily;
  labelfontsize=setSize;
  labelfontfill=setFill;
  if (setWeight!=null) labelfontweight=setWeight;
  if (setStyle!=null) labelfontstyle=setStyle;
  if (setStroke!=null) labelfontstroke=setStroke;
}

function setTitleFont(setFamily,setSize,setFill,setWeight,setStyle,setStroke) {
  titlefontfamily=setFamily;
  titlefontsize=setSize;
  titlefontfill=setFill;
  if (setWeight!=null) titlefontweight=setWeight;
  if (setStyle!=null) titlefontstyle=setStyle;
  if (setStroke!=null) titlefontstroke=setStroke;
}

function setAxisFont(setFamily,setSize,setFill,setWeight,setStyle,setStroke) {
  axisfontfamily=setFamily;
  axisfontsize=setSize;
  axisfontfill=setFill;
  if (setWeight!=null) axisfontweight=setWeight;
  if (setStyle!=null) axisfontstyle=setStyle;
  if (setStroke!=null) axisfontstroke=setStroke;
}
//End of Font commands
