net.sf.latexdraw.parsers.svg.parsers
Class SVGLengthParser
java.lang.Object
net.sf.latexdraw.parsers.CodeParser
net.sf.latexdraw.parsers.svg.parsers.AbstractSVGParser
net.sf.latexdraw.parsers.svg.parsers.SVGNumberParser
net.sf.latexdraw.parsers.svg.parsers.SVGLengthParser
- All Implemented Interfaces:
- Parser
public class SVGLengthParser
- extends SVGNumberParser
Defines a parser that parses SVG length code.
This file is part of LaTeXDraw.
Copyright (c) 2005-2012 Arnaud BLOUIN
LaTeXDraw is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
LaTeXDraw is distributed without any warranty; without even the
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the GNU General Public License for more details.
10/24/07
- Version:
- 3.0
- Author:
- Arnaud BLOUIN
Constructor Summary |
SVGLengthParser(java.lang.String code)
The constructor. |
Methods inherited from class net.sf.latexdraw.parsers.CodeParser |
getChar, getCharAt, getCode, getCodeCore, getLinePosition, getPosition, incLinePosition, initialise, isEOC, isEOL, nextChar, setCode, setCodeCore, setLinePosition, setPosition, skipWSPComments |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SVGLengthParser
public SVGLengthParser(java.lang.String code)
- The constructor.
- Parameters:
code
- The code to parse.
fontSizetoPoint
public static float fontSizetoPoint(java.lang.String fontSize)
- Converts the font-size string value in point value.
- Parameters:
fontSize
- The font-size value to convert.
- Returns:
- the font-size value in point, or -1 if a
problem occurs.
parseLength
public SVGLength parseLength()
throws java.text.ParseException
- Parses an SVG length.
- Returns:
- An SVGLength. The length is always converted in PX.
- Throws:
java.text.ParseException
- If a problem occurs or if not managed unit are parsed (%, em and ex).
parseCoordinate
public SVGLength parseCoordinate()
throws java.text.ParseException
- Parses an SVG coordinate.
- Returns:
- An SVGLength.
- Throws:
java.text.ParseException
- If a problem occurs or if not managed unit are parsed (%, em and ex).
parseNumberOrPercent
public SVGLength parseNumberOrPercent()
throws java.text.ParseException
- Parses a number or a percentage (not yet managed).
- Returns:
- An SVGLength.
- Throws:
java.text.ParseException
- If a problem occurs or if a percentage is parsed.