px, pt, in, cm, mm, em, and ex units% unitex unit is an approximation, considering one 1/2 of the em unitem unit does not take into account for the moment the height of the fontssizeType parameter of the LoaderParameters specifies how sizes and dimensions which are not defined in pixels will be managed by the loader:<svg width="210mm" height="297mm" viewBox="0 0 5cm 5cm"> <g id="layer1"> <circle fill="red" cx="2cm" cy="2cm" r="2cm" /> </g> </svg>If we define:
SVGImage img = SVGLoader.load(<my SVG file>);By default the radius of the circle will be 2 centimeters, considering the dpi as 96 pixels per inch.
LoaderParameters params = new LoaderParameters(); params.sizeType = SizeType.FORCED_DPI; params.dpi = 76; SVGImage img = SVGLoader.load(<my SVG file>, params);Then the radius of the circle will be 2 centimeters, considering the dpi as 76 pixels per inch.
with and height attributes are present in the SVG root, they are used to specify the dimensions of the viewportviewBox attribute is present, it will be used to get the width and height of the viewportpath element does not currently support the "%" unit.Copyright 2021-2022 Herve Girod. All Rights Reserved. Documentation and source under the BSD-3-Clause License