class WirisPlugin::ImageFormatControllerSvg
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb, line 10 def initialize() super() end
Public Instance Methods
getContentType()
click to toggle source
# File lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb, line 13 def getContentType() return "image/svg+xml" end
getMetrics(bytes, ref_output)
click to toggle source
# File lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb, line 16 def getMetrics(bytes, ref_output) svg = bytes::toString() svgRoot = Std::substr(svg,0,svg::indexOf(">")) firstIndex = svgRoot::indexOf("height=") + 8 endIndex = svgRoot::indexOf("\"",firstIndex) height = Std::substr(svgRoot,firstIndex,endIndex - firstIndex) firstIndex = svgRoot::indexOf("width=") + 7 endIndex = svgRoot::indexOf("\"",firstIndex) width = Std::substr(svgRoot,firstIndex,endIndex - firstIndex) firstIndex = svgRoot::indexOf("wrs:baseline=") + 14 endIndex = svgRoot::indexOf("\"",firstIndex) baseline = Std::substr(svgRoot,firstIndex,endIndex - firstIndex) output = ref_output if output != nil PropertiesTools::setProperty(output,"width","" + width) PropertiesTools::setProperty(output,"height","" + height) PropertiesTools::setProperty(output,"baseline","" + baseline) r = "" else r = (((("&cw=" + width) + "&ch=") + height) + "&cb=") + baseline end return r end
scalateMetrics(dpi, metrics)
click to toggle source
# File lib/com/wiris/plugin/impl/ImageFormatControllerSvg.rb, line 39 def scalateMetrics(dpi, metrics) end