# Python: module fabmetheus_utilities.svg_reader

fabmetheus_utilities.svg_reader ($Date: 2008/21/04 $) | index /home/enrique/Desktop/backup/babbleold/script/reprap/fabmetheus/fabmetheus_utilities/svg_reader.py

`Svg reader.`

Modules

``

__init__ fabmetheus_utilities.archive fabmetheus_utilities.euclidean | fabmetheus_utilities.gcodec fabmetheus_utilities.intercircle math | os fabmetheus_utilities.settings fabmetheus_utilities.svg_writer | sys traceback fabmetheus_utilities.geometry.solids.trianglemesh

Classes

``

FontReader
Glyph
MatrixSVG
PathReader
SVGReader

class FontReader
`` | `Class to read a font in the fonts folder.`

Methods defined here:

__init__(self, fontFamily)
  `Initialize.`

getGlyph(self, character, yAxisPointingUpward)
  `Get the glyph for the character.`

class Glyph
`` | `Class to handle a glyph.`

Methods defined here:

__init__(self, unitsPerEM, xmlElement, yAxisPointingUpward)
  `Initialize.`

getSizedAdvancedLoops(self, fontSize, horizontalAdvanceX, yAxisPointingUpward=True)
  `Get loops for font size, advanced horizontally.`

class MatrixSVG
`` | `Two by three svg matrix.`

Methods defined here:

__init__(self, tricomplex=None)
  `Initialize.`

__repr__(self)
  `Get the string representation of this two by three svg matrix.`

getOtherTimesSelf(self, otherTricomplex)
  `Get the other matrix multiplied by this matrix.`

getSelfTimesOther(self, otherTricomplex)
  `Get this matrix multiplied by the other matrix.`

getTransformedPath(self, path)
  `Get transformed path.`

getTransformedPaths(self, paths)
  `Get transformed paths.`

class PathReader
`` | `Class to read svg path.`

Methods defined here:

__init__(self, loops, xmlElement, yAxisPointingUpward)
  `Add to path string to loops.`

addPathArc(self, end)
  `Add an arc to the path.`

addPathCubic(self, controlPoints, end)
  `Add a cubic curve to the path.`

addPathCubicReflected(self, controlPoint, end)
  `Add a cubic curve to the path from a reflected control point.`

addPathLine(self, lineFunction, point)
  `Add a line to the path.`

addPathLineAxis(self, point)
  `Add an axis line to the path.`

addPathLineByFunction(self, lineFunction)
  `Add a line to the path by line function.`

addPathMove(self, lineFunction, point)
  `Add an axis line to the path.`

addPathQuadratic(self, controlPoint, end)
  `Add a quadratic curve to the path.`

addPathQuadraticReflected(self, end)
  `Add a quadratic curve to the path from a reflected control point.`

getComplexByExtraIndex(self, extraIndex=0)
  `Get complex from the extraIndex.`

getComplexRelative(self)
  `Get relative complex.`

getFloatByExtraIndex(self, extraIndex=0)
  `Get float from the extraIndex.`

getOldPoint(self)
  `Get the old point.`

processPathWordA(self)
  `Process path word A.`

processPathWordC(self)
  `Process path word C.`

processPathWordH(self)
  `Process path word H.`

processPathWordL(self)
  `Process path word L.`

processPathWordM(self)
  `Process path word M.`

processPathWordQ(self)
  `Process path word Q.`

processPathWordS(self)
  `Process path word S.`

processPathWordT(self)
  `Process path word T.`

processPathWordV(self)
  `Process path word V.`

processPathWordZ(self)
  `Process path word Z.`

processPathWorda(self)
  `Process path word a.`

processPathWordc(self)
  `Process path word C.`

processPathWordh(self)
  `Process path word h.`

processPathWordl(self)
  `Process path word l.`

processPathWordm(self)
  `Process path word m.`

processPathWordq(self)
  `Process path word q.`

processPathWords(self)
  `Process path word s.`

processPathWordt(self)
  `Process path word t.`

processPathWordv(self)
  `Process path word v.`

processPathWordz(self)
  `Process path word z.`

class SVGReader
`` | `An svg carving.`

Methods defined here:

__init__(self)
  `Add empty lists.`

flipDirectLayer(self, rotatedLoopLayer)
  `Flip the y coordinate of the layer and direct the loops.`

getRotatedLoopLayer(self)
  `Return the rotated loop layer.`

parseSVG(self, fileName, svgText)
  `Parse SVG text and store the layers.`

parseSVGByXMLElement(self, xmlElement)
  `Parse SVG by xmlElement.`

processXMLElement(self, xmlElement)
  `Process the xml element.`

Functions

``

addFunctionsToDictionary(dictionary, functions, prefix)
  `Add functions to dictionary.`

getArcComplexes(begin, end, largeArcFlag, radius, sweepFlag, xAxisRotation)
  `Get the arc complexes, procedure at http://www.w3.org/TR/SVG/implnote.html#ArcImplementationNotes`

getChainMatrixSVG(matrixSVG, xmlElement)
  `Get chain matrixSVG by svgElement.`

getChainMatrixSVGIfNecessary(xmlElement, yAxisPointingUpward)
  `Get chain matrixSVG by svgElement and yAxisPointingUpward.`

getCubicPoint(along, begin, controlPoints, end)
  `Get the cubic point.`

getCubicPoints(begin, controlPoints, end, numberOfBezierPoints=22)
  `Get the cubic points.`

getFontReader(fontFamily)
  `Get the font reader for the fontFamily.`

getFontsDirectoryPath()
  `Get the fonts directory path.`

getLabelString(dictionary)
  `Get the label string for the dictionary.`

getMatrixSVG(xmlElement)
  `Get matrixSVG by svgElement.`

getQuadraticPoint(along, begin, controlPoint, end)
  `Get the quadratic point.`

getQuadraticPoints(begin, controlPoint, end, numberOfBezierPoints=22)
  `Get the quadratic points.`

getRightStripAlphabetPercent(word)
  `Get word with alphabet characters and the percent sign stripped from the right.`

getRightStripMinusSplit(lineString)
  `Get string with spaces after the minus sign stripped.`

getStrokeRadius(xmlElement)
  `Get the stroke radius.`

getStyleValue(defaultValue, key, xmlElement)
  `Get the stroke value string.`

getTextComplexLoops(fontFamily, fontSize, text, yAxisPointingUpward=True)
  `Get text as complex loops.`

getTransformedFillOutline(loop, xmlElement, yAxisPointingUpward)
  `Get the loops if fill is on, otherwise get the outlines.`

getTransformedOutlineByPath(path, xmlElement, yAxisPointingUpward)
  `Get the outline from the path.`

getTransformedOutlineByPaths(paths, xmlElement, yAxisPointingUpward)
  `Get the outline from the paths.`

getTricomplexTimesColumn(firstTricomplex, otherColumn)
  `Get this matrix multiplied by the otherColumn.`

getTricomplexTimesOther(firstTricomplex, otherTricomplex)
  `Get the first tricomplex multiplied by the other tricomplex.`

getTricomplexmatrix(transformWords)
  `Get matrixSVG by transformWords.`

getTricomplexrotate(transformWords)
  `Get matrixSVG by transformWords.`

getTricomplexscale(transformWords)
  `Get matrixSVG by transformWords.`

getTricomplexskewX(transformWords)
  `Get matrixSVG by transformWords.`

getTricomplexskewY(transformWords)
  `Get matrixSVG by transformWords.`

getTricomplextranslate(transformWords)
  `Get matrixSVG by transformWords.`

processSVGElementcircle(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementellipse(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementg(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementline(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementpath(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementpolygon(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementpolyline(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementrect(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

processSVGElementtext(svgReader, xmlElement)
  `Process xmlElement by svgReader.`

Data

``

__author__ = 'Enrique Perez (perez_enrique@yahoo.com)'
__credits__ = 'Nophead <http://hydraraptor.blogspot.com/>\nArt of Illusion <http://www.artofillusion.org/>'
__date__ = '$Date: 2008/21/04 $'
__license__ = 'GPL 3.0'
absolute_import = _Feature((2, 5, 0, 'alpha', 1), (2, 7, 0, 'alpha', 0), 16384)
globalFontFileNames = None
globalFontReaderDictionary = {}
globalGetTricomplexDictionary = {'matrix': <function getTricomplexmatrix at 0x83b4dbc>, 'rotate': <function getTricomplexrotate at 0x83b4df4>, 'scale': <function getTricomplexscale at 0x83b4e2c>, 'skewX': <function getTricomplexskewX at 0x83b4e64>, 'skewY': <function getTricomplexskewY at 0x83b4e9c>, 'translate': <function getTricomplextranslate at 0x83b4f44>}
globalGetTricomplexFunctions = [<function getTricomplexmatrix at 0x83b4dbc>, <function getTricomplexrotate at 0x83b4df4>, <function getTricomplexscale at 0x83b4e2c>, <function getTricomplexskewX at 0x83b4e64>, <function getTricomplexskewY at 0x83b4e9c>, <function getTricomplextranslate at 0x83b4f44>]
globalNumberOfBezierPoints = 22
globalNumberOfCirclePoints = 44
globalNumberOfCornerPoints = 11
globalProcessPathWordDictionary = {'A': <unbound method PathReader.processPathWordA>, 'C': <unbound method PathReader.processPathWordC>, 'H': <unbound method PathReader.processPathWordH>, 'L': <unbound method PathReader.processPathWordL>, 'M': <unbound method PathReader.processPathWordM>, 'Q': <unbound method PathReader.processPathWordQ>, 'S': <unbound method PathReader.processPathWordS>, 'T': <unbound method PathReader.processPathWordT>, 'V': <unbound method PathReader.processPathWordV>, 'Z': <unbound method PathReader.processPathWordZ>, ...}
globalProcessPathWordFunctions = [<unbound method PathReader.processPathWordA>, <unbound method PathReader.processPathWorda>, <unbound method PathReader.processPathWordC>, <unbound method PathReader.processPathWordc>, <unbound method PathReader.processPathWordH>, <unbound method PathReader.processPathWordh>, <unbound method PathReader.processPathWordL>, <unbound method PathReader.processPathWordl>, <unbound method PathReader.processPathWordM>, <unbound method PathReader.processPathWordm>, <unbound method PathReader.processPathWordQ>, <unbound method PathReader.processPathWordq>, <unbound method PathReader.processPathWordS>, <unbound method PathReader.processPathWords>, <unbound method PathReader.processPathWordT>, <unbound method PathReader.processPathWordt>, <unbound method PathReader.processPathWordV>, <unbound method PathReader.processPathWordv>, <unbound method PathReader.processPathWordZ>, <unbound method PathReader.processPathWordz>]
globalProcessSVGElementDictionary = {'circle': <function processSVGElementcircle at 0x83b4f7c>, 'ellipse': <function processSVGElementellipse at 0x83b4fb4>, 'g': <function processSVGElementg at 0x83be02c>, 'line': <function processSVGElementline at 0x83be064>, 'path': <function processSVGElementpath at 0x83be09c>, 'polygon': <function processSVGElementpolygon at 0x83be0d4>, 'polyline': <function processSVGElementpolyline at 0x83be10c>, 'rect': <function processSVGElementrect at 0x83be144>, 'text': <function processSVGElementtext at 0x83be17c>}
globalProcessSVGElementFunctions = [<function processSVGElementcircle at 0x83b4f7c>, <function processSVGElementellipse at 0x83b4fb4>, <function processSVGElementg at 0x83be02c>, <function processSVGElementline at 0x83be064>, <function processSVGElementpath at 0x83be09c>, <function processSVGElementpolygon at 0x83be0d4>, <function processSVGElementpolyline at 0x83be10c>, <function processSVGElementrect at 0x83be144>, <function processSVGElementtext at 0x83be17c>]
globalSideAngle = 0.14279966607226333

Author
`` |  | Enrique Perez (perez_enrique@yahoo.com)

Credits
`` |  | Nophead <http://hydraraptor.blogspot.com/> Art of Illusion <http://www.artofillusion.org/>