Browse Source

--- Merging r17092 into '.':
U packages/fpvectorial/src/dxfvectorialreader.pas
U packages/fpvectorial/src/fpvectorial.pas
U packages/fpvectorial/src/avisocncgcodewriter.pas
U packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17301 into '.':
G packages/fpvectorial/src/dxfvectorialreader.pas
G packages/fpvectorial/src/fpvectorial.pas
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17382 into '.':
G packages/fpvectorial/src/fpvectorial.pas
U packages/fpvectorial/src/svgvectorialwriter.pas
G packages/fpvectorial/src/fpvtocanvas.pas
U packages/fpvectorial/examples/fpvwritetest.pas
U packages/fpvectorial/examples/fpvwritetest.lpi
--- Merging r17383 into '.':
A packages/fpvectorial/src/fpvutils.pas
--- Merging r17384 into '.':
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17385 into '.':
G packages/fpvectorial/src/fpvectorial.pas
A packages/fpvectorial/src/svgvectorialreader.pas
--- Merging r17428 into '.':
G packages/fpvectorial/src/fpvectorial.pas
U packages/fpvectorial/examples/fpvc_mainform.lfm
U packages/fpvectorial/examples/fpvc_mainform.pas
U packages/fpvectorial/examples/fpvectorialconverter.lpi
--- Merging r17441 into '.':
U packages/fpvectorial/src/svgvectorialreader.pas
U packages/fpvectorial/examples/fpce_mainform.lfm
A packages/fpvectorial/examples/fpvmodifytest.pas
A packages/fpvectorial/examples/fpvmodifytest.lpi
U packages/fpvectorial/examples/fpcorelexplorer.lpi
--- Merging r17693 into '.':
G packages/fpvectorial/src/svgvectorialwriter.pas
U packages/fpvectorial/src/fpvectbuildunit.pas
G packages/fpvectorial/src/fpvectorial.pas
A packages/fpvectorial/src/epsvectorialreader.pas
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17694 into '.':
U packages/fpvectorial/src/fpvutils.pas
G packages/fpvectorial/src/dxfvectorialreader.pas
G packages/fpvectorial/src/fpvectorial.pas
U packages/fpvectorial/src/epsvectorialreader.pas
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17751 into '.':
G packages/fpvectorial/src/fpvectorial.pas
G packages/fpvectorial/src/epsvectorialreader.pas
--- Merging r17761 into '.':
G packages/fpvectorial/src/svgvectorialwriter.pas
G packages/fpvectorial/src/fpvutils.pas
G packages/fpvectorial/src/dxfvectorialreader.pas
G packages/fpvectorial/src/fpvectorial.pas
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17765 into '.':
G packages/fpvectorial/src/svgvectorialwriter.pas
G packages/fpvectorial/src/fpvutils.pas
G packages/fpvectorial/src/dxfvectorialreader.pas
G packages/fpvectorial/src/fpvectorial.pas
G packages/fpvectorial/src/fpvtocanvas.pas
--- Merging r17771 into '.':
U packages/fpvectorial/fpmake.pp
U packages/fpvectorial/Makefile.fpc
C packages/fpvectorial/Makefile
--- Merging r17772 into '.':
C packages/Makefile
C packages/Makefile.fpc
--- Merging r17794 into '.':
G packages/fpvectorial/src/fpvectorial.pas
Summary of conflicts:
Text conflicts: 3

# revisions: 17092,17301,17382,17383,17384,17385,17428,17441,17693,17694,17751,17761,17765,17771,17772,17794
------------------------------------------------------------------------
r17092 | sekelsenmat | 2011-03-08 15:28:26 +0100 (Tue, 08 Mar 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/avisocncgcodewriter.pas
M /trunk/packages/fpvectorial/src/dxfvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas

Fixes compiling avisocncvectorialwriter, adds a dimension entity and multiple improvements to fpvtocanvas and the DXF vectorial reader
------------------------------------------------------------------------
------------------------------------------------------------------------
r17301 | sekelsenmat | 2011-04-11 09:28:30 +0200 (Mon, 11 Apr 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/dxfvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas

fpvectorial: Merges changes, improved DXF reading, adds pen and color data to the data structures
------------------------------------------------------------------------
------------------------------------------------------------------------
r17382 | sekelsenmat | 2011-04-29 13:30:16 +0200 (Fri, 29 Apr 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/examples/fpvwritetest.lpi
M /trunk/packages/fpvectorial/examples/fpvwritetest.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas
M /trunk/packages/fpvectorial/src/svgvectorialwriter.pas

fpvectorial: Merges the implementation of pen, brush and updates the svg output to use the pen
------------------------------------------------------------------------
------------------------------------------------------------------------
r17383 | sekelsenmat | 2011-04-29 13:30:35 +0200 (Fri, 29 Apr 2011) | 1 line
Changed paths:
A /trunk/packages/fpvectorial/src/fpvutils.pas

fpvectorial: Adds a forgotten file
------------------------------------------------------------------------
------------------------------------------------------------------------
r17384 | sekelsenmat | 2011-04-29 13:31:26 +0200 (Fri, 29 Apr 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas

fpvectorial: merges missing part of fpvtocanvas
------------------------------------------------------------------------
------------------------------------------------------------------------
r17385 | sekelsenmat | 2011-04-29 15:28:39 +0200 (Fri, 29 Apr 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/fpvectorial.pas
A /trunk/packages/fpvectorial/src/svgvectorialreader.pas

fpvectorial: Adds a SVG reader and adds a new convinience file reading function
------------------------------------------------------------------------
------------------------------------------------------------------------
r17428 | sekelsenmat | 2011-05-10 17:19:59 +0200 (Tue, 10 May 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/examples/fpvc_mainform.lfm
M /trunk/packages/fpvectorial/examples/fpvc_mainform.pas
M /trunk/packages/fpvectorial/examples/fpvectorialconverter.lpi
M /trunk/packages/fpvectorial/src/fpvectorial.pas

fpvectorial: adds new overloaded read/write methods which auto-detect the format
------------------------------------------------------------------------
------------------------------------------------------------------------
r17441 | sekelsenmat | 2011-05-13 14:01:40 +0200 (Fri, 13 May 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/examples/fpce_mainform.lfm
M /trunk/packages/fpvectorial/examples/fpcorelexplorer.lpi
A /trunk/packages/fpvectorial/examples/fpvmodifytest.lpi
A /trunk/packages/fpvectorial/examples/fpvmodifytest.pas
M /trunk/packages/fpvectorial/src/svgvectorialreader.pas

fpvectorial: Improves the svg reader and adds a file modification example
------------------------------------------------------------------------
------------------------------------------------------------------------
r17693 | sekelsenmat | 2011-06-08 14:45:46 +0200 (Wed, 08 Jun 2011) | 1 line
Changed paths:
A /trunk/packages/fpvectorial/src/epsvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectbuildunit.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas
M /trunk/packages/fpvectorial/src/svgvectorialwriter.pas

fpvectorial: Merges the initial eps reader and some font, pen and brush improvements
------------------------------------------------------------------------
------------------------------------------------------------------------
r17694 | sekelsenmat | 2011-06-08 15:54:52 +0200 (Wed, 08 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/dxfvectorialreader.pas
M /trunk/packages/fpvectorial/src/epsvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas
M /trunk/packages/fpvectorial/src/fpvutils.pas

fpvectorial: Improves the pen width and the EPS reader
------------------------------------------------------------------------
------------------------------------------------------------------------
r17751 | sekelsenmat | 2011-06-14 16:15:45 +0200 (Tue, 14 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/epsvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas

fpvectorial: Basic implementation of the PostScript support
------------------------------------------------------------------------
------------------------------------------------------------------------
r17761 | sekelsenmat | 2011-06-16 12:36:03 +0200 (Thu, 16 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/dxfvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas
M /trunk/packages/fpvectorial/src/fpvutils.pas
M /trunk/packages/fpvectorial/src/svgvectorialwriter.pas

fpvectorial: Adds brush support for the svg writer and changes fpvectorial to use TFPColor instead of its own color
------------------------------------------------------------------------
------------------------------------------------------------------------
r17765 | sekelsenmat | 2011-06-17 11:52:19 +0200 (Fri, 17 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/dxfvectorialreader.pas
M /trunk/packages/fpvectorial/src/fpvectorial.pas
M /trunk/packages/fpvectorial/src/fpvtocanvas.pas
M /trunk/packages/fpvectorial/src/fpvutils.pas
M /trunk/packages/fpvectorial/src/svgvectorialwriter.pas

fpvectorial: Major rework, joined all 3 lists of elements into a single list in order to use it to keep the Z-Order
------------------------------------------------------------------------
------------------------------------------------------------------------
r17771 | marco | 2011-06-20 11:16:29 +0200 (Mon, 20 Jun 2011) | 3 lines
Changed paths:
M /trunk/packages/fpvectorial/Makefile
M /trunk/packages/fpvectorial/Makefile.fpc
M /trunk/packages/fpvectorial/fpmake.pp

* two new units added to make file and fpmake. Probably only matters for
installing and cleaning

------------------------------------------------------------------------
------------------------------------------------------------------------
r17772 | marco | 2011-06-20 12:39:46 +0200 (Mon, 20 Jun 2011) | 3 lines
Changed paths:
M /trunk/packages/Makefile
M /trunk/packages/Makefile.fpc

* enable fpvectorial for all OS (shouldn't have OS specific dependancies) and
add -j functionality to packages/Make*

------------------------------------------------------------------------
------------------------------------------------------------------------
r17794 | sekelsenmat | 2011-06-22 14:35:57 +0200 (Wed, 22 Jun 2011) | 1 line
Changed paths:
M /trunk/packages/fpvectorial/src/fpvectorial.pas

fpvectorial: adds an entity to contain raster images
------------------------------------------------------------------------

git-svn-id: branches/fixes_2_4@17795 -

marco 14 years ago
parent
commit
f4dadbfd5b

+ 5 - 0
.gitattributes

@@ -1935,6 +1935,8 @@ packages/fpvectorial/examples/fpvc_mainform.pas svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.ico -text
 packages/fpvectorial/examples/fpvectorialconverter.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvectorialconverter.lpr svneol=native#text/plain
+packages/fpvectorial/examples/fpvmodifytest.lpi svneol=native#text/plain
+packages/fpvectorial/examples/fpvmodifytest.pas svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.lpi svneol=native#text/plain
 packages/fpvectorial/examples/fpvwritetest.pas svneol=native#text/plain
 packages/fpvectorial/fpmake.pp svneol=native#text/plain
@@ -1943,13 +1945,16 @@ packages/fpvectorial/src/avisocncgcodewriter.pas svneol=native#text/pascal
 packages/fpvectorial/src/avisozlib.pas svneol=native#text/pascal
 packages/fpvectorial/src/cdrvectorialreader.pas svneol=native#text/pascal
 packages/fpvectorial/src/dxfvectorialreader.pas svneol=native#text/pascal
+packages/fpvectorial/src/epsvectorialreader.pas svneol=native#text/pascal
 packages/fpvectorial/src/fpvectbuildunit.pas svneol=native#text/pascal
 packages/fpvectorial/src/fpvectorial.pas svneol=native#text/pascal
 packages/fpvectorial/src/fpvtocanvas.pas svneol=native#text/pascal
+packages/fpvectorial/src/fpvutils.pas svneol=native#text/pascal
 packages/fpvectorial/src/pdfvectorialreader.pas svneol=native#text/pascal
 packages/fpvectorial/src/pdfvrlexico.pas svneol=native#text/pascal
 packages/fpvectorial/src/pdfvrsemantico.pas svneol=native#text/pascal
 packages/fpvectorial/src/pdfvrsintatico.pas svneol=native#text/pascal
+packages/fpvectorial/src/svgvectorialreader.pas svneol=native#text/pascal
 packages/fpvectorial/src/svgvectorialwriter.pas svneol=native#text/pascal
 packages/fuse/Makefile svneol=native#text/plain
 packages/fuse/Makefile.fpc svneol=native#text/plain

+ 295 - 64
packages/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/02/22]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/06/12]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -245,7 +245,7 @@ endif
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
 endif
-ifeq ($(OS_TARGET),darwin)
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
 ifeq ($(OS_SOURCE),darwin)
 DARWIN2DARWIN=1
 endif
@@ -264,185 +264,217 @@ ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPCFPMAKE=$(FPC)
+endif
+endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph libc unixutil graph pxlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph libc unixutil graph pxlib bzip2
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv graph unzip gdbint
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv graph unzip gdbint
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra  oggvorbis sdl openssl graph pcap httpd13 httpd20 httpd22 pxlib numlib winceunits cairo libxml gmp opencl ptc libsee nvapi
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint libpng mad tcl opengl gtk1 gtk2 librsvg a52 cdrom fpgtk openal fftw lua fcl-extra  oggvorbis sdl openssl graph pcap httpd13 httpd20 httpd22 pxlib numlib winceunits cairo libxml gmp opencl ptc libsee nvapi
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib iconvenc
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv zlib unzip
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv zlib unzip
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms  gnome1 httpd13 httpd20 httpd22 imlib opengles objcrtl opencl openal
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms  gnome1 httpd13 httpd20 httpd22 imlib opengles objcrtl opencl openal
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv zlib libpng x11 tcl fpgtk rexx os2units gtk1 imlib
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv zlib unzip
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv zlib unzip
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  amunits
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  amunits
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc  postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  palmunits
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  palmunits
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  amunits
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  amunits
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib objcrtl
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint graph sdl opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib objcrtl
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv opengl sdl
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv opengl sdl
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 gtk2 librsvg bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick gdbint libpng x11 gdbm tcl syslog libcurl opengl cairo  bfd aspell svgalib imlib utmp  fpgtk xforms fftw pcap ggi sdl openssl graph gnome1 gtk1 gtk2 librsvg httpd13 httpd20 httpd22 pxlib numlib users iconvenc gmp fcl-extra libxml
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng x11 gdbm tcl syslog libcurl opengl cairo gtk1 bfd svgalib fcl-extra imlib utmp  fpgtk xforms fftw pcap ggi  openssl gnome1 httpd13 httpd20 httpd22 numlib iconvenc gtk2 cairo
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl ptc graph nvapi
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv winunits-base winunits-jedi fcl-web fastcgi ibase mysql zlib oracle odbc postgres sqlite imagemagick gdbint tcl opengl gtk1 fpgtk fftw sdl openssl cdrom httpd13 httpd20 httpd22 numlib fcl-extra opencl ptc graph nvapi
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  palmunits
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  palmunits
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint httpd13 httpd20 httpd22 opengles objcrtl
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint httpd13 httpd20 httpd22 opengles objcrtl
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  winceunits httpd22 fcl-web fastcgi tcl fftw unzip zlib sqlite mysql ibase postgres oracle odbc sdl openssl oggvorbis numlib
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee graph
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses zlib oracle odbc postgres sqlite pthreads imagemagick libpng gdbm tcl syslog libcurl bfd aspell utmp fftw pcap openssl numlib iconvenc gmp fcl-extra univint opengl x11 cairo gtk1 gtk2 librsvg fpgtk xforms gnome1 httpd13 httpd20 httpd22 imlib
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee
+override TARGET_DIRS+=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial  fv fcl-web fastcgi fcl-async ibase mysql ncurses unzip zlib oracle dbus odbc postgres sqlite pthreads imagemagick gdbint libpng x11 uuid ldap modplug dts mad  gdbm tcl syslog libcurl opengl opencl cairo gtk1 gtk2 librsvg a52 bfd aspell svgalib newt cdrom users  iconvenc libxml proj4 fcl-extra imlib utmp  fpgtk openal lua oggvorbis xforms fftw pcap ggi sdl openssl gnome1 httpd13 httpd20 httpd22 pxlib numlib gmp ptc libsee
 endif
 override INSTALL_FPCPACKAGE=y
 override INSTALL_FPCSUBDIR=packages
@@ -773,7 +805,7 @@ DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 IMPORTLIBPREFIX=imp
 endif
-ifeq ($(OS_TARGET),darwin)
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
 BATCHEXT=.sh
 EXEEXT=
 HASSHAREDLIB=1
@@ -788,6 +820,15 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1461,6 +1502,7 @@ fpc_baseinfo:
 	@$(ECHO)  Full Target.. $(FULL_TARGET)
 	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
 	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
 	@$(ECHO)
 	@$(ECHO)  == Directory info ==
 	@$(ECHO)
@@ -1572,6 +1614,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -1643,6 +1686,7 @@ TARGET_DIRS_LIBC=1
 TARGET_DIRS_UNIXUTIL=1
 TARGET_DIRS_GRAPH=1
 TARGET_DIRS_PXLIB=1
+TARGET_DIRS_BZIP2=1
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
 TARGET_DIRS_HASH=1
@@ -1668,6 +1712,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_GRAPH=1
 TARGET_DIRS_UNZIP=1
@@ -1697,6 +1742,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_WINUNITS-BASE=1
 TARGET_DIRS_WINUNITS-JEDI=1
@@ -1768,6 +1814,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_LIBPNG=1
@@ -1803,6 +1850,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -1878,6 +1926,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -1949,6 +1998,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2020,6 +2070,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2089,6 +2140,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2156,6 +2208,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),i386-netware)
 TARGET_DIRS_HASH=1
@@ -2181,6 +2234,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_UNZIP=1
@@ -2209,6 +2263,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2278,6 +2333,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
 TARGET_DIRS_HASH=1
@@ -2303,6 +2359,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2377,6 +2434,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_LIBPNG=1
@@ -2412,6 +2470,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
 TARGET_DIRS_HASH=1
@@ -2437,6 +2496,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_ZLIB=1
 TARGET_DIRS_UNZIP=1
@@ -2465,6 +2525,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_WINCEUNITS=1
 TARGET_DIRS_HTTPD22=1
 TARGET_DIRS_FCL-WEB=1
@@ -2508,6 +2569,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
 TARGET_DIRS_HASH=1
@@ -2533,6 +2595,59 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+TARGET_DIRS_HASH=1
+TARGET_DIRS_PASJPEG=1
+TARGET_DIRS_PASZLIB=1
+TARGET_DIRS_FPMKUNIT=1
+TARGET_DIRS_FCL-XML=1
+TARGET_DIRS_FCL-BASE=1
+TARGET_DIRS_FCL-DB=1
+TARGET_DIRS_FCL-IMAGE=1
+TARGET_DIRS_FCL-NET=1
+TARGET_DIRS_FCL-PASSRC=1
+TARGET_DIRS_FCL-REGISTRY=1
+TARGET_DIRS_FCL-FPCUNIT=1
+TARGET_DIRS_FCL-JSON=1
+TARGET_DIRS_FCL-JS=1
+TARGET_DIRS_FCL-PROCESS=1
+TARGET_DIRS_UNZIP=1
+TARGET_DIRS_REGEXPR=1
+TARGET_DIRS_CHM=1
+TARGET_DIRS_FCL-RES=1
+TARGET_DIRS_LIBGD=1
+TARGET_DIRS_SYMBOLIC=1
+TARGET_DIRS_BZIP2=1
+TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+TARGET_DIRS_HASH=1
+TARGET_DIRS_PASJPEG=1
+TARGET_DIRS_PASZLIB=1
+TARGET_DIRS_FPMKUNIT=1
+TARGET_DIRS_FCL-XML=1
+TARGET_DIRS_FCL-BASE=1
+TARGET_DIRS_FCL-DB=1
+TARGET_DIRS_FCL-IMAGE=1
+TARGET_DIRS_FCL-NET=1
+TARGET_DIRS_FCL-PASSRC=1
+TARGET_DIRS_FCL-REGISTRY=1
+TARGET_DIRS_FCL-FPCUNIT=1
+TARGET_DIRS_FCL-JSON=1
+TARGET_DIRS_FCL-JS=1
+TARGET_DIRS_FCL-PROCESS=1
+TARGET_DIRS_UNZIP=1
+TARGET_DIRS_REGEXPR=1
+TARGET_DIRS_CHM=1
+TARGET_DIRS_FCL-RES=1
+TARGET_DIRS_LIBGD=1
+TARGET_DIRS_SYMBOLIC=1
+TARGET_DIRS_BZIP2=1
+TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
 TARGET_DIRS_HASH=1
@@ -2558,6 +2673,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2650,6 +2766,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2725,6 +2842,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2794,6 +2912,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_AMUNITS=1
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
@@ -2820,6 +2939,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
 TARGET_DIRS_HASH=1
@@ -2845,6 +2965,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -2914,6 +3035,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_PALMUNITS=1
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
@@ -2940,6 +3062,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
 TARGET_DIRS_HASH=1
@@ -2965,6 +3088,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3057,6 +3181,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3126,6 +3251,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_AMUNITS=1
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
@@ -3152,6 +3278,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
 TARGET_DIRS_HASH=1
@@ -3177,6 +3304,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3248,6 +3376,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_OPENGL=1
 TARGET_DIRS_SDL=1
@@ -3276,6 +3405,33 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+TARGET_DIRS_HASH=1
+TARGET_DIRS_PASJPEG=1
+TARGET_DIRS_PASZLIB=1
+TARGET_DIRS_FPMKUNIT=1
+TARGET_DIRS_FCL-XML=1
+TARGET_DIRS_FCL-BASE=1
+TARGET_DIRS_FCL-DB=1
+TARGET_DIRS_FCL-IMAGE=1
+TARGET_DIRS_FCL-NET=1
+TARGET_DIRS_FCL-PASSRC=1
+TARGET_DIRS_FCL-REGISTRY=1
+TARGET_DIRS_FCL-FPCUNIT=1
+TARGET_DIRS_FCL-JSON=1
+TARGET_DIRS_FCL-JS=1
+TARGET_DIRS_FCL-PROCESS=1
+TARGET_DIRS_UNZIP=1
+TARGET_DIRS_REGEXPR=1
+TARGET_DIRS_CHM=1
+TARGET_DIRS_FCL-RES=1
+TARGET_DIRS_LIBGD=1
+TARGET_DIRS_SYMBOLIC=1
+TARGET_DIRS_BZIP2=1
+TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
 TARGET_DIRS_HASH=1
@@ -3301,6 +3457,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3393,6 +3550,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3462,6 +3620,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3529,6 +3688,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
 TARGET_DIRS_HASH=1
@@ -3554,6 +3714,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3646,6 +3807,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3721,6 +3883,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3788,6 +3951,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -3856,6 +4020,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_WINUNITS-BASE=1
 TARGET_DIRS_WINUNITS-JEDI=1
@@ -3912,6 +4077,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),arm-linux)
 TARGET_DIRS_HASH=1
@@ -3937,6 +4103,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -4029,6 +4196,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_PALMUNITS=1
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
@@ -4055,6 +4223,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -4115,6 +4284,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_WINCEUNITS=1
 TARGET_DIRS_HTTPD22=1
 TARGET_DIRS_FCL-WEB=1
@@ -4158,6 +4328,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),arm-nds)
 TARGET_DIRS_HASH=1
@@ -4183,6 +4354,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
 TARGET_DIRS_HASH=1
@@ -4208,6 +4380,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
 TARGET_DIRS_HASH=1
@@ -4233,6 +4406,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
 TARGET_DIRS_HASH=1
@@ -4258,6 +4432,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -4350,6 +4525,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -4418,6 +4594,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
 TARGET_DIRS_HASH=1
@@ -4443,6 +4620,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
 TARGET_DIRS_HASH=1
@@ -4468,6 +4646,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -4559,6 +4738,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
 TARGET_DIRS_HASH=1
@@ -4584,6 +4764,7 @@ TARGET_DIRS_LIBGD=1
 TARGET_DIRS_SYMBOLIC=1
 TARGET_DIRS_BZIP2=1
 TARGET_DIRS_HERMES=1
+TARGET_DIRS_FPVECTORIAL=1
 TARGET_DIRS_FV=1
 TARGET_DIRS_FCL-WEB=1
 TARGET_DIRS_FASTCGI=1
@@ -5686,6 +5867,51 @@ hermes:
 	$(MAKE) -C hermes all
 .PHONY: hermes_all hermes_debug hermes_smart hermes_release hermes_units hermes_examples hermes_shared hermes_install hermes_sourceinstall hermes_exampleinstall hermes_distinstall hermes_zipinstall hermes_zipsourceinstall hermes_zipexampleinstall hermes_zipdistinstall hermes_clean hermes_distclean hermes_cleanall hermes_info hermes_makefiles hermes
 endif
+ifdef TARGET_DIRS_FPVECTORIAL
+fpvectorial_all:
+	$(MAKE) -C fpvectorial all
+fpvectorial_debug:
+	$(MAKE) -C fpvectorial debug
+fpvectorial_smart:
+	$(MAKE) -C fpvectorial smart
+fpvectorial_release:
+	$(MAKE) -C fpvectorial release
+fpvectorial_units:
+	$(MAKE) -C fpvectorial units
+fpvectorial_examples:
+	$(MAKE) -C fpvectorial examples
+fpvectorial_shared:
+	$(MAKE) -C fpvectorial shared
+fpvectorial_install:
+	$(MAKE) -C fpvectorial install
+fpvectorial_sourceinstall:
+	$(MAKE) -C fpvectorial sourceinstall
+fpvectorial_exampleinstall:
+	$(MAKE) -C fpvectorial exampleinstall
+fpvectorial_distinstall:
+	$(MAKE) -C fpvectorial distinstall
+fpvectorial_zipinstall:
+	$(MAKE) -C fpvectorial zipinstall
+fpvectorial_zipsourceinstall:
+	$(MAKE) -C fpvectorial zipsourceinstall
+fpvectorial_zipexampleinstall:
+	$(MAKE) -C fpvectorial zipexampleinstall
+fpvectorial_zipdistinstall:
+	$(MAKE) -C fpvectorial zipdistinstall
+fpvectorial_clean:
+	$(MAKE) -C fpvectorial clean
+fpvectorial_distclean:
+	$(MAKE) -C fpvectorial distclean
+fpvectorial_cleanall:
+	$(MAKE) -C fpvectorial cleanall
+fpvectorial_info:
+	$(MAKE) -C fpvectorial info
+fpvectorial_makefiles:
+	$(MAKE) -C fpvectorial makefiles
+fpvectorial:
+	$(MAKE) -C fpvectorial all
+.PHONY: fpvectorial_all fpvectorial_debug fpvectorial_smart fpvectorial_release fpvectorial_units fpvectorial_examples fpvectorial_shared fpvectorial_install fpvectorial_sourceinstall fpvectorial_exampleinstall fpvectorial_distinstall fpvectorial_zipinstall fpvectorial_zipsourceinstall fpvectorial_zipexampleinstall fpvectorial_zipdistinstall fpvectorial_clean fpvectorial_distclean fpvectorial_cleanall fpvectorial_info fpvectorial_makefiles fpvectorial
+endif
 ifdef TARGET_DIRS_FV
 fv_all:
 	$(MAKE) -C fv all
@@ -9324,6 +9550,11 @@ fcl-image_debug: fcl-base_debug paszlib_debug pasjpeg_debug
 fcl-image_smart: fcl-base_smart paszlib_smart pasjpeg_smart
 fcl-image_release: fcl-base_release paszlib_release pasjpeg_release
 fcl-image_shared: fcl-base_shared paszlib_shared pasjpeg_shared
+fpvectorial_all: fcl-image_all  
+fpvectorial_debug: fcl-image_debug  
+fpvectorial_smart: fcl-image_smart  
+fpvectorial_release: fcl-image_release 
+fpvectorial_shared: fcl-image_shared  
 fcl-fpcunit_all: fcl-xml_all paszlib_all
 fcl-fpcunit_debug: fcl-xml_debug paszlib_debug
 fcl-fpcunit_smart: fcl-xml_smart paszlib_smart

+ 8 - 2
packages/Makefile.fpc

@@ -4,8 +4,8 @@
 #
 
 [target]
-dirs=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes
-dirs_linux_i386=libc unixutil graph pxlib 
+dirs=hash pasjpeg paszlib fpmkunit fcl-xml fcl-base fcl-db fcl-image fcl-net fcl-passrc fcl-registry fcl-fpcunit fcl-json fcl-js fcl-process unzip regexpr chm fcl-res libgd symbolic bzip2 hermes fpvectorial
+dirs_linux_i386=libc unixutil graph pxlib bzip2
 dirs_i386_linux=graph
 dirs_x86_64_linux=graph
 dirs_powerpc_linux=graph
@@ -145,6 +145,12 @@ fcl-image_smart: fcl-base_smart paszlib_smart pasjpeg_smart
 fcl-image_release: fcl-base_release paszlib_release pasjpeg_release
 fcl-image_shared: fcl-base_shared paszlib_shared pasjpeg_shared
 
+fpvectorial_all: fcl-image_all  
+fpvectorial_debug: fcl-image_debug  
+fpvectorial_smart: fcl-image_smart  
+fpvectorial_release: fcl-image_release 
+fpvectorial_shared: fcl-image_shared  
+
 fcl-fpcunit_all: fcl-xml_all paszlib_all
 fcl-fpcunit_debug: fcl-xml_debug paszlib_debug
 fcl-fpcunit_smart: fcl-xml_smart paszlib_smart

+ 241 - 64
packages/fpvectorial/Makefile

@@ -1,8 +1,8 @@
 #
-# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/02/22]
+# Don't edit, this file is generated by FPCMake Version 2.0.0 [2011/06/12]
 #
 default: all
-MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
+MAKEFILETARGETS=i386-linux i386-go32v2 i386-win32 i386-os2 i386-freebsd i386-beos i386-haiku i386-netbsd i386-solaris i386-qnx i386-netware i386-openbsd i386-wdosx i386-darwin i386-emx i386-watcom i386-netwlibc i386-wince i386-embedded i386-symbian i386-nativent i386-iphonesim m68k-linux m68k-freebsd m68k-netbsd m68k-amiga m68k-atari m68k-openbsd m68k-palmos m68k-embedded powerpc-linux powerpc-netbsd powerpc-amiga powerpc-macos powerpc-darwin powerpc-morphos powerpc-embedded powerpc-wii sparc-linux sparc-netbsd sparc-solaris sparc-embedded x86_64-linux x86_64-freebsd x86_64-solaris x86_64-darwin x86_64-win64 x86_64-embedded arm-linux arm-palmos arm-darwin arm-wince arm-gba arm-nds arm-embedded arm-symbian powerpc64-linux powerpc64-darwin powerpc64-embedded avr-embedded armeb-linux armeb-embedded mipsel-linux
 BSDs = freebsd netbsd openbsd darwin
 UNIXs = linux $(BSDs) solaris qnx haiku
 LIMIT83fs = go32v2 os2 emx watcom
@@ -245,7 +245,7 @@ endif
 ifndef CROSSBINDIR
 CROSSBINDIR:=$(wildcard $(FPCDIR)/bin/$(TARGETSUFFIX))
 endif
-ifeq ($(OS_TARGET),darwin)
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
 ifeq ($(OS_SOURCE),darwin)
 DARWIN2DARWIN=1
 endif
@@ -264,6 +264,29 @@ ifeq ($(UNITSDIR),)
 UNITSDIR:=$(wildcard $(FPCDIR)/units/$(OS_TARGET))
 endif
 PACKAGESDIR:=$(wildcard $(FPCDIR) $(FPCDIR)/packages $(FPCDIR)/packages/base $(FPCDIR)/packages/extra)
+ifndef FPCFPMAKE
+ifdef CROSSCOMPILE
+ifeq ($(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR)))),)
+FPCPROG:=$(strip $(wildcard $(addsuffix /fpc$(SRCEXEEXT),$(SEARCHPATH))))
+ifneq ($(FPCPROG),)
+FPCPROG:=$(firstword $(FPCPROG))
+FPCFPMAKE:=$(shell $(FPCPROG) -PB)
+ifeq ($(strip $(wildcard $(FPCFPMAKE))),)
+FPCFPMAKE:=$(firstword $(FPCPROG))
+endif
+else
+override FPCFPMAKE=$(firstword $(strip $(wildcard $(addsuffix /ppc386$(SRCEXEEXT),$(SEARCHPATH)))))
+endif
+else
+FPCFPMAKE=$(strip $(wildcard $(addsuffix /compiler/ppc$(SRCEXEEXT),$(FPCDIR))))
+FPMAKE_SKIP_CONFIG=-n
+export FPCFPMAKE
+export FPMAKE_SKIP_CONFIG
+endif
+else
+FPCFPMAKE=$(FPC)
+endif
+endif
 override PACKAGE_NAME=fpvectorial
 override PACKAGE_VERSION=2.4.5
 ifeq ($(FULL_TARGET),i386-linux)
@@ -326,6 +349,12 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override TARGET_UNITS+=fpvectbuildunit
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_UNITS+=fpvectbuildunit
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_UNITS+=fpvectbuildunit
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override TARGET_UNITS+=fpvectbuildunit
 endif
@@ -371,6 +400,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 override TARGET_UNITS+=fpvectbuildunit
 endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_UNITS+=fpvectbuildunit
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override TARGET_UNITS+=fpvectbuildunit
 endif
@@ -447,184 +479,193 @@ ifeq ($(FULL_TARGET),mipsel-linux)
 override TARGET_UNITS+=fpvectbuildunit
 endif
 ifeq ($(FULL_TARGET),i386-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-go32v2)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-win32)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-os2)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-freebsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-beos)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-haiku)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-netbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-solaris)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-qnx)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-netware)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-openbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-wdosx)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-darwin)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-emx)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-watcom)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-netwlibc)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-wince)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),i386-symbian)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
+endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-freebsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-netbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-amiga)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-atari)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-openbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-palmos)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),m68k-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-netbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-amiga)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-macos)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-darwin)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-morphos)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
+endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),sparc-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),sparc-netbsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),sparc-solaris)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),sparc-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-freebsd)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-solaris)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-darwin)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-win64)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),x86_64-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-palmos)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-darwin)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-wince)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-gba)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-nds)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),arm-symbian)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc64-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc64-darwin)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),powerpc64-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),avr-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),armeb-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),armeb-embedded)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 ifeq ($(FULL_TARGET),mipsel-linux)
-override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter
+override TARGET_IMPLICITUNITS+=avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 endif
 override INSTALL_BUILDUNIT=fpvectbuildunit
 override INSTALL_FPCPACKAGE=y
@@ -688,6 +729,12 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override COMPILER_INCLUDEDIR+=src
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_INCLUDEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_INCLUDEDIR+=src
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_INCLUDEDIR+=src
 endif
@@ -733,6 +780,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 override COMPILER_INCLUDEDIR+=src
 endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_INCLUDEDIR+=src
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_INCLUDEDIR+=src
 endif
@@ -868,6 +918,12 @@ endif
 ifeq ($(FULL_TARGET),i386-symbian)
 override COMPILER_SOURCEDIR+=src
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+override COMPILER_SOURCEDIR+=src
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+override COMPILER_SOURCEDIR+=src
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 override COMPILER_SOURCEDIR+=src
 endif
@@ -913,6 +969,9 @@ endif
 ifeq ($(FULL_TARGET),powerpc-embedded)
 override COMPILER_SOURCEDIR+=src
 endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+override COMPILER_SOURCEDIR+=src
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 override COMPILER_SOURCEDIR+=src
 endif
@@ -1348,7 +1407,7 @@ DEBUGSYMEXT=.xcoff
 SHORTSUFFIX=mac
 IMPORTLIBPREFIX=imp
 endif
-ifeq ($(OS_TARGET),darwin)
+ifneq ($(findstring $(OS_TARGET),darwin iphonesim),)
 BATCHEXT=.sh
 EXEEXT=
 HASSHAREDLIB=1
@@ -1363,6 +1422,15 @@ ifeq ($(OS_TARGET),symbian)
 SHAREDLIBEXT=.dll
 SHORTSUFFIX=symbian
 endif
+ifeq ($(OS_TARGET),NativeNT)
+SHAREDLIBEXT=.dll
+SHORTSUFFIX=nativent
+endif
+ifeq ($(OS_TARGET),wii)
+EXEEXT=.dol
+SHAREDLIBEXT=.so
+SHORTSUFFIX=wii
+endif
 else
 ifeq ($(OS_TARGET),go32v1)
 PPUEXT=.pp1
@@ -1949,6 +2017,22 @@ REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-IMAGE=1
 endif
+ifeq ($(FULL_TARGET),i386-nativent)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASJPEG=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-IMAGE=1
+endif
+ifeq ($(FULL_TARGET),i386-iphonesim)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASJPEG=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-IMAGE=1
+endif
 ifeq ($(FULL_TARGET),m68k-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASJPEG=1
@@ -2070,6 +2154,14 @@ REQUIRE_PACKAGES_PASZLIB=1
 REQUIRE_PACKAGES_FCL-BASE=1
 REQUIRE_PACKAGES_FCL-IMAGE=1
 endif
+ifeq ($(FULL_TARGET),powerpc-wii)
+REQUIRE_PACKAGES_RTL=1
+REQUIRE_PACKAGES_PASJPEG=1
+REQUIRE_PACKAGES_HASH=1
+REQUIRE_PACKAGES_PASZLIB=1
+REQUIRE_PACKAGES_FCL-BASE=1
+REQUIRE_PACKAGES_FCL-IMAGE=1
+endif
 ifeq ($(FULL_TARGET),sparc-linux)
 REQUIRE_PACKAGES_RTL=1
 REQUIRE_PACKAGES_PASJPEG=1
@@ -2281,6 +2373,15 @@ UNITDIR_RTL=$(PACKAGEDIR_RTL)/units/$(TARGETSUFFIX)
 else
 UNITDIR_RTL=$(PACKAGEDIR_RTL)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_RTL=$(PACKAGEDIR_RTL)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_RTL)/$(OS_TARGET)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_RTL)/$(OS_TARGET) $(FPCMADE)
@@ -2298,6 +2399,9 @@ endif
 ifdef UNITDIR_RTL
 override COMPILER_UNITDIR+=$(UNITDIR_RTL)
 endif
+ifdef UNITDIR_FPMAKE_RTL
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_RTL)
+endif
 endif
 ifdef REQUIRE_PACKAGES_PASJPEG
 PACKAGEDIR_PASJPEG:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /pasjpeg/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2307,6 +2411,15 @@ UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(TARGETSUFFIX)
 else
 UNITDIR_PASJPEG=$(PACKAGEDIR_PASJPEG)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASJPEG=$(PACKAGEDIR_PASJPEG)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_PASJPEG)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASJPEG=$(PACKAGEDIR_PASJPEG)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_PASJPEG=$(PACKAGEDIR_PASJPEG)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_PASJPEG)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_PASJPEG) $(FPCMADE)
@@ -2324,6 +2437,9 @@ endif
 ifdef UNITDIR_PASJPEG
 override COMPILER_UNITDIR+=$(UNITDIR_PASJPEG)
 endif
+ifdef UNITDIR_FPMAKE_PASJPEG
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_PASJPEG)
+endif
 endif
 ifdef REQUIRE_PACKAGES_HASH
 PACKAGEDIR_HASH:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /hash/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2333,6 +2449,15 @@ UNITDIR_HASH=$(PACKAGEDIR_HASH)/units/$(TARGETSUFFIX)
 else
 UNITDIR_HASH=$(PACKAGEDIR_HASH)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_HASH=$(PACKAGEDIR_HASH)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_HASH)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_HASH) $(FPCMADE)
@@ -2350,6 +2475,9 @@ endif
 ifdef UNITDIR_HASH
 override COMPILER_UNITDIR+=$(UNITDIR_HASH)
 endif
+ifdef UNITDIR_FPMAKE_HASH
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_HASH)
+endif
 endif
 ifdef REQUIRE_PACKAGES_PASZLIB
 PACKAGEDIR_PASZLIB:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /paszlib/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2359,6 +2487,15 @@ UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(TARGETSUFFIX)
 else
 UNITDIR_PASZLIB=$(PACKAGEDIR_PASZLIB)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_PASZLIB=$(PACKAGEDIR_PASZLIB)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_PASZLIB)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_PASZLIB) $(FPCMADE)
@@ -2376,6 +2513,9 @@ endif
 ifdef UNITDIR_PASZLIB
 override COMPILER_UNITDIR+=$(UNITDIR_PASZLIB)
 endif
+ifdef UNITDIR_FPMAKE_PASZLIB
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_PASZLIB)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-BASE
 PACKAGEDIR_FCL-BASE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-base/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2385,6 +2525,15 @@ UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-BASE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-BASE=$(PACKAGEDIR_FCL-BASE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-BASE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-BASE) $(FPCMADE)
@@ -2402,6 +2551,9 @@ endif
 ifdef UNITDIR_FCL-BASE
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-BASE)
 endif
+ifdef UNITDIR_FPMAKE_FCL-BASE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-BASE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_FCL-IMAGE
 PACKAGEDIR_FCL-IMAGE:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /fcl-image/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2411,6 +2563,15 @@ UNITDIR_FCL-IMAGE=$(PACKAGEDIR_FCL-IMAGE)/units/$(TARGETSUFFIX)
 else
 UNITDIR_FCL-IMAGE=$(PACKAGEDIR_FCL-IMAGE)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_FCL-IMAGE)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-IMAGE=$(PACKAGEDIR_FCL-IMAGE)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_FCL-IMAGE)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_FCL-IMAGE=$(PACKAGEDIR_FCL-IMAGE)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_FCL-IMAGE=$(PACKAGEDIR_FCL-IMAGE)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_FCL-IMAGE)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_FCL-IMAGE) $(FPCMADE)
@@ -2428,6 +2589,9 @@ endif
 ifdef UNITDIR_FCL-IMAGE
 override COMPILER_UNITDIR+=$(UNITDIR_FCL-IMAGE)
 endif
+ifdef UNITDIR_FPMAKE_FCL-IMAGE
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_FCL-IMAGE)
+endif
 endif
 ifdef REQUIRE_PACKAGES_UNIVINT
 PACKAGEDIR_UNIVINT:=$(firstword $(subst /Makefile.fpc,,$(strip $(wildcard $(addsuffix /univint/Makefile.fpc,$(PACKAGESDIR))))))
@@ -2437,6 +2601,15 @@ UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(TARGETSUFFIX)
 else
 UNITDIR_UNIVINT=$(PACKAGEDIR_UNIVINT)
 endif
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)/units/$(SOURCESUFFIX)
+else
+ifneq ($(wildcard $(PACKAGEDIR_UNIVINT)/units_bs/$(SOURCESUFFIX)),)
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)/units_bs/$(SOURCESUFFIX)
+else
+UNITDIR_FPMAKE_UNIVINT=$(PACKAGEDIR_UNIVINT)
+endif
+endif
 ifdef CHECKDEPEND
 $(PACKAGEDIR_UNIVINT)/$(FPCMADE):
 	$(MAKE) -C $(PACKAGEDIR_UNIVINT) $(FPCMADE)
@@ -2454,6 +2627,9 @@ endif
 ifdef UNITDIR_UNIVINT
 override COMPILER_UNITDIR+=$(UNITDIR_UNIVINT)
 endif
+ifdef UNITDIR_FPMAKE_UNIVINT
+override COMPILER_FPMAKE_UNITDIR+=$(UNITDIR_FPMAKE_UNIVINT)
+endif
 endif
 ifndef NOCPUDEF
 override FPCOPTDEF=$(ARCH)
@@ -2949,6 +3125,7 @@ fpc_baseinfo:
 	@$(ECHO)  Full Target.. $(FULL_TARGET)
 	@$(ECHO)  SourceSuffix. $(SOURCESUFFIX)
 	@$(ECHO)  TargetSuffix. $(TARGETSUFFIX)
+	@$(ECHO)  FPC fpmake... $(FPCFPMAKE)
 	@$(ECHO)
 	@$(ECHO)  == Directory info ==
 	@$(ECHO)

+ 1 - 1
packages/fpvectorial/Makefile.fpc

@@ -15,7 +15,7 @@ units=fpvectbuildunit
 exampledirs=
 implicitunits= avisocncgcodereader avisocncgcodewriter avisozlib fpvectorial \
 	       fpvtocanvas  pdfvectorialreader pdfvrlexico pdfvrsemantico \
-	       pdfvrsintatico cdrvectorialreader svgvectorialwriter
+	       pdfvrsintatico cdrvectorialreader svgvectorialwriter epsvectorialreader fpvutils
 
 [compiler]
 includedir=src

+ 9 - 9
packages/fpvectorial/examples/fpce_mainform.lfm

@@ -6,12 +6,12 @@ object formCorelExplorer: TformCorelExplorer
   Caption = 'FP Corel Explorer'
   ClientHeight = 345
   ClientWidth = 466
-  LCLVersion = '0.9.29'
+  LCLVersion = '0.9.31'
   object Label1: TLabel
     Left = 8
-    Height = 14
+    Height = 17
     Top = 40
-    Width = 123
+    Width = 160
     Caption = 'Location of the Input file:'
     ParentColor = False
   end
@@ -37,25 +37,25 @@ object formCorelExplorer: TformCorelExplorer
   end
   object labelFilename: TLabel
     Left = 256
-    Height = 14
+    Height = 17
     Top = 65
-    Width = 47
+    Width = 61
     Caption = 'Filename:'
     ParentColor = False
   end
   object labelVersion: TLabel
     Left = 256
-    Height = 14
+    Height = 17
     Top = 88
-    Width = 40
+    Width = 53
     Caption = 'Version:'
     ParentColor = False
   end
   object labelSize: TLabel
     Left = 256
-    Height = 14
+    Height = 17
     Top = 112
-    Width = 24
+    Width = 31
     Caption = 'Size:'
     ParentColor = False
   end

+ 5 - 4
packages/fpvectorial/examples/fpcorelexplorer.lpi

@@ -4,10 +4,8 @@
     <Version Value="9"/>
     <PathDelim Value="\"/>
     <General>
-      <Flags>
-        <AlwaysBuild Value="False"/>
-      </Flags>
       <SessionStorage Value="InProjectDir"/>
+      <MainUnit Value="0"/>
       <Title Value="fpcorelexplorer"/>
       <UseXPManifest Value="True"/>
       <Icon Value="0"/>
@@ -18,6 +16,9 @@
     <VersionInfo>
       <StringTable ProductVersion=""/>
     </VersionInfo>
+    <BuildModes Count="1">
+      <Item1 Name="default" Default="True"/>
+    </BuildModes>
     <PublishOptions>
       <Version Value="2"/>
       <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@@ -55,7 +56,7 @@
       <Filename Value="fpcorelexplorer"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir)\"/>
+      <IncludeFiles Value="$(ProjOutDir)"/>
       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     <Linking>

+ 2 - 2
packages/fpvectorial/examples/fpvc_mainform.lfm

@@ -12,7 +12,7 @@ object formVectorialConverter: TformVectorialConverter
     Left = 8
     Height = 18
     Top = 112
-    Width = 172
+    Width = 158
     Caption = 'Location of the Input file:'
     ParentColor = False
   end
@@ -45,7 +45,7 @@ object formVectorialConverter: TformVectorialConverter
     Left = 8
     Height = 18
     Top = 152
-    Width = 184
+    Width = 169
     Caption = 'Full path of the Output file:'
     ParentColor = False
   end

+ 3 - 6
packages/fpvectorial/examples/fpvc_mainform.pas

@@ -59,7 +59,7 @@ begin
 
   Vec := TvVectorialDocument.Create;
   try
-    Vec.ReadFromFile(editInput.FileName, vfPDF);
+    Vec.ReadFromFile(editInput.FileName);
     imagePreview.Canvas.Brush.Color := clWhite;
     imagePreview.Canvas.FillRect(0, 0, imagePreview.Width, imagePreview.Height);
     DrawFPVectorialToCanvas(Vec, imagePreview.Canvas);
@@ -76,7 +76,6 @@ end;
 procedure TformVectorialConverter.buttonConvertClick(Sender: TObject);
 var
   Vec: TvVectorialDocument;
-  lFormat: TvVectorialFormat;
 begin
   // First check the in input
   if not CheckInput() then Exit;
@@ -84,10 +83,8 @@ begin
   // Now convert
   Vec := TvVectorialDocument.Create;
   try
-    lFormat := TvVectorialDocument.GetFormatFromExtension(editInput.FileName);
-    Vec.ReadFromFile(editInput.FileName, lFormat);
-    lFormat := TvVectorialDocument.GetFormatFromExtension(editOutPut.FileName);
-    Vec.WriteToFile(editOutPut.FileName, lFormat);
+    Vec.ReadFromFile(editInput.FileName);
+    Vec.WriteToFile(editOutPut.FileName);
   finally
     Vec.Free;
   end;

+ 2 - 4
packages/fpvectorial/examples/fpvectorialconverter.lpi

@@ -4,9 +4,6 @@
     <Version Value="9"/>
     <PathDelim Value="\"/>
     <General>
-      <Flags>
-        <AlwaysBuild Value="False"/>
-      </Flags>
       <SessionStorage Value="InProjectDir"/>
       <MainUnit Value="0"/>
       <Title Value="fpvectorialconverter"/>
@@ -30,6 +27,7 @@
     <RunParams>
       <local>
         <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
       </local>
     </RunParams>
     <RequiredPackages Count="1">
@@ -53,7 +51,7 @@
     </Units>
   </ProjectOptions>
   <CompilerOptions>
-    <Version Value="9"/>
+    <Version Value="10"/>
     <PathDelim Value="\"/>
     <Target>
       <Filename Value="fpvectorialconverter"/>

+ 201 - 0
packages/fpvectorial/examples/fpvmodifytest.lpi

@@ -0,0 +1,201 @@
+<?xml version="1.0"?>
+<CONFIG>
+  <ProjectOptions>
+    <Version Value="9"/>
+    <General>
+      <Flags>
+        <MainUnitHasCreateFormStatements Value="False"/>
+        <MainUnitHasTitleStatement Value="False"/>
+      </Flags>
+      <MainUnit Value="0"/>
+      <Title Value="fpvmodifytest"/>
+      <ResourceType Value="res"/>
+      <UseXPManifest Value="True"/>
+      <Icon Value="0"/>
+      <ActiveWindowIndexAtStart Value="0"/>
+    </General>
+    <i18n>
+      <EnableI18N LFM="False"/>
+    </i18n>
+    <VersionInfo>
+      <StringTable ProductVersion=""/>
+    </VersionInfo>
+    <BuildModes Count="1" Active="Default">
+      <Item1 Name="Default" Default="True"/>
+    </BuildModes>
+    <PublishOptions>
+      <Version Value="2"/>
+      <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+      <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+    </PublishOptions>
+    <RunParams>
+      <local>
+        <FormatVersion Value="1"/>
+      </local>
+    </RunParams>
+    <Units Count="4">
+      <Unit0>
+        <Filename Value="fpvmodifytest.pas"/>
+        <IsPartOfProject Value="True"/>
+        <UnitName Value="fpvmodifytest"/>
+        <IsVisibleTab Value="True"/>
+        <EditorIndex Value="0"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="1"/>
+        <CursorPos X="1" Y="10"/>
+        <UsageCount Value="22"/>
+        <Loaded Value="True"/>
+      </Unit0>
+      <Unit1>
+        <Filename Value="fpvectorial.pas"/>
+        <UnitName Value="fpvectorial"/>
+        <EditorIndex Value="3"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="135"/>
+        <CursorPos X="18" Y="148"/>
+        <UsageCount Value="11"/>
+        <Loaded Value="True"/>
+      </Unit1>
+      <Unit2>
+        <Filename Value="svgvectorialwriter.pas"/>
+        <UnitName Value="svgvectorialwriter"/>
+        <EditorIndex Value="2"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="14"/>
+        <CursorPos X="1" Y="32"/>
+        <UsageCount Value="11"/>
+        <Loaded Value="True"/>
+      </Unit2>
+      <Unit3>
+        <Filename Value="svgvectorialreader.pas"/>
+        <UnitName Value="svgvectorialreader"/>
+        <EditorIndex Value="1"/>
+        <WindowIndex Value="0"/>
+        <TopLine Value="250"/>
+        <CursorPos X="1" Y="263"/>
+        <UsageCount Value="11"/>
+        <Loaded Value="True"/>
+      </Unit3>
+    </Units>
+    <JumpHistory Count="23" HistoryIndex="22">
+      <Position1>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="301" Column="1" TopLine="297"/>
+      </Position1>
+      <Position2>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="269" Column="1" TopLine="249"/>
+      </Position2>
+      <Position3>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="232" Column="74" TopLine="219"/>
+      </Position3>
+      <Position4>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="51" Column="30" TopLine="36"/>
+      </Position4>
+      <Position5>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="297" Column="45" TopLine="296"/>
+      </Position5>
+      <Position6>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="53" Column="19" TopLine="38"/>
+      </Position6>
+      <Position7>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="236" Column="3" TopLine="226"/>
+      </Position7>
+      <Position8>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="240" Column="1" TopLine="226"/>
+      </Position8>
+      <Position9>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="241" Column="1" TopLine="226"/>
+      </Position9>
+      <Position10>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="242" Column="1" TopLine="226"/>
+      </Position10>
+      <Position11>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="51" Column="50" TopLine="36"/>
+      </Position11>
+      <Position12>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="54" Column="39" TopLine="38"/>
+      </Position12>
+      <Position13>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="272" Column="1" TopLine="252"/>
+      </Position13>
+      <Position14>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="271" Column="44" TopLine="246"/>
+      </Position14>
+      <Position15>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="257" Column="1" TopLine="246"/>
+      </Position15>
+      <Position16>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="258" Column="1" TopLine="246"/>
+      </Position16>
+      <Position17>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="259" Column="1" TopLine="246"/>
+      </Position17>
+      <Position18>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="260" Column="1" TopLine="246"/>
+      </Position18>
+      <Position19>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="261" Column="1" TopLine="246"/>
+      </Position19>
+      <Position20>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="262" Column="1" TopLine="246"/>
+      </Position20>
+      <Position21>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="275" Column="1" TopLine="250"/>
+      </Position21>
+      <Position22>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="265" Column="1" TopLine="250"/>
+      </Position22>
+      <Position23>
+        <Filename Value="svgvectorialreader.pas"/>
+        <Caret Line="266" Column="1" TopLine="250"/>
+      </Position23>
+    </JumpHistory>
+  </ProjectOptions>
+  <CompilerOptions>
+    <Version Value="10"/>
+    <Target>
+      <Filename Value="fpvmodifytest"/>
+    </Target>
+    <SearchPaths>
+      <IncludeFiles Value="$(ProjOutDir)"/>
+      <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
+    </SearchPaths>
+    <Other>
+      <CompilerPath Value="$(CompPath)"/>
+    </Other>
+  </CompilerOptions>
+  <Debugging>
+    <Exceptions Count="3">
+      <Item1>
+        <Name Value="EAbort"/>
+      </Item1>
+      <Item2>
+        <Name Value="ECodetoolError"/>
+      </Item2>
+      <Item3>
+        <Name Value="EFOpenError"/>
+      </Item3>
+    </Exceptions>
+  </Debugging>
+</CONFIG>

+ 62 - 0
packages/fpvectorial/examples/fpvmodifytest.pas

@@ -0,0 +1,62 @@
+{
+Author: Felipe Monteiro de Carvalho
+
+License: Public Domain
+}
+program fpvmodifytest;
+
+{$mode objfpc}{$H+}
+
+uses
+  fpvectorial, svgvectorialwriter, svgvectorialreader, fpvutils;
+
+const
+  cFormat = vfSVG;
+  cExtension = '.svg';
+var
+  Vec: TvVectorialDocument;
+  Path: TPath;
+  i: Integer;
+  Segment: TPathSegment;
+  _2DSegment: T2DSegment;
+  BezSegment: T2DBezierSegment;
+begin
+  Vec := TvVectorialDocument.Create;
+  try
+    // Read the file
+    Vec.ReadFromFile('bezier_1.svg');
+
+    // Now add 10 to the Y coordinate of all elements
+    for i := 0 to Vec.GetPathCount() - 1 do
+    begin
+      Path := Vec.GetPath(i);
+      Path.PrepareForSequentialReading();
+      Path.Next();
+      while Path.CurPoint <> nil do
+      begin
+        Segment := Path.CurPoint;
+
+        if Segment is T2DBezierSegment then
+        begin
+          BezSegment := Segment as T2DBezierSegment;
+          BezSegment.Y := BezSegment.Y + 10;
+          BezSegment.Y2 := BezSegment.Y2 + 10;
+          BezSegment.Y3 := BezSegment.Y3 + 10;
+        end
+        else if Segment is T2DSegment then
+        begin
+          _2DSegment := Segment as T2DSegment;
+          _2DSegment.Y := _2DSegment.Y + 10;
+        end;
+
+        Path.Next();
+      end;
+    end;
+
+    // Write the changed file to disk
+    Vec.WriteToFile('bezier_1_mod' + cExtension, cFormat);
+  finally
+    Vec.Free;
+  end;
+end.
+

+ 6 - 3
packages/fpvectorial/examples/fpvwritetest.lpi

@@ -13,7 +13,6 @@
       <Title Value="fpvwritetest"/>
       <ResourceType Value="res"/>
       <UseXPManifest Value="True"/>
-      <Icon Value="0"/>
     </General>
     <i18n>
       <EnableI18N LFM="False"/>
@@ -21,6 +20,9 @@
     <VersionInfo>
       <StringTable ProductVersion=""/>
     </VersionInfo>
+    <BuildModes Count="1">
+      <Item1 Name="default" Default="True"/>
+    </BuildModes>
     <PublishOptions>
       <Version Value="2"/>
       <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@@ -29,6 +31,7 @@
     <RunParams>
       <local>
         <FormatVersion Value="1"/>
+        <LaunchingApplication PathPlusParams="\usr\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
       </local>
     </RunParams>
     <Units Count="1">
@@ -40,13 +43,13 @@
     </Units>
   </ProjectOptions>
   <CompilerOptions>
-    <Version Value="9"/>
+    <Version Value="10"/>
     <PathDelim Value="\"/>
     <Target>
       <Filename Value="fpvwritetest"/>
     </Target>
     <SearchPaths>
-      <IncludeFiles Value="$(ProjOutDir)\"/>
+      <IncludeFiles Value="$(ProjOutDir)"/>
       <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
     </SearchPaths>
     <Other>

+ 46 - 1
packages/fpvectorial/examples/fpvwritetest.pas

@@ -22,7 +22,7 @@ program fpvwritetest;
 {$mode objfpc}{$H+}
 
 uses
-  fpvectorial, svgvectorialwriter;
+  fpvectorial, svgvectorialwriter, fpvutils;
 
 const
   cFormat = vfSVG;
@@ -134,6 +134,51 @@ begin
     Vec.AddText(20, 20, 0, '20, 20 Mówić, cześć, Włosku, Parabéns.');
     Vec.AddText(30, 30, 0, '30, 30 森林,是一个高密');
     Vec.WriteToFile('multi_test_1' + cExtension, cFormat);
+
+    // pen_test_1     Tests the properties of the Pen
+    Vec.Clear;
+    Vec.StartPath(0, 20);
+    Vec.AddLineToPath(30, 30);
+    Vec.SetPenWidth(10);
+    Vec.EndPath();
+    Vec.StartPath(0, 0);
+    Vec.AddLineToPath(100, 0);
+    Vec.AddLineToPath(100, 100);
+    Vec.AddLineToPath(0, 100);
+    Vec.AddLineToPath(0, 0);
+    Vec.SetPenWidth(10);
+    Vec.EndPath();
+    Vec.StartPath(0, 0);
+    Vec.AddLineToPath(10, 10);
+    Vec.AddBezierToPath(10, 20, 20, 20, 20, 10);
+    Vec.AddLineToPath(30, 0);
+    Vec.SetPenWidth(10);
+    Vec.EndPath();
+    Vec.WriteToFile('pen_test_1' + cExtension, cFormat);
+
+    // pen_test_2     Tests the properties of the Pen
+    Vec.Clear;
+    Vec.StartPath(0, 20);
+    Vec.AddLineToPath(30, 30);
+    Vec.SetPenWidth(10);
+    Vec.SetPenColor(RGBToVColor(255, 0, 0));
+    Vec.EndPath();
+    Vec.StartPath(0, 0);
+    Vec.AddLineToPath(100, 0);
+    Vec.AddLineToPath(100, 100);
+    Vec.AddLineToPath(0, 100);
+    Vec.AddLineToPath(0, 0);
+    Vec.SetPenWidth(10);
+    Vec.SetPenColor(RGBToVColor(0, 255, 0));
+    Vec.EndPath();
+    Vec.StartPath(0, 0);
+    Vec.AddLineToPath(10, 10);
+    Vec.AddBezierToPath(10, 20, 20, 20, 20, 10);
+    Vec.AddLineToPath(30, 0);
+    Vec.SetPenWidth(10);
+    Vec.SetPenColor(RGBToVColor(0, 0, 255));
+    Vec.EndPath();
+    Vec.WriteToFile('pen_test_2' + cExtension, cFormat);
   finally
     Vec.Free;
   end;

+ 2 - 1
packages/fpvectorial/fpmake.pp

@@ -38,7 +38,8 @@ begin
     T:=P.Targets.AddImplicitUnit('pdfvectorialreader'); 
     T:=P.Targets.AddImplicitUnit('pdfvrlexico'); 
     T:=P.Targets.AddImplicitUnit('pdfvrsemantico');
-    T:=P.Targets.AddImplicitUnit('pdfvrsintaticoa');
+    T:=P.Targets.AddImplicitUnit('epsvectorialreader');
+    T:=P.Targets.AddImplicitUnit('fpvutils');
 
     // Build unit depending on all implicit units
     TBuild:=P.Targets.AddUnit('fpvectbuildunit.pas');

+ 31 - 13
packages/fpvectorial/src/avisocncgcodewriter.pas

@@ -36,6 +36,10 @@ var
   i, j: Integer;
   Str: string;
   APath: TPath;
+  CurSegment: T2DSegment;
+  Cur3DSegment: T3DSegment;
+  Cur2DBezierSegment: T2DBezierSegment;
+  Cur3DBezierSegment: T3DBezierSegment;
 begin
   AStrings.Clear;
 
@@ -51,25 +55,39 @@ begin
     // levanta a broca
     AStrings.Add('P01 // Sobe a cabeça de gravação');
     // vai para o ponto inicial
+    CurSegment := T2DSegment(APath.Points);
     AStrings.Add(Format('G01 X%f Y%f',
-      [APath.Points[0].X, APath.Points[0].Y]));
+      [CurSegment.X, CurSegment.Y]));
     AStrings.Add('P02 // Abaixa a cabeça de gravação');
 
     for j := 1 to APath.Len - 1 do
     begin
-      case APath.Points[j].SegmentType of
+      CurSegment := T2DSegment(CurSegment.Next);
+      case CurSegment.SegmentType of
       st2DLine: AStrings.Add(Format('G01 X%f Y%f',
-         [APath.Points[j].X, APath.Points[j].Y]));
-      st3DLine: AStrings.Add(Format('G01 X%f Y%f Z%f',
-         [APath.Points[j].X, APath.Points[j].Y, APath.Points[j].Z]));
-      st2DBezier: AStrings.Add(Format('B02 X%f Y%f X%f Y%f X%f Y%f',
-         [APath.Points[j].X2, APath.Points[j].Y2,
-          APath.Points[j].X3, APath.Points[j].Y3,
-          APath.Points[j].X, APath.Points[j].Y]));
-      st3DBezier: AStrings.Add(Format('B03 X%f Y%f Z%f X%f Y%f Z%f X%f Y%f Z%f',
-         [APath.Points[j].X2, APath.Points[j].Y2, APath.Points[j].Z2,
-          APath.Points[j].X3, APath.Points[j].Y3, APath.Points[j].Z3,
-          APath.Points[j].X, APath.Points[j].Y, APath.Points[j].Z]));
+         [CurSegment.X, CurSegment.Y]));
+      st3DLine:
+      begin
+        Cur3DSegment := T3DSegment(CurSegment);
+        AStrings.Add(Format('G01 X%f Y%f Z%f',
+         [Cur3DSegment.X, Cur3DSegment.Y, Cur3DSegment.Z]));
+      end;
+      st2DBezier:
+      begin
+        Cur2DBezierSegment := T2DBezierSegment(CurSegment);
+        AStrings.Add(Format('B02 X%f Y%f X%f Y%f X%f Y%f',
+         [Cur2DBezierSegment.X2, Cur2DBezierSegment.Y2,
+          Cur2DBezierSegment.X3, Cur2DBezierSegment.Y3,
+          Cur2DBezierSegment.X, Cur2DBezierSegment.Y]));
+      end;
+      st3DBezier:
+      begin
+        Cur3DBezierSegment := T3DBezierSegment(CurSegment);
+        AStrings.Add(Format('B03 X%f Y%f Z%f X%f Y%f Z%f X%f Y%f Z%f',
+         [Cur3DBezierSegment.X2, Cur3DBezierSegment.Y2, Cur3DBezierSegment.Z2,
+          Cur3DBezierSegment.X3, Cur3DBezierSegment.Y3, Cur3DBezierSegment.Z3,
+          Cur3DBezierSegment.X, Cur3DBezierSegment.Y, Cur3DBezierSegment.Z]));
+      end;
       end;
     end;
   end;

+ 624 - 51
packages/fpvectorial/src/dxfvectorialreader.pas

@@ -29,14 +29,10 @@ unit dxfvectorialreader;
 interface
 
 uses
-  Classes, SysUtils,
-  fpvectorial;
+  Classes, SysUtils, Math,
+  fpvectorial, fpimage, fpvutils;
 
 type
-
-  { Used by tcutils.SeparateString }
-  T10Strings = array[0..9] of shortstring;
-
   TDXFToken = class;
 
   TDXFTokens = TFPList;// TDXFToken;
@@ -51,6 +47,20 @@ type
     Destructor Destroy; override;
   end;
 
+  TPolylineElement = record
+    X, Y: Double;
+    Color: TFPColor;
+  end;
+
+  TSPLineElement = record
+    X, Y: Double;
+    KnotValue: Integer;
+  end;
+
+  TLWPOLYLINEElement = record
+    X, Y: Double;
+  end;
+
   { TDXFTokenizer }
 
   TDXFTokenizer = class
@@ -70,16 +80,31 @@ type
     // HEADER data
     ANGBASE: Double;
     ANGDIR: Integer;
+    INSBASE, EXTMIN, EXTMAX, LIMMIN, LIMMAX: T3DPoint;
+    // Calculated HEADER data
+    DOC_OFFSET: T3DPoint; // The DOC_OFFSET compensates for documents with huge coordinates
+    // For building the POLYLINE objects which is composed of multiple records
+    IsReadingPolyline: Boolean;
+    Polyline: array of TPolylineElement;
     //
-    function  SeparateString(AString: string; ASeparator: Char): T10Strings;
     procedure ReadHEADER(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES_LINE(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES_ARC(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES_CIRCLE(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_DIMENSION(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES_ELLIPSE(ATokens: TDXFTokens; AData: TvVectorialDocument);
     procedure ReadENTITIES_TEXT(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_LWPOLYLINE(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_SPLINE(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_POLYLINE(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_VERTEX(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_SEQEND(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_MTEXT(ATokens: TDXFTokens; AData: TvVectorialDocument);
+    procedure ReadENTITIES_POINT(ATokens: TDXFTokens; AData: TvVectorialDocument);
     function  GetCoordinateValue(AStr: shortstring): Double;
+    //
+    function DXFColorIndexToFPColor(AColorIndex: Integer): TFPColor;
   public
     { General reading methods }
     Tokenizer: TDXFTokenizer;
@@ -98,11 +123,17 @@ const
   // Items in the HEADER section
 
   // $ACADVER
-  DXF_AUTOCAD_R10         = 'AC1006'; // 1988
-  DXF_AUTOCAD_R11_and_R12 = 'AC1009'; // 1990
+  DXF_AUTOCAD_2010        = 'AC1024'; // AutoCAD 2011 and 2012 too
+  DXF_AUTOCAD_2007        = 'AC1021'; // AutoCAD 2008 and 2009 too
+  DXF_AUTOCAD_2004        = 'AC1018'; // AutoCAD 2005 and 2006 too
+  DXF_AUTOCAD_2000        = 'AC1015'; // 1999  In some docs it is proposed as AC1500, but in practice I found AC1015
+                                      // http://www.autodesk.com/techpubs/autocad/acad2000/dxf/
+                                      // AutoCAD 2000i and 2002 too
+  DXF_AUTOCAD_R14         = 'AC1014'; // 1997  http://www.autodesk.com/techpubs/autocad/acadr14/dxf/index.htm
   DXF_AUTOCAD_R13         = 'AC1012'; // 1994
-  DXF_AUTOCAD_R14         = 'AC1009'; // 1997  http://www.autodesk.com/techpubs/autocad/acadr14/dxf/index.htm
-  DXF_AUTOCAD_2000        = 'AC1500'; // 1999  http://www.autodesk.com/techpubs/autocad/acad2000/dxf/
+  DXF_AUTOCAD_R11_and_R12 = 'AC1009'; // 1990
+  DXF_AUTOCAD_R10         = 'AC1006'; // 1988
+  DXF_AUTOCAD_R9          = 'AC1004';
 
   // Group Codes for ENTITIES
   DXF_ENTITIES_TYPE = 0;
@@ -113,6 +144,28 @@ const
   DXF_ENTITIES_MODEL_OR_PAPER_SPACE = 67; // default=0=model, 1=paper
   DXF_ENTITIES_VISIBILITY = 60; // default=0 = Visible, 1 = Invisible
 
+  // Obtained from http://www.generalcadd.com/pdf/LivingWithAutoCAD_v4.pdf
+  // Valid for DXF up to AutoCad 2004, after that RGB is available
+  AUTOCAD_COLOR_PALETTE: array[0..15] of TFPColor =
+  (
+    (Red: $0000; Green: $0000; Blue: $0000; Alpha: alphaOpaque), // 0 - Black
+    (Red: $0000; Green: $0000; Blue: $8080; Alpha: alphaOpaque), // 1 - Dark blue
+    (Red: $0000; Green: $8080; Blue: $0000; Alpha: alphaOpaque), // 2 - Dark green
+    (Red: $0000; Green: $8080; Blue: $8080; Alpha: alphaOpaque), // 3 - Dark cyan
+    (Red: $8080; Green: $0000; Blue: $0000; Alpha: alphaOpaque), // 4 - Dark red
+    (Red: $8080; Green: $0000; Blue: $8080; Alpha: alphaOpaque), // 5 - Dark Magenta
+    (Red: $8080; Green: $8080; Blue: $0000; Alpha: alphaOpaque), // 6 - Dark
+    (Red: $c0c0; Green: $c0c0; Blue: $c0c0; Alpha: alphaOpaque), // 7 - Light Gray
+    (Red: $8080; Green: $8080; Blue: $8080; Alpha: alphaOpaque), // 8 - Medium Gray
+    (Red: $0000; Green: $0000; Blue: $ffff; Alpha: alphaOpaque), // 9 - Light blue
+    (Red: $0000; Green: $ffff; Blue: $0000; Alpha: alphaOpaque), // 10 - Light green
+    (Red: $0000; Green: $ffff; Blue: $ffff; Alpha: alphaOpaque), // 11 - Light cyan
+    (Red: $ffff; Green: $0000; Blue: $0000; Alpha: alphaOpaque), // 12 - Light red
+    (Red: $ffff; Green: $0000; Blue: $ffff; Alpha: alphaOpaque), // 13 - Light Magenta
+    (Red: $ffff; Green: $ffff; Blue: $0000; Alpha: alphaOpaque), // 14 - Light Yellow
+    (Red: $ffff; Green: $ffff; Blue: $ffff; Alpha: alphaOpaque)  // 15 - White
+  );
+
 { TDXFToken }
 
 constructor TDXFToken.Create;
@@ -290,44 +343,12 @@ end;
 
 { TvDXFVectorialReader }
 
-{@@
-  Reads a string and separates it in substring
-  using ASeparator to delimite them.
-
-  Limits:
-
-  Number of substrings: 10 (indexed 0 to 9)
-  Length of each substring: 255 (they are shortstrings)
-}
-function TvDXFVectorialReader.SeparateString(AString: string; ASeparator: Char): T10Strings;
-var
-  i, CurrentPart: Integer;
-begin
-  CurrentPart := 0;
-
-  { Clears the result }
-  for i := 0 to 9 do Result[i] := '';
-
-  { Iterates througth the string, filling strings }
-  for i := 1 to Length(AString) do
-  begin
-    if Copy(AString, i, 1) = ASeparator then
-    begin
-      Inc(CurrentPart);
-
-      { Verifies if the string capacity wasn't exceeded }
-      if CurrentPart > 9 then Exit;
-    end
-    else
-      Result[CurrentPart] := Result[CurrentPart] + Copy(AString, i, 1);
-  end;
-end;
-
 procedure TvDXFVectorialReader.ReadHEADER(ATokens: TDXFTokens;
   AData: TvVectorialDocument);
 var
-  i: Integer;
+  i, j: Integer;
   CurToken: TDXFToken;
+  CurField: P3DPoint;
 begin
   i := 0;
   while i < ATokens.Count do
@@ -344,10 +365,71 @@ begin
       CurToken := TDXFToken(ATokens.Items[i+1]);
       ANGDIR := StrToInt(CurToken.StrValue);
       Inc(i);
+    end
+    // This indicates the size of the document
+    else if (CurToken.StrValue = '$INSBASE') or
+      (CurToken.StrValue = '$EXTMIN') or (CurToken.StrValue = '$EXTMAX') or
+      (CurToken.StrValue = '$LIMMIN') or (CurToken.StrValue = '$LIMMAX') then
+    begin
+      if (CurToken.StrValue = '$INSBASE') then CurField := @INSBASE
+      else if (CurToken.StrValue = '$EXTMIN') then CurField := @EXTMIN
+      else if (CurToken.StrValue = '$EXTMAX') then CurField := @EXTMAX
+      else if (CurToken.StrValue = '$LIMMIN') then CurField := @LIMMIN
+      else if (CurToken.StrValue = '$LIMMAX') then CurField := @LIMMAX;
+
+      // Check the next 2 items and verify if they are the values of the size of the document
+      for j := 0 to 1 do
+      begin
+        CurToken := TDXFToken(ATokens.Items[i+1]);
+        case CurToken.GroupCode of
+        10:
+        begin;
+          CurField^.X := StrToFloat(CurToken.StrValue, FPointSeparator);
+          Inc(i);
+        end;
+        20:
+        begin
+          CurField^.Y := StrToFloat(CurToken.StrValue, FPointSeparator);
+          Inc(i);
+        end;
+        end;
+      end;
     end;
 
     Inc(i);
   end;
+
+  // After getting all the data, we can try to make some sense out of it
+
+  // Sometimes EXTMIN comes as 10^20 and EXTMAX as -10^20, which makes no sence
+  // In these cases we need to ignore them.
+  if (EXTMIN.X > 10000000000) or (EXTMIN.X < -10000000000)
+  or (EXTMAX.X > 10000000000) or (EXTMAX.X < -10000000000) then
+  begin
+    DOC_OFFSET.X := 0;
+    DOC_OFFSET.Y := 0;
+
+    AData.Width := LIMMAX.X;
+    AData.Height := LIMMAX.Y;
+  end
+  else
+  begin
+    // The size of the document seams to be given by:
+    // DOC_SIZE = min(EXTMAX, LIMMAX) - DOC_OFFSET;
+    // if EXTMIN is <> -infinite then DOC_OFFSET = EXTMIN else DOC_OFFSET = (0, 0)
+    // We will shift the whole document so that it has only positive coordinates and
+    // DOC_OFFSET will be utilized for that
+
+    if EXTMIN.X > -100 then
+    begin
+      DOC_OFFSET.X := EXTMIN.X;
+      DOC_OFFSET.Y := EXTMIN.Y;
+    end
+    else FillChar(DOC_OFFSET, sizeof(T3DPoint), #0);
+
+    AData.Width := min(EXTMAX.X, LIMMAX.X) - DOC_OFFSET.X;
+    AData.Height := min(EXTMAX.Y, LIMMAX.Y) - DOC_OFFSET.Y;
+  end;
 end;
 
 procedure TvDXFVectorialReader.ReadENTITIES(ATokens: TDXFTokens; AData: TvVectorialDocument);
@@ -355,14 +437,34 @@ var
   i: Integer;
   CurToken: TDXFToken;
 begin
+  IsReadingPolyline := False;
+
   for i := 0 to ATokens.Count - 1 do
   begin
     CurToken := TDXFToken(ATokens.Items[i]);
     if CurToken.StrValue = 'ARC' then ReadENTITIES_ARC(CurToken.Childs, AData)
     else if CurToken.StrValue = 'CIRCLE' then ReadENTITIES_CIRCLE(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'DIMENSION' then ReadENTITIES_DIMENSION(CurToken.Childs, AData)
     else if CurToken.StrValue = 'ELLIPSE' then ReadENTITIES_ELLIPSE(CurToken.Childs, AData)
     else if CurToken.StrValue = 'LINE' then ReadENTITIES_LINE(CurToken.Childs, AData)
-    else if CurToken.StrValue = 'TEXT' then
+    else if CurToken.StrValue = 'TEXT' then ReadENTITIES_TEXT(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'LWPOLYLINE' then ReadENTITIES_LWPOLYLINE(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'SPLINE' then ReadENTITIES_SPLINE(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'POINT' then ReadENTITIES_POINT(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'MTEXT' then ReadENTITIES_MTEXT(CurToken.Childs, AData)
+    // A Polyline can have multiple child objects
+    else if CurToken.StrValue = 'POLYLINE' then
+    begin
+      IsReadingPolyline := True;
+      ReadENTITIES_POLYLINE(CurToken.Childs, AData);
+    end
+    else if CurToken.StrValue = 'VERTEX' then ReadENTITIES_VERTEX(CurToken.Childs, AData)
+    else if CurToken.StrValue = 'SEQEND' then
+    begin
+      ReadENTITIES_SEQEND(CurToken.Childs, AData);
+      IsReadingPolyline := False;
+    end
+    else
     begin
       // ...
     end;
@@ -376,6 +478,7 @@ var
   // LINE
   LineStartX, LineStartY, LineStartZ: Double;
   LineEndX, LineEndY, LineEndZ: Double;
+  LLineColor: TFPColor;
 begin
   // Initial values
   LineStartX := 0;
@@ -384,6 +487,7 @@ begin
   LineEndX := 0;
   LineEndY := 0;
   LineEndZ := 0;
+  LLineColor := colBlack;
 
   for i := 0 to ATokens.Count - 1 do
   begin
@@ -391,7 +495,7 @@ begin
     CurToken := TDXFToken(ATokens.Items[i]);
 
     // Avoid an exception by previously checking if the conversion can be made
-    if CurToken.GroupCode in [10, 20, 30, 11, 21, 31] then
+    if CurToken.GroupCode in [10, 20, 30, 11, 21, 31, 62] then
     begin
       CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
     end;
@@ -403,19 +507,28 @@ begin
       11: LineEndX := CurToken.FloatValue;
       21: LineEndY := CurToken.FloatValue;
       31: LineEndZ := CurToken.FloatValue;
+      62: LLineColor := DXFColorIndexToFPColor(Trunc(CurToken.FloatValue));
     end;
   end;
 
+  // Position fixing for documents with negative coordinates
+  LineStartX := LineStartX - DOC_OFFSET.X;
+  LineStartY := LineStartY - DOC_OFFSET.Y;
+  LineEndX := LineEndX - DOC_OFFSET.X;
+  LineEndY := LineEndY - DOC_OFFSET.Y;
+
   // And now write it
   {$ifdef FPVECTORIALDEBUG}
-  WriteLn(Format('Adding Line from %f,%f to %f,%f', [LineStartX, LineStartY, LineEndX, LineEndY]));
+ // WriteLn(Format('Adding Line from %f,%f to %f,%f', [LineStartX, LineStartY, LineEndX, LineEndY]));
   {$endif}
   AData.StartPath(LineStartX, LineStartY);
-  AData.AddLineToPath(LineEndX, LineEndY);
+  AData.AddLineToPath(LineEndX, LineEndY, LLineColor);
   AData.EndPath();
 end;
 
 {
+Arcs are always counter-clockwise in DXF
+
 100 Subclass marker (AcDbCircle)
 39 Thickness (optional; default = 0)
 10 Center point (in OCS) DXF: X value; APP: 3D point
@@ -433,6 +546,7 @@ var
   CurToken: TDXFToken;
   i: Integer;
   CenterX, CenterY, CenterZ, Radius, StartAngle, EndAngle: Double;
+  LColor: TFPColor;
 begin
   CenterX := 0.0;
   CenterY := 0.0;
@@ -440,6 +554,7 @@ begin
   Radius := 0.0;
   StartAngle := 0.0;
   EndAngle := 0.0;
+  LColor := colBlack;
 
   for i := 0 to ATokens.Count - 1 do
   begin
@@ -447,7 +562,7 @@ begin
     CurToken := TDXFToken(ATokens.Items[i]);
 
     // Avoid an exception by previously checking if the conversion can be made
-    if CurToken.GroupCode in [10, 20, 30, 40, 50, 51] then
+    if CurToken.GroupCode in [10, 20, 30, 40, 50, 51, 62] then
     begin
       CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
     end;
@@ -459,10 +574,23 @@ begin
       40: Radius := CurToken.FloatValue;
       50: StartAngle := CurToken.FloatValue;
       51: EndAngle := CurToken.FloatValue;
+      62: LColor := DXFColorIndexToFPColor(Trunc(CurToken.FloatValue));
     end;
   end;
 
-  AData.AddCircularArc(CenterX, CenterY, CenterZ, Radius, StartAngle, EndAngle);
+  // In DXF the EndAngle is always greater then the StartAngle.
+  // If it isn't then sum 360 to it to make sure we don't get wrong results
+  if EndAngle < StartAngle then EndAngle := EndAngle + 360;
+
+  // Position fixing for documents with negative coordinates
+  CenterX := CenterX - DOC_OFFSET.X;
+  CenterY := CenterY - DOC_OFFSET.Y;
+
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn(Format('Adding Arc Center=%f,%f Radius=%f StartAngle=%f EndAngle=%f',
+    [CenterX, CenterY, Radius, StartAngle, EndAngle]));
+  {$endif}
+  AData.AddCircularArc(CenterX, CenterY, CenterZ, Radius, StartAngle, EndAngle, LColor);
 end;
 
 {
@@ -506,10 +634,175 @@ begin
     end;
   end;
 
+  // Position fixing for documents with negative coordinates
+  CircleCenterX := CircleCenterX - DOC_OFFSET.X;
+  CircleCenterY := CircleCenterY - DOC_OFFSET.Y;
+
   AData.AddCircle(CircleCenterX, CircleCenterY,
     CircleCenterZ, CircleRadius);
 end;
 
+{
+Group codes Description
+100 Subclass marker (AcDbDimension)
+2 Name of the block that contains the entities that make up the dimension picture
+10 Definition point (in WCS) DXF: X value; APP: 3D point
+20, 30 DXF: Y and Z values of definition point (in WCS)
+11 Middle point of dimension text (in OCS) DXF: X value; APP: 3D point
+21, 31 DXF: Y and Z values of middle point of dimension text (in OCS)
+70 Dimension type.
+  Values 0-6 are integer values that represent the dimension type.
+  Values 32, 64, and 128 are bit values, which are added to the integer values
+  (value 32 is always set in R13 and later releases).
+  0 = Rotated, horizontal, or vertical; 1 = Aligned;
+  2 = Angular; 3 = Diameter; 4 = Radius;
+  5 = Angular 3 point; 6 = Ordinate;
+  32 = Indicates that the block reference (group code 2) is referenced by this dimension only.
+  64 = Ordinate type. This is a bit value (bit 7) used only with integer value 6.
+    If set, ordinate is X-type; if not set, ordinate is Y-type.
+  128 = This is a bit value (bit 8) added to the other group 70 values
+    if the dimension text has been positioned at a user-defined location
+    rather than at the default location.
+71 Attachment point:
+  1 = Top left; 2 = Top center; 3 = Top right;
+  4 = Middle left; 5 = Middle center; 6 = Middle right;
+  7 = Bottom left; 8 = Bottom center; 9 = Bottom right
+72 Dimension text line spacing style (optional):
+  1(or missing) = At least (taller characters will override)
+  2 = Exact (taller characters will not override)
+41 Dimension text line spacing factor (optional):
+  Percentage of default (3-on-5) line spacing to be applied. Valid values range from 0.25 to 4.00.
+42 Actual measurement (optional; read-only value)
+1 Dimension text explicitly entered by the user. Optional; default is the measurement.
+  If null or "<>", the dimension measurement is drawn as the text,
+  if " " (one blank space), the text is suppressed. Anything else is drawn as the text.
+53 The optional group code 53 is the rotation angle of the dimension
+  text away from its default orientation (the direction of the dimension line)  (optional).
+51 All dimension types have an optional 51 group code, which indicates the
+  horizontal direction for the dimension entity. The dimension entity determines
+  the orientation of dimension text and lines for horizontal, vertical, and
+  rotated linear dimensions.
+  This group value is the negative of the angle between the OCS X axis
+  and the UCS X axis. It is always in the XY plane of the OCS.
+210 Extrusion direction (optional; default = 0, 0, 1) DXF: X value; APP: 3D vector
+220, 230 DXF: Y and Z values of extrusion direction  (optional)
+3 Dimension style name
+
+Aligned Dimension Group Codes
+
+100 Subclass marker (AcDbAlignedDimension)
+12 Insertion point for clones of a dimension-Baseline and Continue (in OCS) DXF: X value; APP: 3D point
+22, 32 DXF: Y and Z values of insertion point for clones of a dimension-Baseline and Continue (in OCS)
+13 Definition point for linear and angular dimensions (in WCS) DXF: X value; APP: 3D point
+23, 33 DXF: Y and Z values of definition point for linear and angular dimensions (in WCS)
+14 Definition point for linear and angular dimensions (in WCS) DXF: X value; APP: 3D point
+24, 34 DXF: Y and Z values of definition point for linear and angular dimensions (in WCS)
+
+  |--text--|->10,20
+  |        |
+  |        |
+  X->14,24 X->13,23
+}
+procedure TvDXFVectorialReader.ReadENTITIES_DIMENSION(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i: Integer;
+  // DIMENSION
+  BaseLeft, BaseRight, DimensionRight, DimensionLeft, TmpPoint: T3DPoint;
+  IsAlignedDimension: Boolean = False;
+begin
+  // Initial values
+  BaseLeft.X := 0;
+  BaseLeft.Y := 0;
+  BaseRight.X := 0;
+  BaseRight.X := 0;
+  DimensionRight.X := 0;
+  DimensionRight.Y := 0;
+  DimensionLeft.X := 0;
+  DimensionLeft.Y := 0;
+
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 11, 21, 31, 13, 23, 33, 14, 24, 34] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    case CurToken.GroupCode of
+      10: DimensionRight.X := CurToken.FloatValue;
+      20: DimensionRight.Y := CurToken.FloatValue;
+      30: DimensionRight.Z := CurToken.FloatValue;
+      13: BaseRight.X := CurToken.FloatValue;
+      23: BaseRight.Y := CurToken.FloatValue;
+      33: BaseRight.Z := CurToken.FloatValue;
+      14: BaseLeft.X := CurToken.FloatValue;
+      24: BaseLeft.Y := CurToken.FloatValue;
+      34: BaseLeft.Z := CurToken.FloatValue;
+      100:
+      begin
+        if CurToken.StrValue = 'AcDbAlignedDimension' then IsAlignedDimension := True;
+      end;
+    end;
+  end;
+
+  // And now write it
+  {$ifdef FPVECTORIALDEBUG}
+//  WriteLn(Format('Adding Line from %f,%f to %f,%f', [LineStartX, LineStartY, LineEndX, LineEndY]));
+  {$endif}
+  if IsAlignedDimension then
+  begin
+    // Now make sure that we actually that BaseLeft is to the left of BaseRight
+    if BaseRight.X < BaseLeft.X then
+    begin
+      TmpPoint := BaseRight;
+      BaseRight := BaseLeft;
+      BaseLeft := TmpPoint;
+    end;
+
+    // Now check if we are a horizontal or vertical dimension
+
+    // horizontal
+    //
+    //DL____ DR
+    //  |  |
+    //  |  |
+    // BL  BR
+    if DimensionRight.X = BaseRight.X then
+    begin
+      DimensionLeft.X := BaseLeft.X;
+      DimensionLeft.Y := DimensionRight.Y;
+    end
+    // vertical
+    //
+    // BL ----|DR
+    //  BR  --|DL
+    //
+    // In this case we invert then DR and DL
+    else if DimensionRight.Y = BaseLeft.Y then
+    begin
+      DimensionLeft := DimensionRight;
+      DimensionRight.Y := BaseRight.Y;
+    end
+    // vertical
+    //
+    // BL ----|DL
+    //  BR  --|DR
+    //
+    else if DimensionRight.Y = BaseRight.Y then
+    begin
+      DimensionLeft.X := DimensionRight.X;
+      DimensionLeft.Y := BaseLeft.Y;
+    end;
+
+    AData.AddAlignedDimension(BaseLeft, BaseRight, DimensionLeft, DimensionRight);
+  end;
+end;
+
 {
 100 Subclass marker (AcDbEllipse)
 10 Center point (in WCS) DXF: X value; APP: 3D point
@@ -547,6 +840,10 @@ begin
     end;
   end;
 
+  // Position fixing for documents with negative coordinates
+  CenterX := CenterX - DOC_OFFSET.X;
+  CenterY := CenterY - DOC_OFFSET.Y;
+
   //
   AData.AddEllipse(CenterX, CenterY, CenterZ, MajorHalfAxis, MinorHalfAxis, Angle);
 end;
@@ -614,10 +911,278 @@ begin
     end;
   end;
 
+  // Position fixing for documents with negative coordinates
+  PosX := PosX - DOC_OFFSET.X;
+  PosY := PosY - DOC_OFFSET.Y;
+
+  //
+  AData.AddText(PosX, PosY, PosZ, '', Round(FontSize), Str);
+end;
+
+{.$define FPVECTORIALDEBUG_LWPOLYLINE}
+procedure TvDXFVectorialReader.ReadENTITIES_LWPOLYLINE(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i, curPoint: Integer;
+  // LINE
+  LWPolyline: array of TLWPOLYLINEElement;
+begin
+  curPoint := -1;
+
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 11, 21, 31] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    // Loads the coordinates
+    // With Position fixing for documents with negative coordinates
+    case CurToken.GroupCode of
+      10:
+      begin
+        // Starting a new point
+        Inc(curPoint);
+        SetLength(LWPolyline, curPoint+1);
+
+        LWPolyline[curPoint].X := CurToken.FloatValue - DOC_OFFSET.X;
+      end;
+      20: LWPolyline[curPoint].Y := CurToken.FloatValue - DOC_OFFSET.Y;
+    end;
+  end;
+
+  // And now write it
+  if curPoint >= 0 then // otherwise the polyline is empty of points
+  begin
+    AData.StartPath(LWPolyline[0].X, LWPolyline[0].Y);
+    {$ifdef FPVECTORIALDEBUG_LWPOLYLINE}
+    Write(Format('LWPOLYLINE ID=%d %f,%f', [AData.PathCount-1, LWPolyline[0].X, LWPolyline[0].Y]));
+    {$endif}
+    for i := 1 to curPoint do
+    begin
+      AData.AddLineToPath(LWPolyline[i].X, LWPolyline[i].Y);
+      {$ifdef FPVECTORIALDEBUG_LWPOLYLINE}
+       Write(Format(' %f,%f', [LWPolyline[i].X, LWPolyline[i].Y]));
+      {$endif}
+    end;
+    {$ifdef FPVECTORIALDEBUG_LWPOLYLINE}
+     WriteLn('');
+    {$endif}
+    AData.EndPath();
+  end;
+end;
+
+{.$define FPVECTORIALDEBUG_SPLINE}
+procedure TvDXFVectorialReader.ReadENTITIES_SPLINE(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i, curPoint: Integer;
+  // LINE
+  SPLine: array of TSPLineElement;
+begin
+  curPoint := -1;
+
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 11, 21, 31] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    // Loads the coordinates
+    // With Position fixing for documents with negative coordinates
+    case CurToken.GroupCode of
+      10:
+      begin
+        // Starting a new point
+        Inc(curPoint);
+        SetLength(SPLine, curPoint+1);
+
+        SPLine[curPoint].X := CurToken.FloatValue - DOC_OFFSET.X;
+      end;
+      20: SPLine[curPoint].Y := CurToken.FloatValue - DOC_OFFSET.Y;
+    end;
+  end;
+
+  // And now write it
+  if curPoint >= 0 then // otherwise the polyline is empty of points
+  begin
+    AData.StartPath(SPLine[0].X, SPLine[0].Y);
+    {$ifdef FPVECTORIALDEBUG_SPLINE}
+    Write(Format('SPLINE ID=%d %f,%f', [AData.PathCount-1, SPLine[0].X, SPLine[0].Y]));
+    {$endif}
+    for i := 1 to curPoint do
+    begin
+      AData.AddLineToPath(SPLine[i].X, SPLine[i].Y);
+      {$ifdef FPVECTORIALDEBUG_SPLINE}
+       Write(Format(' %f,%f', [SPLine[i].X, SPLine[i].Y]));
+      {$endif}
+    end;
+    {$ifdef FPVECTORIALDEBUG_SPLINE}
+     WriteLn('');
+    {$endif}
+    AData.EndPath();
+  end;
+end;
+
+procedure TvDXFVectorialReader.ReadENTITIES_POLYLINE(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+begin
+  SetLength(Polyline, 0);
+end;
+
+procedure TvDXFVectorialReader.ReadENTITIES_VERTEX(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i, curPoint: Integer;
+begin
+  if not IsReadingPolyline then raise Exception.Create('[TvDXFVectorialReader.ReadENTITIES_VERTEX] Unexpected record: VERTEX before a POLYLINE');
+
+  curPoint := Length(Polyline);
+  SetLength(Polyline, curPoint+1);
+  Polyline[curPoint].X := 0;
+  Polyline[curPoint].Y := 0;
+  Polyline[curPoint].Color := colBlack;
+
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 62] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    // Loads the coordinates
+    // With Position fixing for documents with negative coordinates
+    case CurToken.GroupCode of
+      10: Polyline[curPoint].X := CurToken.FloatValue - DOC_OFFSET.X;
+      20: Polyline[curPoint].Y := CurToken.FloatValue - DOC_OFFSET.Y;
+      62: Polyline[curPoint].Color := DXFColorIndexToFPColor(Trunc(CurToken.FloatValue));
+    end;
+  end;
+end;
+
+{$define FPVECTORIALDEBUG_POLYLINE}
+procedure TvDXFVectorialReader.ReadENTITIES_SEQEND(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  i: Integer;
+begin
+  if not IsReadingPolyline then raise Exception.Create('[TvDXFVectorialReader.ReadENTITIES_SEQEND] Unexpected record: SEQEND before a POLYLINE');
+
+  // Write the Polyline to the document
+  if Length(Polyline) >= 0 then // otherwise the polyline is empty of points
+  begin
+    AData.StartPath(Polyline[0].X, Polyline[0].Y);
+    {$ifdef FPVECTORIALDEBUG_POLYLINE}
+     Write(Format('POLYLINE %f,%f', [Polyline[0].X, Polyline[0].Y]));
+    {$endif}
+    for i := 1 to Length(Polyline)-1 do
+    begin
+      AData.AddLineToPath(Polyline[i].X, Polyline[i].Y, Polyline[i].Color);
+      {$ifdef FPVECTORIALDEBUG_POLYLINE}
+       Write(Format(' %f,%f', [Polyline[i].X, Polyline[i].Y]));
+      {$endif}
+    end;
+    {$ifdef FPVECTORIALDEBUG_POLYLINE}
+     WriteLn('');
+    {$endif}
+    AData.EndPath();
+  end;
+end;
+
+procedure TvDXFVectorialReader.ReadENTITIES_MTEXT(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i: Integer;
+  PosX: Double = 0.0;
+  PosY: Double = 0.0;
+  PosZ: Double = 0.0;
+  FontSize: Double = 10.0;
+  Str: string = '';
+begin
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 40] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    case CurToken.GroupCode of
+      1:  Str := CurToken.StrValue;
+      10: PosX := CurToken.FloatValue;
+      20: PosY := CurToken.FloatValue;
+      30: PosZ := CurToken.FloatValue;
+      40: FontSize := CurToken.FloatValue;
+    end;
+  end;
+
+  // Position fixing for documents with negative coordinates
+  PosX := PosX - DOC_OFFSET.X;
+  PosY := PosY - DOC_OFFSET.Y;
+
   //
   AData.AddText(PosX, PosY, PosZ, '', Round(FontSize), Str);
 end;
 
+procedure TvDXFVectorialReader.ReadENTITIES_POINT(ATokens: TDXFTokens;
+  AData: TvVectorialDocument);
+var
+  CurToken: TDXFToken;
+  i: Integer;
+  CircleCenterX, CircleCenterY, CircleCenterZ, CircleRadius: Double;
+begin
+  CircleCenterX := 0.0;
+  CircleCenterY := 0.0;
+  CircleCenterZ := 0.0;
+  CircleRadius := 1.0;
+
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    // Now read and process the item name
+    CurToken := TDXFToken(ATokens.Items[i]);
+
+    // Avoid an exception by previously checking if the conversion can be made
+    if CurToken.GroupCode in [10, 20, 30, 40] then
+    begin
+      CurToken.FloatValue :=  StrToFloat(Trim(CurToken.StrValue), FPointSeparator);
+    end;
+
+    case CurToken.GroupCode of
+      10: CircleCenterX := CurToken.FloatValue;
+      20: CircleCenterY := CurToken.FloatValue;
+      30: CircleCenterZ := CurToken.FloatValue;
+//      40: CircleRadius := CurToken.FloatValue;
+    end;
+  end;
+
+  // Position fixing for documents with negative coordinates
+  CircleCenterX := CircleCenterX - DOC_OFFSET.X;
+  CircleCenterY := CircleCenterY - DOC_OFFSET.Y;
+
+  AData.AddCircle(CircleCenterX, CircleCenterY,
+    CircleCenterZ, CircleRadius);
+end;
+
 function TvDXFVectorialReader.GetCoordinateValue(AStr: shortstring): Double;
 begin
   Result := 0.0;
@@ -627,6 +1192,14 @@ begin
   Result := StrToFloat(Copy(AStr, 2, Length(AStr) - 1));}
 end;
 
+function TvDXFVectorialReader.DXFColorIndexToFPColor(AColorIndex: Integer): TFPColor;
+begin
+  if (AColorIndex >= 0) and (AColorIndex <= 15) then
+    Result := AUTOCAD_COLOR_PALETTE[AColorIndex]
+  else
+    raise Exception.Create(Format('[TvDXFVectorialReader.DXFColorIndexToFPVColor] Invalid DXF Color Index: %d', [AColorIndex]));
+end;
+
 constructor TvDXFVectorialReader.Create;
 begin
   inherited Create;

+ 1407 - 0
packages/fpvectorial/src/epsvectorialreader.pas

@@ -0,0 +1,1407 @@
+{
+Reads EPS files
+
+License: The same modified LGPL as the Free Pascal RTL
+         See the file COPYING.modifiedLGPL for more details
+
+AUTHORS: Felipe Monteiro de Carvalho
+
+Documentation: http://www.tailrecursive.org/postscript/postscript.html
+}
+unit epsvectorialreader;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, Math, contnrs,
+  fpvectorial, fpimage, fpvutils;
+
+type
+  TPSTokenType = (ttComment, ttFloat);
+
+  TPSTokens = TFPList;// TPSToken;
+
+  TPSToken = class
+    StrValue: string;
+    FloatValue: double;
+    IntValue: Integer;
+    Line: Integer; // To help debugging
+    function Duplicate: TPSToken; virtual;
+  end;
+
+  TCommentToken = class(TPSToken)
+  end;
+
+  { TProcedureToken }
+
+  TProcedureToken = class(TPSToken)
+    Levels: Integer; // Used to count groups inside groups and find the end of a top-level group
+    Childs: TPSTokens;
+    Parsed: Boolean;
+    constructor Create;
+    destructor Destroy; override;
+  end;
+
+  TETType = (ettNamedElement, ettOperand, ettOperator);
+
+  { TExpressionToken }
+
+  TExpressionToken = class(TPSToken)
+    ETType: TETType;
+    function IsExpressionOperand: Boolean;
+    procedure PrepareFloatValue;
+    function Duplicate: TPSToken; override;
+  end;
+
+  TPostScriptScannerState = (ssSearchingToken, ssInComment, ssInDefinition, ssInGroup, ssInExpressionElement);
+
+  { TPSTokenizer }
+
+  TPSTokenizer = class
+  public
+    Tokens: TPSTokens;
+    constructor Create;
+    destructor Destroy; override;
+    procedure ReadFromStream(AStream: TStream);
+    procedure DebugOut();
+    function IsValidPostScriptChar(AChar: Byte): Boolean;
+    function IsPostScriptSpace(AChar: Byte): Boolean;
+    function IsEndOfLine(ACurChar: Byte; AStream: TStream): Boolean;
+  end;
+
+  { TvEPSVectorialReader }
+
+  TvEPSVectorialReader = class(TvCustomVectorialReader)
+  private
+    Stack: TObjectStack;
+    Dictionary: TStringList;
+    //
+    procedure RunPostScript(ATokens: TPsTokens; AData: TvVectorialDocument);
+    //
+    procedure ExecuteProcedureToken(AToken: TProcedureToken; AData: TvVectorialDocument);
+    procedure ExecuteOperatorToken(AToken: TExpressionToken; AData: TvVectorialDocument);
+    function  ExecuteArithmeticAndMathOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecutePathConstructionOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteGraphicStateOperatorsDI(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteGraphicStateOperatorsDD(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteDictionaryOperators(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteMiscellaneousOperators(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteStackManipulationOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteControlOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecutePaintingOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    function  ExecuteDeviceSetupAndOutputOperator(AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+    //
+    procedure PostScriptCoordsToFPVectorialCoords(AParam1, AParam2: TPSToken; var APosX, APosY: Double);
+    procedure DictionarySubstituteOperator(ADictionary: TStringList; var ACurToken: TPSToken);
+  public
+    { General reading methods }
+    Tokenizer: TPSTokenizer;
+    constructor Create; override;
+    Destructor Destroy; override;
+    procedure ReadFromStream(AStream: TStream; AData: TvVectorialDocument); override;
+  end;
+
+implementation
+
+var
+  FPointSeparator: TFormatSettings;
+
+{ TPSToken }
+
+function TPSToken.Duplicate: TPSToken;
+begin
+  Result := TPSToken(Self.ClassType.Create);
+  Result.StrValue := StrValue;
+  Result.FloatValue := FloatValue;
+  Result.IntValue := IntValue;
+  Result.Line := Line;
+end;
+
+{ TProcedureToken }
+
+constructor TProcedureToken.Create;
+begin
+  inherited Create;
+
+  Childs := TPSTokens.Create;
+end;
+
+destructor TProcedureToken.Destroy;
+begin
+  Childs.Free;
+
+  inherited Destroy;
+end;
+
+{ TExpressionToken }
+
+function TExpressionToken.IsExpressionOperand: Boolean;
+begin
+  if StrValue = '' then Exit(False);
+  Result := StrValue[1] in ['0'..'9','-'];
+end;
+
+procedure TExpressionToken.PrepareFloatValue;
+begin
+  //if not IsExpressionOperand() then Exit;
+  if ETType <> ettOperand then Exit; // faster, because this field should already be filled
+
+  FloatValue := StrToFloat(StrValue, FPointSeparator);
+end;
+
+function TExpressionToken.Duplicate: TPSToken;
+begin
+  Result:=inherited Duplicate;
+  TExpressionToken(Result).ETType := ETType;
+end;
+
+{$DEFINE FPVECTORIALDEBUG}
+
+{ TPSTokenizer }
+
+constructor TPSTokenizer.Create;
+begin
+  inherited Create;
+  Tokens := TPSTokens.Create;
+end;
+
+destructor TPSTokenizer.Destroy;
+begin
+  Tokens.Free;
+  inherited Destroy;
+end;
+
+{@@ Rules for parsing PostScript files:
+
+* Coments go from the first occurence of % outside a line to the next new line
+* The only accepted characters are printable ASCII ones, plus spacing ASCII chars
+  See IsValidPostScriptChar about that
+}
+procedure TPSTokenizer.ReadFromStream(AStream: TStream);
+var
+  i: Integer;
+  CurChar: Char;
+  CurLine: Integer = 1;
+  State: TPostScriptScannerState = ssSearchingToken;
+  CommentToken: TCommentToken;
+  ProcedureToken: TProcedureToken;
+  ExpressionToken: TExpressionToken;
+  Len: Integer;
+  lIsEndOfLine: Boolean;
+begin
+  while AStream.Position < AStream.Size do
+  begin
+    CurChar := Char(AStream.ReadByte());
+//    {$ifdef FPVECTORIALDEBUG}
+//    WriteLn(Format('Obtained token %s', [CurChar]));
+//    {$endif}
+    if not IsValidPostScriptChar(Byte(CurChar)) then
+      raise Exception.Create('[TPSTokenizer.ReadFromStream] Invalid char: ' + IntToHex(Byte(CurChar), 2));
+
+    lIsEndOfLine := IsEndOfLine(Byte(CurChar), AStream);
+    if lIsEndOfLine then Inc(CurLine);
+
+    case State of
+      { Searching for a token }
+      ssSearchingToken:
+      begin
+        if CurChar = '%' then
+        begin
+          CommentToken := TCommentToken.Create;
+          CommentToken.Line := CurLine;
+          State := ssInComment;
+//          {$ifdef FPVECTORIALDEBUG}
+//          WriteLn(Format('Starting Comment at Line %d', [CurLine]));
+//          {$endif}
+        end
+        else if CurChar = '{' then
+        begin
+          ProcedureToken := TProcedureToken.Create;
+          ProcedureToken.Levels := 1;
+          ProcedureToken.Line := CurLine;
+          State := ssInGroup;
+        end
+        else if CurChar in ['a'..'z','A'..'Z','0'..'9','-','/'] then
+        begin
+          ExpressionToken := TExpressionToken.Create;
+          ExpressionToken.Line := CurLine;
+          if CurChar = '/' then
+            ExpressionToken.ETType := ettNamedElement
+          else
+          begin
+            ExpressionToken.StrValue := CurChar;
+            if ExpressionToken.IsExpressionOperand() then
+              ExpressionToken.ETType := ettOperand
+            else
+              ExpressionToken.ETType := ettOperator;
+          end;
+          State := ssInExpressionElement;
+        end
+        else if lIsEndOfLine then Continue
+        else if IsPostScriptSpace(Byte(CurChar)) then Continue
+        else
+          raise Exception.Create(Format('[TPSTokenizer.ReadFromStream] Unexpected char while searching for token: $%s in Line %d',
+           [IntToHex(Byte(CurChar), 2), CurLine]));
+      end;
+
+      { Passing by comments }
+      ssInComment:
+      begin
+        CommentToken.StrValue := CommentToken.StrValue + CurChar;
+        if lIsEndOfLine then
+        begin
+          Tokens.Add(CommentToken);
+          State := ssSearchingToken;
+//          {$ifdef FPVECTORIALDEBUG}
+//          WriteLn(Format('Adding Comment "%s" at Line %d', [CommentToken.StrValue, CurLine]));
+//          {$endif}
+        end;
+      end; // ssInComment
+
+      // Starts at { and ends in }, passing over nested groups
+      ssInGroup:
+      begin
+        if (CurChar = '{') then ProcedureToken.Levels := ProcedureToken.Levels + 1;
+        if (CurChar = '}') then ProcedureToken.Levels := ProcedureToken.Levels - 1;
+
+        if ProcedureToken.Levels = 0 then
+        begin
+          Tokens.Add(ProcedureToken);
+          State := ssSearchingToken;
+        end
+        else
+          ProcedureToken.StrValue := ProcedureToken.StrValue + CurChar;
+      end;
+
+      // Goes until a space comes, or {
+      ssInExpressionElement:
+      begin
+        if IsPostScriptSpace(Byte(CurChar)) or (CurChar = '{') then
+        begin
+          ExpressionToken.PrepareFloatValue();
+          Tokens.Add(ExpressionToken);
+          State := ssSearchingToken;
+          if (CurChar = '{') then AStream.Seek(-1, soFromCurrent);
+        end
+        else
+          ExpressionToken.StrValue := ExpressionToken.StrValue + CurChar;
+      end;
+
+    end; // case
+  end; // while
+end;
+
+procedure TPSTokenizer.DebugOut();
+var
+  i: Integer;
+  Token: TPSToken;
+begin
+  for i := 0 to Tokens.Count - 1 do
+  begin
+    Token := TPSToken(Tokens.Items[i]);
+
+    if Token is TCommentToken then
+    begin
+      WriteLn(Format('TCommentToken StrValue=%s', [Token.StrValue]));
+    end
+    else if Token is TProcedureToken then
+    begin
+      WriteLn(Format('TProcedureToken StrValue=%s', [Token.StrValue]));
+    end
+    else if Token is TExpressionToken then
+    begin
+      WriteLn(Format('TExpressionToken StrValue=%s', [Token.StrValue]));
+    end;
+  end;
+end;
+
+{@@ Valid PostScript Chars:
+
+All printable ASCII: a..zA..Z0..9 plus punctuation
+
+Plus the following white spaces
+000 00 0 Null (nul)
+011 09 9 Tab (tab)
+012 0A 10 Line feed (LF)
+014 0C 12 Form feed (FF)
+015 0D 13 Carriage return (CR)
+040 20 32 Space (SP)
+}
+function TPSTokenizer.IsValidPostScriptChar(AChar: Byte): Boolean;
+begin
+  Result := ((AChar > 32) and (AChar < 127)) or (AChar in [0, 9, 10, 12, 13, 32]);
+end;
+
+function TPSTokenizer.IsPostScriptSpace(AChar: Byte): Boolean;
+begin
+  Result := AChar in [0, 9, 10, 12, 13, 32];
+end;
+
+function TPSTokenizer.IsEndOfLine(ACurChar: Byte; AStream: TStream): Boolean;
+var
+  HasNextChar: Boolean = False;
+  NextChar: Byte;
+begin
+  Result := False;
+
+  if ACurChar = 13 then
+  begin
+    if AStream.Position < AStream.Size then
+    begin
+      HasNextChar := True;
+      NextChar := AStream.ReadByte();
+      if NextChar <> 10 then AStream.Seek(-1, soFromCurrent); // Go back if it wasnt a #13#10
+      Exit(True);
+    end;
+  end;
+
+  if ACurChar = 10 then Result := True;
+end;
+
+{$ifndef Windows}
+{$define FPVECTORIALDEBUG}
+{$endif}
+
+{ TvEPSVectorialReader }
+
+procedure TvEPSVectorialReader.RunPostScript(ATokens: TPsTokens;
+  AData: TvVectorialDocument);
+var
+  i: Integer;
+  CurToken: TPSToken;
+begin
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn('[TvEPSVectorialReader.RunPostScript] START');
+  {$endif}
+  for i := 0 to ATokens.Count - 1 do
+  begin
+    CurToken := TPSToken(ATokens.Items[i]);
+
+    if CurToken is TCommentToken then
+    begin
+//      ProcessCommentToken(CurToken as TCommentToken, AData);
+      Continue;
+    end;
+
+    if CurToken is TProcedureToken then
+    begin
+      Stack.Push(CurToken);
+      Continue;
+    end;
+
+    if CurToken is TExpressionToken then
+    begin
+      if TExpressionToken(CurToken).ETType <> ettOperator then
+      begin
+        Stack.Push(CurToken);
+        Continue;
+      end;
+
+      // Now we need to verify if the operator should be substituted in the dictionary
+      DictionarySubstituteOperator(Dictionary, CurToken);
+
+      if CurToken is TProcedureToken then ExecuteProcedureToken(TProcedureToken(CurToken), AData)
+      else ExecuteOperatorToken(TExpressionToken(CurToken), AData);
+    end;
+  end;
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn('[TvEPSVectorialReader.RunPostScript] END');
+  {$endif}
+end;
+
+procedure TvEPSVectorialReader.ExecuteProcedureToken(AToken: TProcedureToken;
+  AData: TvVectorialDocument);
+var
+  ProcTokenizer: TPSTokenizer;
+  lStream: TMemoryStream;
+  lOldTokens: TPSTokens;
+  i: Integer;
+begin
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn('[TvEPSVectorialReader.ExecuteProcedureToken] START');
+  {$endif}
+  if not AToken.Parsed then
+  begin
+    ProcTokenizer := TPSTokenizer.Create;
+    lStream := TMemoryStream.Create;
+    try
+      // Copy the string to a Stream
+      for i := 1 to Length(AToken.StrValue) do
+        lStream.WriteByte(Byte(AToken.StrValue[i]));
+
+      // Change the Tokens so that it writes directly to AToken.Childs
+      lOldTokens := Tokenizer.Tokens;
+      Tokenizer.Tokens := AToken.Childs;
+
+      // Now parse the procedure code
+      ProcTokenizer.ReadFromStream(lStream);
+
+      // Recover the old tokens for usage in .Free
+      Tokenizer.Tokens := lOldTokens;
+    finally
+      lStream.Free;
+      ProcTokenizer.Free;
+    end;
+
+    AToken.Parsed := True;
+  end;
+
+  // Now run the procedure
+  RunPostScript(AToken.Childs, AData);
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn('[TvEPSVectorialReader.ExecuteProcedureToken] END');
+  {$endif}
+end;
+
+procedure TvEPSVectorialReader.ExecuteOperatorToken(AToken: TExpressionToken;
+  AData: TvVectorialDocument);
+var
+  Param1, Param2: TPSToken;
+begin
+  if AToken.StrValue = '' then raise Exception.Create('[TvEPSVectorialReader.ProcessExpressionToken] Empty operator');
+
+  if ExecuteDictionaryOperators(AToken, AData) then Exit;
+
+  if ExecuteArithmeticAndMathOperator(AToken, AData) then Exit;
+
+  if ExecutePathConstructionOperator(AToken, AData) then Exit;
+
+  if ExecuteGraphicStateOperatorsDI(AToken, AData) then Exit;
+
+  if ExecuteGraphicStateOperatorsDD(AToken, AData) then Exit;
+
+  if ExecuteControlOperator(AToken, AData) then Exit;
+
+  if ExecuteStackManipulationOperator(AToken, AData) then Exit;
+
+  if ExecuteMiscellaneousOperators(AToken, AData) then Exit;
+
+  if ExecutePaintingOperator(AToken, AData) then Exit;
+
+  if ExecuteDeviceSetupAndOutputOperator(AToken, AData) then Exit;
+
+  // If we got here, there the command not yet implemented
+  raise Exception.Create(Format('[TvEPSVectorialReader.ProcessExpressionToken] Unknown PostScript Command "%s" in Line %d',
+    [AToken.StrValue, AToken.Line]));
+
+  { Array Operators
+
+  int array array Create array of length int
+  – [ mark Start array construction
+  mark obj0 … objn-1 ] array End array construction
+  array length int Return number of elements in array
+  array index get any Return array element indexed by index
+  array index any put – Put any into array at index
+  array index count getinterval subarray Return subarray of array starting at index for
+  count elements
+  array1 index array2|packedarray2 putinterval – Replace subarray of array1 starting at index
+  by array2|packedarray2
+  any0 … anyn-1 array astore array Pop elements from stack into array
+  array aload any0 … anyn-1 array Push all elements of array on stack
+  array1 array2 copy subarray2 Copy elements of array1 to initial subarray of
+  array2
+  array proc forall – Execute proc for each element of array
+  Packed Array Operators
+  any0 … anyn-1 n packedarray packedarray Create packed array consisting of n elements
+  from stack
+  bool setpacking – Set array packing mode for { … } syntax
+  (true = packed array)
+  – currentpacking bool Return array packing mode
+  packedarray length int Return number of elements in packedarray
+  packedarray index get any Return packedarray element indexed by index
+  packedarray index count getinterval subarray Return subarray of packedarray starting at
+  index for count elements
+  packedarray aload any0 … anyn-1 packedarray
+  Push all elements of packedarray on stack
+  packedarray1 array2 copy subarray2 Copy elements of packedarray1 to initial
+  subarray of array2
+  packedarray proc forall – Execute proc for each element of packedarray
+}
+{ String Operators
+
+  int string string Create string of length int
+  string length int Return number of elements in string
+  string index get int Return string element indexed by index
+  string index int put – Put int into string at index
+  string index count getinterval substring Return substring of string starting at index
+  for count elements
+  string1 index string2 putinterval – Replace substring of string1 starting at index
+  by string2
+  string1 string2 copy substring2 Copy elements of string1 to initial substring
+  of string2
+  string proc forall – Execute proc for each element of string
+  string seek anchorsearch post match true Search for seek at start of string
+  or string false
+  string seek search post match pre true Search for seek in string
+  or string false
+  string token post any true Read token from start of string
+  or false
+  Relational, Boolean, and Bitwise Operators
+  any1 any2 eq bool Test equal
+  any1 any2 ne bool Test not equal
+  num1|str1 num2|str2 ge bool Test greater than or equal
+  num1|str1 num2|str2 gt bool Test greater than
+  num1|str1 num2|str2 le bool Test less than or equal
+  num1|str1 num2|str2 lt bool Test less than
+  bool1|int1 bool2|int2 and bool3|int3 Perform logical|bitwise and
+  bool1|int1 not bool2|int2 Perform logical|bitwise not
+  bool1|int1 bool2|int2 or bool3|int3 Perform logical|bitwise inclusive or
+  bool1|int1 bool2|int2 xor bool3|int3 Perform logical|bitwise exclusive or
+  – true true Return boolean value true
+  – false false Return boolean value false
+  int1 shift bitshift int2 Perform bitwise shift of int1 (positive is left)
+}
+{  File Operators
+
+  filename access file file Open named file with specified access
+  datasrc|datatgt dict
+  param1 … paramn filtername filter file Establish filtered file
+  file closefile – Close file
+  file read int true Read one character from file
+  or false
+  file int write – Write one character to file
+  file string readhexstring substring bool Read hexadecimal numbers from file into
+  string
+  file string writehexstring – Write string to file as hexadecimal
+  file string readstring substring bool Read string from file
+  file string writestring – Write string to file
+  file string readline substring bool Read line from file into string
+  file token any true Read token from file
+  or false
+  file bytesavailable int Return number of bytes available to read
+  – flush – Send buffered data to standard output file
+  file flushfile – Send buffered data or read to EOF
+  file resetfile – Discard buffered characters
+  file status bool Return status of file (true = valid)
+  filename status pages bytes referenced created true
+  or false Return information about named file
+  filename run – Execute contents of named file
+  – currentfile file Return file currently being executed
+  filename deletefile – Delete named file
+  filename1 filename2 renamefile – Rename file filename1 to filename2
+  template proc scratch filenameforall – Execute proc for each file name matching
+  template
+  file position setfileposition – Set file to specified position
+  file fileposition position Return current position in file
+  string print – Write string to standard output file
+  any = – Write text representation of any to standard
+  output file
+  any == – Write syntactic representation of any to
+  standard output file
+  any1 … anyn stack any1 … anyn Print stack nondestructively using =
+  any1 … anyn pstack any1 … anyn Print stack nondestructively using ==
+  obj tag printobject – Write binary object to standard output file,
+  using tag
+  file obj tag writeobject – Write binary object to file, using tag
+  int setobjectformat – Set binary object format (0 = disable,
+  1 = IEEE high, 2 = IEEE low, 3 = native
+  high, 4 = native low)
+  – currentobjectformat int Return binary object format
+}
+{ Resource Operators
+
+  key instance category defineresource instance Register named resource instance in category
+  key category undefineresource – Remove resource registration
+  key category findresource instance Return resource instance identified by key in
+  category
+  renderingintent findcolorrendering name bool Select CIE-based color rendering dictionary
+  by rendering intent
+  key category resourcestatus status size true Return status of resource instance
+  or false
+  template proc scratch category resourceforall – Enumerate resource instances in category
+}
+{ Virtual Memory Operators
+
+  – save save Create VM snapshot
+  save restore – Restore VM snapshot
+  bool setglobal – Set VM allocation mode (false = local,
+  true = global)
+  – currentglobal bool Return current VM allocation mode
+  any gcheck bool Return true if any is simple or in global VM,
+  false if in local VM
+  bool1 password startjob bool2 Start new job that will alter initial VM if
+  bool1 is true
+  index any defineuserobject – Define user object associated with index
+  index execuserobject – Execute user object associated with index
+  index undefineuserobject – Remove user object associated with index
+  – UserObjects array Return current UserObjects array defined in
+  userdict
+}
+{ Errors
+
+  configurationerror setpagedevice or setdevparams request
+  cannot be satisfied
+  dictfull No more room in dictionary
+  dictstackoverflow Too many begin operators
+  dictstackunderflow Too many end operators
+  execstackoverflow Executive stack nesting too deep
+  handleerror Called to report error information
+  interrupt External interrupt request (for example,
+  Control-C)
+  invalidaccess Attempt to violate access attribute
+  invalidexit exit not in loop
+  invalidfileaccess Unacceptable access string
+  invalidfont Invalid Font resource name or font or
+  CIDFont dictionary
+  invalidrestore Improper restore
+  ioerror Input/output error
+  limitcheck Implementation limit exceeded
+  nocurrentpoint Current point undefined
+  rangecheck Operand out of bounds
+  stackoverflow Operand stack overflow
+  stackunderflow Operand stack underflow
+  syntaxerror PostScript language syntax error
+  timeout Time limit exceeded
+  typecheck Operand of wrong type
+  undefined Name not known
+  undefinedfilename File not found
+  undefinedresource Resource instance not found
+  undefinedresult Overflow, underflow, or meaningless result
+  unmatchedmark Expected mark not on stack
+  unregistered Internal error
+  VMerror Virtual memory exhausted
+}
+end;
+
+{ Operand Stack Manipulation Operators
+
+  any pop –                    Discard top element
+  any1 any2 exch ==> any2 any1 Exchange top two elements
+  any dup ==> any any          Duplicate top element
+  any1 … anyn n copy any1 … anyn any1 … anyn
+                               Duplicate top n elements
+  anyn … any0 n index anyn … any0 anyn
+                               Duplicate arbitrary element
+  anyn-1 … any0 n j roll any(j-1) mod n … any0 anyn-1 … anyj mod n
+                               Roll n elements up j times
+  any1 … anyn clear            Discard all elements
+  any1 … anyn count any1 … anyn n
+                               Count elements on stack
+  – mark mark                  Push mark on stack
+  mark obj1 … objn cleartomark –
+                               Discard elements down through mark
+  mark obj1 … objn counttomark mark obj1 … objn n
+                               Count elements down to mark
+}
+function TvEPSVectorialReader.ExecuteStackManipulationOperator(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, NewToken: TPSToken;
+begin
+  Result := False;
+
+  //
+  if AToken.StrValue = 'dup' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    NewToken := Param1.Duplicate();
+    Stack.Push(Param1);
+    Stack.Push(NewToken);
+    Exit(True);
+  end;
+end;
+
+{  Control Operators
+
+  any exec – Execute arbitrary object
+  bool proc if – Execute proc if bool is true
+  bool proc1 proc2 ifelse – Execute proc1 if bool is true, proc2 if false
+  initial increment limit proc for – Execute proc with values from initial by steps
+                                     of increment to limit
+  int proc repeat – Execute proc int times
+  proc loop – Execute proc an indefinite number of times
+  – exit – Exit innermost active loop
+  – stop – Terminate stopped context
+  any stopped bool Establish context for catching stop
+  – countexecstack int Count elements on execution stack
+  array execstack subarray Copy execution stack into array
+  – quit – Terminate interpreter
+  – start – Executed at interpreter startup
+  Type, Attribute, and Conversion Operators
+  any type name Return type of any
+  any cvlit any Make object literal
+  any cvx any Make object executable
+  any xcheck bool Test executable attribute
+  array|packedarray|file|string executeonly array|packedarray|file|string
+  Reduce access to execute-only
+  array|packedarray|dict|file|string noaccess array|packedarray|dict|file|string
+  Disallow any access
+  array|packedarray|dict|file|string readonly array|packedarray|dict|file|string
+  Reduce access to read-only
+  array|packedarray|dict|file|string rcheck bool Test read access
+  array|packedarray|dict|file|string wcheck bool Test write access
+  num|string cvi int Convert to integer
+  string cvn name Convert to name
+  num|string cvr real Convert to real
+  num radix string cvrs substring Convert with radix to string
+  any string cvs substring Convert to string
+}
+function TvEPSVectorialReader.ExecuteControlOperator(AToken: TExpressionToken;
+  AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2, Param3, Param4: TPSToken;
+  FloatCounter: Double;
+begin
+  Result := False;
+
+  // initial increment limit proc for
+  if AToken.StrValue = 'for' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Param3 := TPSToken(Stack.Pop);
+    Param4 := TPSToken(Stack.Pop);
+
+    if not (Param1 is TProcedureToken) then
+      raise Exception.Create(Format('[TvEPSVectorialReader.ExecuteControlOperator] The operator for requires a procedure. Error at line %d', [AToken.Line]));
+
+    FloatCounter := Param4.FloatValue;
+    while FloatCounter < Param2.FloatValue do
+    begin
+      ExecuteProcedureToken(TProcedureToken(Param1), AData);
+
+      FloatCounter := FloatCounter + Param3.FloatValue;
+    end;
+
+    Exit(True);
+  end;
+end;
+
+{  Painting Operators
+
+  – erasepage – Paint current page white
+  – stroke – Draw line along current path
+  – fill – Fill current path with current color
+  – eofill – Fill using even-odd rule
+  x y width height rectstroke – Define rectangular path and stroke
+  x y width height matrix rectstroke – Define rectangular path, concatenate matrix,
+  and stroke
+  numarray|numstring rectstroke – Define rectangular paths and stroke
+  numarray|numstring matrix rectstroke – Define rectangular paths, concatenate
+  matrix, and stroke
+  x y width height rectfill – Fill rectangular path
+  numarray|numstring rectfill – Fill rectangular paths
+  userpath ustroke – Interpret and stroke userpath
+  userpath matrix ustroke – Interpret userpath, concatenate matrix, and
+  stroke
+  userpath ufill – Interpret and fill userpath
+  userpath ueofill – Fill userpath using even-odd rule
+  dict shfill – Fill area defined by shading pattern
+  dict image – Paint any sampled image
+  width height bits/sample matrix datasrc image – Paint monochrome sampled image
+  width height bits/comp matrix
+  datasrc0 … datasrcncomp-1 multi ncomp colorimage – Paint color sampled image
+  dict imagemask – Paint current color through mask
+  width height polarity matrix datasrc imagemask – Paint current color through mask
+  Insideness-Testing Operators
+  x y infill bool Test whether (x, y) would be painted by fill
+  userpath infill bool Test whether pixels in userpath would be
+  painted by fill
+  x y ineofill bool Test whether (x, y) would be painted by eofill
+  userpath ineofill bool Test whether pixels in userpath would be
+  painted by eofill
+  x y userpath inufill bool Test whether (x, y) would be painted by ufill
+  of userpath
+  userpath1 userpath2 inufill bool Test whether pixels in userpath1 would be
+  painted by ufill of userpath2
+  x y userpath inueofill bool Test whether (x, y) would be painted by
+  ueofill of userpath
+  userpath1 userpath2 inueofill bool Test whether pixels in userpath1 would be
+  painted by ueofill of userpath2
+  x y instroke bool Test whether (x, y) would be painted by
+  stroke
+  x y userpath inustroke bool Test whether (x, y) would be painted by
+  ustroke of userpath
+  x y userpath matrix inustroke bool Test whether (x, y) would be painted by
+  ustroke of userpath
+  userpath1 userpath2 inustroke bool Test whether pixels in userpath1 would be
+  painted by ustroke of userpath2
+  userpath1 userpath2 matrix inustroke bool Test whether pixels in userpath1 would be
+  painted by ustroke of userpath2
+  Form and Pattern Operators
+  pattern matrix makepattern pattern’ Create pattern instance from prototype
+  pattern setpattern – Install pattern as current color
+  comp1 … compn pattern setpattern – Install pattern as current color
+  form execform – Paint form
+}
+function TvEPSVectorialReader.ExecutePaintingOperator(AToken: TExpressionToken;
+  AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  if AToken.StrValue = 'stroke' then
+  begin
+    Exit(True);
+  end;
+end;
+
+{ Device Setup and Output Operators
+
+  – showpage – Transmit and reset current page
+  – copypage – Transmit current page
+  dict setpagedevice – Install page-oriented output device
+  – currentpagedevice dict Return current page device parameters
+  – nulldevice – Install no-output device
+  Glyph and Font Operators
+  key font|cidfont definefont font|cidfont Register font|cidfont in Font resource
+  category
+  key name|string|dict array composefont font Register composite font dictionary created
+  from CMap and array of CIDFonts or fonts
+  key undefinefont – Remove Font resource registration
+  key findfont font|cidfont Return Font resource instance identified by
+  key
+  font|cidfont scale scalefont font¢|cidfont¢ Scale font|cidfont by scale to produce
+  font¢|cidfont¢
+  font|cidfont matrix makefont font¢|cidfont¢ Transform font|cidfont by matrix to produce
+  font¢|cidfont¢
+  font|cidfont setfont – Set font or CIDFont in graphics state
+  – rootfont font|cidfont Return last set font or CIDFont
+  – currentfont font|cidfont Return current font or CIDFont, possibly a
+  descendant of rootfont
+  key scale|matrix selectfont – Set font or CIDFont given name and
+  transform
+  string show – Paint glyphs for string in current font
+  ax ay string ashow – Add (ax , ay) to width of each glyph while
+  showing string
+  cx cy char string widthshow – Add (cx , cy) to width of glyph for char while
+  showing string
+  cx cy char ax ay string awidthshow – Combine effects of ashow and widthshow
+  string numarray|numstring xshow – Paint glyphs for string using x widths in
+  numarray|numstring
+  string numarray|numstring xyshow – Paint glyphs for string using x and y widths
+  in numarray|numstring
+  string numarray|numstring yshow – Paint glyphs for string using y widths in
+  numarray|numstring
+  name|cid glyphshow – Paint glyph for character identified by
+  name|cid
+  string stringwidth wx wy Return width of glyphs for string in current
+  font
+  proc string cshow – Invoke character mapping algorithm and
+  call proc
+  proc string kshow – Execute proc between characters shown from
+  string
+  – FontDirectory dict Return dictionary of Font resource instances
+  – GlobalFontDirectory dict Return dictionary of Font resource instances
+  in global VM
+  – StandardEncoding array Return Adobe standard font encoding vector
+  – ISOLatin1Encoding array Return ISO Latin-1 font encoding vector
+  key findencoding array Find encoding vector
+  wx wy llx lly urx ury setcachedevice – Declare cached glyph metrics
+  w0x w0y llx lly urx ury
+  w1x w1y vx vy setcachedevice2 – Declare cached glyph metrics
+  wx wy setcharwidth – Declare uncached glyph metrics
+  Interpreter Parameter Operators
+  dict setsystemparams – Set systemwide interpreter parameters
+  – currentsystemparams dict Return systemwide interpreter parameters
+  dict setuserparams – Set per-context interpreter parameters
+  – currentuserparams dict Return per-context interpreter parameters
+  string dict setdevparams – Set parameters for input/output device
+  string currentdevparams dict Return device parameters
+  int vmreclaim – Control garbage collector
+  int setvmthreshold – Control garbage collector
+  – vmstatus level used maximum
+  Report VM status
+  – cachestatus bsize bmax msize mmax csize cmax blimit
+  Return font cache status and parameters
+  int setcachelimit – Set maximum bytes in cached glyph
+  mark size lower upper setcacheparams – Set font cache parameters
+  – currentcacheparams mark size lower upper
+  Return current font cache parameters
+  mark blimit setucacheparams – Set user path cache parameters
+  – ucachestatus mark bsize bmax rsize rmax blimit
+  Return user path cache status and
+  parameters
+}
+function TvEPSVectorialReader.ExecuteDeviceSetupAndOutputOperator(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  if AToken.StrValue = 'showpage' then
+  begin
+    Exit(True);
+  end;
+end;
+
+{  Arithmetic and Math Operators
+
+  num1 num2 add sum        Return num1 plus num2
+  num1 num2 div quotient   Return num1 divided by num2
+  int1 int2 idiv quotient  Return int1 divided by int2
+  int1 int2 mod remainder  Return remainder after dividing int1 by int2
+  num1 num2 mul product    Return num1 times num2
+  num1 num2 sub difference Return num1 minus num2
+  num1 abs num2            Return absolute value of num1
+  num1 neg num2            Return negative of num1
+  num1 ceiling num2        Return ceiling of num1
+  num1 floor num2          Return floor of num1
+  num1 round num2          Round num1 to nearest integer
+  num1 truncate num2       Remove fractional part of num1
+  num sqrt real            Return square root of num
+  num den atan angle       Return arctangent of num/den in degrees
+  angle cos real           Return cosine of angle degrees
+  angle sin real           Return sine of angle degrees
+  base exponent exp real   Raise base to exponent power
+  num ln real              Return natural logarithm (base e)
+  num log real             Return common logarithm (base 10)
+  – rand int               Generate pseudo-random integer
+  int srand –              Set random number seed
+  – rrand int              Return random number seed
+}
+function TvEPSVectorialReader.ExecuteArithmeticAndMathOperator(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  // Division
+  // Param2 Param1 div ==> Param2 div Param1
+  if AToken.StrValue = 'div' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Param1.FloatValue := Param2.FloatValue / Param1.FloatValue;
+    Param1.StrValue := '00'; // Just to mark it as a number
+    Stack.Push(Param1);
+    Exit(True);
+  end;
+
+  // Param2 Param1 mul ==> Param2 mul Param1
+  if AToken.StrValue = 'mul' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Param1.FloatValue := Param2.FloatValue * Param1.FloatValue;
+    Param1.StrValue := '00'; // Just to mark it as a number
+    Stack.Push(Param1);
+    Exit(True);
+  end;
+end;
+
+{ Path Construction Operators
+
+  – newpath –              Initialize current path to be empty
+  – currentpoint x y       Return current point coordinates
+  x y moveto –             Set current point to (x, y)
+  dx dy rmoveto –          Perform relative moveto
+  x y lineto –             Append straight line to (x, y)
+  dx dy rlineto –          Perform relative lineto
+  x y r angle1 angle2 arc – Append counterclockwise arc
+  x y r angle1 angle2 arcn – Append clockwise arc
+  x1 y1 x2 y2 r arct –     Append tangent arc
+  x1 y1 x2 y2 r arcto xt1 yt1 xt2 yt2 Append tangent arc
+  x1 y1 x2 y2 x3 y3 curveto – Append Bézier cubic section
+  dx1 dy1 dx2 dy2 dx3 dy3 rcurveto – Perform relative curveto
+  – closepath –            Connect subpath back to its starting point
+  – flattenpath –          Convert curves to sequences of straight lines
+  – reversepath –          Reverse direction of current path
+  – strokepath –           Compute outline of stroked path
+  userpath ustrokepath – Compute outline of stroked userpath
+  userpath matrix ustrokepath – Compute outline of stroked userpath
+  string bool charpath – Append glyph outline to current path
+  userpath uappend – Interpret userpath and append to current
+  path
+  – clippath – Set current path to clipping path
+  llx lly urx ury setbbox – Set bounding box for current path
+  – pathbbox llx lly urx ury Return bounding box of current path
+  move line curve close pathforall – Enumerate current path
+  bool upath userpath Create userpath for current path; include
+  ucache if bool is true
+  – initclip – Set clipping path to device default
+  – clip – Clip using nonzero winding number rule
+  – eoclip – Clip using even-odd rule
+  x y width height rectclip – Clip with rectangular path
+  numarray|numstring rectclip – Clip with rectangular paths
+  – ucache – Declare that user path is to be cached
+}
+function TvEPSVectorialReader.ExecutePathConstructionOperator(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2, Param3, Param4, Param5, Param6: TPSToken;
+  PosX, PosY, PosX2, PosY2, PosX3, PosY3, BaseX, BaseY: Double;
+begin
+  Result := False;
+
+  //
+  if AToken.StrValue = 'newpath' then
+  begin
+    AData.EndPath();
+    AData.StartPath();
+    Exit(True);
+  end;
+  // Param2 Param1 moveto ===> moveto(X=Param2, Y=Param1);
+  if AToken.StrValue = 'moveto' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    PostScriptCoordsToFPVectorialCoords(Param1, Param2, PosX, PosY);
+    AData.AddMoveToPath(PosX, PosY);
+    Exit(True);
+  end;
+  // Absolute LineTo
+  if AToken.StrValue = 'lineto' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    PostScriptCoordsToFPVectorialCoords(Param1, Param2, PosX, PosY);
+    AData.AddLineToPath(PosX, PosY);
+    Exit(True);
+  end;
+  // Relative LineTo
+  if AToken.StrValue = 'rlineto' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    PostScriptCoordsToFPVectorialCoords(Param1, Param2, PosX, PosY);
+    AData.GetCurrenPathPenPos(BaseX, BaseY);
+    AData.AddLineToPath(BaseX + PosX, BaseY + PosY);
+    Exit(True);
+  end;
+  // dx1 dy1 dx2 dy2 dx3 dy3 rcurveto – Perform relative curveto
+  if AToken.StrValue = 'rcurveto' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Param3 := TPSToken(Stack.Pop);
+    Param4 := TPSToken(Stack.Pop);
+    Param5 := TPSToken(Stack.Pop);
+    Param6 := TPSToken(Stack.Pop);
+    PostScriptCoordsToFPVectorialCoords(Param1, Param2, PosX, PosY);
+    PostScriptCoordsToFPVectorialCoords(Param3, Param4, PosX2, PosY2);
+    PostScriptCoordsToFPVectorialCoords(Param5, Param6, PosX3, PosY3);
+    AData.GetCurrenPathPenPos(BaseX, BaseY);
+    AData.AddBezierToPath(BaseX + PosX, BaseY + PosY, BaseX + PosX2, BaseY + PosY2, BaseX + PosX3, BaseY + PosY3);
+    Exit(True);
+  end;
+  // – eoclip – Clip using even-odd rule
+  if AToken.StrValue = 'eoclip' then
+  begin
+    Exit(True);
+  end
+end;
+
+{  Graphics State Operators (Device-Independent)
+
+  – gsave –                    Push graphics state
+  – grestore –                 Pop graphics state
+  – clipsave –                 Push clipping path
+  – cliprestore –              Pop clipping path
+  – grestoreall –              Pop to bottommost graphics state
+  – initgraphics –             Reset graphics state parameters
+  – gstate gstate              Create graphics state object
+  gstate setgstate –           Set graphics state from gstate
+  gstate currentgstate gstate  Copy current graphics state into gstate
+  num setlinewidth –           Set line width
+  – currentlinewidth num       Return current line width
+  int setlinecap –             Set shape of line ends for stroke (0 = butt,
+                               1 = round, 2 = square)
+  – currentlinecap int         Return current line cap
+  int setlinejoin –            Set shape of corners for stroke (0 = miter,
+                               1 = round, 2 = bevel)
+  – currentlinejoin int Return current line join
+  num setmiterlimit – Set miter length limit
+  – currentmiterlimit num Return current miter limit
+  bool setstrokeadjust – Set stroke adjustment (false = disable,
+  true = enable)
+  – currentstrokeadjust bool Return current stroke adjustment
+  array offset setdash – Set dash pattern for stroking
+  – currentdash array offset Return current dash pattern
+  array|name setcolorspace – Set color space
+  – currentcolorspace array Return current color space
+  comp1 … compn setcolor – Set color components
+  pattern setcolor – Set colored tiling pattern as current color
+  comp1 … compn pattern setcolor – Set uncolored tiling pattern as current color
+  – currentcolor comp1 … compn Return current color components
+  num setgray – Set color space to DeviceGray and color to
+  specified gray value (0 = black, 1 = white)
+  – currentgray num Return current color as gray value
+  hue saturation brightness sethsbcolor – Set color space to DeviceRGB and color to
+  specified hue, saturation, brightness
+  – currenthsbcolor hue saturation brightness
+  Return current color as hue, saturation,
+  brightness
+  red green blue setrgbcolor – Set color space to DeviceRGB and color to
+  specified red, green, blue
+  – currentrgbcolor red green blue Return current color as red, green, blue
+  cyan magenta yellow black setcmykcolor – Set color space to DeviceCMYK and color to
+  specified cyan, magenta, yellow, black
+  – currentcmykcolor cyan magenta yellow black
+  Return current color as cyan, magenta,
+  yellow, black
+}
+function TvEPSVectorialReader.ExecuteGraphicStateOperatorsDI(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  //
+  if AToken.StrValue = 'setlinewidth' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Exit(True);
+  end;
+  //
+  if AToken.StrValue = 'setlinejoin' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Exit(True);
+  end;
+end;
+
+{  Graphics State Operators (Device-Dependent)
+
+  halftone sethalftone – Set halftone dictionary
+  – currenthalftone halftone
+  Return current halftone dictionary
+  frequency angle proc setscreen – Set gray halftone screen by frequency, angle,
+  and spot function
+  frequency angle halftone setscreen – Set gray halftone screen from halftone
+  dictionary
+  – currentscreen frequency angle proc|halftone
+  Return current gray halftone screen
+  redfreq redang redproc|redhalftone
+  greenfreq greenang greenproc|greenhalftone
+  bluefreq blueang blueproc|bluehalftone
+  grayfreq grayang grayproc|grayhalftone setcolorscreen – Set all four halftone screens
+  – currentcolorscreen redfreq redang redproc|redhalftone
+  greenfreq greenang greenproc|greenhalftone
+  bluefreq blueang blueproc|bluehalftone
+  grayfreq grayang grayproc|grayhalftone
+  Return all four halftone screens
+  proc settransfer – Set gray transfer function
+  – currenttransfer proc
+  Return current gray transfer function
+  redproc greenproc blueproc grayproc setcolortransfer – Set all four transfer functions
+  – currentcolortransfer redproc greenproc blueproc grayproc
+  Return current transfer functions
+  proc setblackgeneration – Set black-generation function
+  – currentblackgeneration proc
+  Return current black-generation function
+  proc setundercolorremoval – Set undercolor-removal function
+  – currentundercolorremoval proc
+  Return current undercolor-removal
+  function
+  dict setcolorrendering – Set CIE-based color rendering dictionary
+  – currentcolorrendering dict
+  Return current CIE-based color rendering
+  dictionary
+  num setflat – Set flatness tolerance
+  – currentflat num Return current flatness
+  bool setoverprint – Set overprint parameter
+  – currentoverprint bool Return current overprint parameter
+  num setsmoothness – Set smoothness parameter
+  – currentsmoothness num Return current smoothness parameter
+  Coordinate System and Matrix Operators
+  – matrix matrix Create identity matrix
+  – initmatrix – Set CTM to device default
+  matrix identmatrix matrix Fill matrix with identity transform
+  matrix defaultmatrix matrix Fill matrix with device default matrix
+  matrix currentmatrix matrix Fill matrix with CTM
+  matrix setmatrix – Replace CTM by matrix
+  tx ty translate – Translate user space by (tx , ty)
+  tx ty matrix translate matrix Define translation by (tx , ty)
+  sx sy scale – Scale user space by sx and sy
+  sx sy matrix scale matrix Define scaling by sx and sy
+  angle rotate – Rotate user space by angle degrees
+  angle matrix rotate matrix Define rotation by angle degrees
+  matrix concat – Replace CTM by matrix ´ CTM
+  matrix1 matrix2 matrix3 concatmatrix matrix3 Fill matrix3 with matrix1 ´ matrix2
+  x y transform x¢ y¢ Transform (x, y) by CTM
+  x y matrix transform x¢ y¢ Transform (x, y) by matrix
+  dx dy dtransform dx¢ dy¢ Transform distance (dx, dy) by CTM
+  dx dy matrix dtransform dx¢ dy¢ Transform distance (dx, dy) by matrix
+  x¢ y¢ itransform x y Perform inverse transform of (x¢, y¢) by
+  CTM
+  x¢ y¢ matrix itransform x y Perform inverse transform of (x¢, y¢) by
+  matrix
+  dx¢ dy¢ idtransform dx dy Perform inverse transform of distance
+  (dx¢, dy¢) by CTM
+  dx¢ dy¢ matrix idtransform dx dy Perform inverse transform of distance
+  (dx¢, dy¢) by matrix
+  matrix1 matrix2 invertmatrix matrix2 Fill matrix2 with inverse of matrix1
+}
+function TvEPSVectorialReader.ExecuteGraphicStateOperatorsDD(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  //
+  if AToken.StrValue = 'scale' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Exit(True);
+  end;
+end;
+
+{  Dictionary Operators
+
+  int dict dict Create dictionary with capacity for int
+  elements
+  – << mark             Start dictionary construction
+  mark key1 value1 … keyn valuen >> dict
+                        End dictionary construction
+  dict length int       Return number of entries in dict
+  dict maxlength int    Return current capacity of dict
+  dict begin –          Push dict on dictionary stack
+  – end –               Pop current dictionary off dictionary stack
+  key value def –       Associate key and value in current dictionary
+  key load value        Search dictionary stack for key and return
+                        associated value
+  key value store –     Replace topmost definition of key
+  dict key get any      Return value associated with key in dict
+  dict key value put –  Associate key with value in dict
+  dict key undef –      Remove key and its value from dict
+  dict key known bool Test whether key is in dict
+  key where dict true Find dictionary in which key is defined
+  or false
+  dict1 dict2 copy dict2 Copy contents of dict1 to dict2
+  dict proc forall – Execute proc for each entry in dict
+  – currentdict dict Return current dictionary
+  – errordict dict Return error handler dictionary
+  – $error dict Return error control and status dictionary
+  – systemdict dict Return system dictionary
+  – userdict dict Return writeable dictionary in local VM
+  – globaldict dict Return writeable dictionary in global VM
+  – statusdict dict Return product-dependent dictionary
+  – countdictstack int Count elements on dictionary stack
+  array dictstack subarray Copy dictionary stack into array
+  – cleardictstack – Pop all nonpermanent dictionaries off
+  dictionary stack
+}
+function TvEPSVectorialReader.ExecuteDictionaryOperators(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+var
+  Param1, Param2: TPSToken;
+begin
+  Result := False;
+
+  // Adds a dictionary definition
+  if AToken.StrValue = 'def' then
+  begin
+    Param1 := TPSToken(Stack.Pop);
+    Param2 := TPSToken(Stack.Pop);
+    Dictionary.AddObject(Param2.StrValue, Param1);
+    Exit(True);
+  end;
+
+  // Can be ignored
+  if AToken.StrValue = 'load' then
+  begin
+    Exit(True);
+  end;
+end;
+
+{  Miscellaneous Operators
+
+  proc bind proc Replace operator names in proc with
+  operators; perform idiom recognition
+  – null null Push null on stack
+  – version string Return interpreter version
+  – realtime int Return real time in milliseconds
+  – usertime int Return execution time in milliseconds
+  – languagelevel int Return LanguageLevel
+  – product string Return product name
+  – revision int Return product revision level
+  – serialnumber int Return machine serial number
+  – executive – Invoke interactive executive
+  bool echo – Turn echoing on or off
+  – prompt – Executed when ready for interactive input
+}
+function TvEPSVectorialReader.ExecuteMiscellaneousOperators(
+  AToken: TExpressionToken; AData: TvVectorialDocument): Boolean;
+begin
+  Result := False;
+
+  // Just a hint for more efficient parsing, we can ignore
+  if AToken.StrValue = 'bind' then
+  begin
+    Exit(True);
+  end;
+end;
+
+procedure TvEPSVectorialReader.PostScriptCoordsToFPVectorialCoords(AParam1,
+  AParam2: TPSToken; var APosX, APosY: Double);
+begin
+  APosX := AParam2.FloatValue;
+  APosY := AParam1.FloatValue;
+end;
+
+procedure TvEPSVectorialReader.DictionarySubstituteOperator(
+  ADictionary: TStringList; var ACurToken: TPSToken);
+var
+  lIndex: Integer;
+  SubstituteToken, NewToken: TPSToken;
+begin
+  lIndex := ADictionary.IndexOf(ACurToken.StrValue);
+  if lIndex >= 0 then
+  begin
+    SubstituteToken := TPSToken(ADictionary.Objects[lIndex]);
+
+    if SubstituteToken is TExpressionToken then
+    begin
+      ACurToken.StrValue := SubstituteToken.StrValue;
+      ACurToken.FloatValue := SubstituteToken.FloatValue;
+    end
+    else if SubstituteToken is TProcedureToken then
+    begin
+      ACurToken := SubstituteToken;
+    end;
+    if ACurToken.StrValue = '' then raise Exception.Create('[TvEPSVectorialReader.DictionarySubstituteOperator] The Dictionary substitution resulted in an empty value');
+  end;
+end;
+
+constructor TvEPSVectorialReader.Create;
+begin
+  inherited Create;
+
+  FPointSeparator := SysUtils.DefaultFormatSettings;
+  FPointSeparator.DecimalSeparator := '.';
+  FPointSeparator.ThousandSeparator := ',';
+
+  Tokenizer := TPSTokenizer.Create;
+  Stack := TObjectStack.Create;
+  Dictionary := TStringList.Create;
+end;
+
+destructor TvEPSVectorialReader.Destroy;
+begin
+  Tokenizer.Free;
+  Stack.Free;
+  Dictionary.Free;
+
+  inherited Destroy;
+end;
+
+procedure TvEPSVectorialReader.ReadFromStream(AStream: TStream;
+  AData: TvVectorialDocument);
+begin
+  Tokenizer.ReadFromStream(AStream);
+  Tokenizer.DebugOut();
+
+  // Make sure we have at least one path
+  AData.StartPath();
+
+  RunPostScript(Tokenizer.Tokens, AData);
+
+  // Make sure we have at least one path
+  AData.EndPath();
+end;
+
+initialization
+
+  RegisterVectorialReader(TvEPSVectorialReader, vfEncapsulatedPostScript);
+
+end.
+

+ 2 - 2
packages/fpvectorial/src/fpvectbuildunit.pas

@@ -4,7 +4,7 @@ interface
 Uses
    avisocncgcodereader,avisocncgcodewriter,avisozlib,fpvectorial,
    fpvtocanvas,pdfvectorialreader,pdfvrlexico,pdfvrsemantico,pdfvrsintatico,
-   svgvectorialwriter,cdrvectorialreader;
+   svgvectorialwriter,cdrvectorialreader,epsvectorialreader;
 
 implementation
-end.
+end.

+ 320 - 91
packages/fpvectorial/src/fpvectorial.pas

@@ -18,14 +18,17 @@ unit fpvectorial;
 interface
 
 uses
-  Classes, SysUtils, Math;
+  Classes, SysUtils, Math,
+  fpcanvas, fpimage;
 
 type
   TvVectorialFormat = (
     { Multi-purpose document formats }
-    vfPDF, vfPostScript, vfSVG, vfCorelDrawCDR, vfWindowsMetafileWMF,
+    vfPDF, vfSVG, vfCorelDrawCDR, vfWindowsMetafileWMF,
     { CAD formats }
     vfDXF,
+    { Printing formats }
+    vfPostScript, vfEncapsulatedPostScript,
     { GCode formats }
     vfGCodeAvisoCNCPrototipoV5, vfGCodeAvisoCNCPrototipoV6);
 
@@ -37,10 +40,45 @@ const
   STR_SVG_EXTENSION = '.svg';
   STR_CORELDRAW_EXTENSION = '.cdr';
   STR_WINMETAFILE_EXTENSION = '.wmf';
+  STR_AUTOCAD_EXCHANGE_EXTENSION = '.dxf';
+  STR_ENCAPSULATEDPOSTSCRIPT_EXTENSION = '.eps';
 
 type
+  { Pen, Brush and Font }
+
+  TvPen = record
+    Color: TFPColor;
+    Style: TFPPenStyle;
+    Width: Integer;
+  end;
+
+  TvBrush = record
+    Color: TFPColor;
+    Style: TFPBrushStyle;
+  end;
+
+  TvFont = record
+    Color: TFPColor;
+    Size: integer;
+    Name: utf8string;
+    {@@
+      Font orientation is measured in degrees and uses the
+      same direction as the LCL TFont.orientation, which is counter-clockwise.
+      Zero is the normal, horizontal, orientation.
+    }
+    Orientation: Double;
+  end;
+
+  { Coordinates and polyline segments }
+
+  T3DPoint = record
+    X, Y, Z: Double;
+  end;
+
+  P3DPoint = ^T3DPoint;
+
   TSegmentType = (
-    st2DLine, st2DBezier,
+    st2DLine, st2DLineWithPen, st2DBezier,
     st3DLine, st3DBezier, stMoveTo);
 
   {@@
@@ -70,6 +108,11 @@ type
     X, Y: Double;
   end;
 
+  T2DSegmentWithPen = class(T2DSegment)
+  public
+    Pen: TvPen;
+  end;
+
   {@@
     In Bezier segments, we remain using the X and Y coordinates for the ending point.
     The starting point is where the previous segment ended, so that the intermediary
@@ -96,13 +139,30 @@ type
     X3, Y3, Z3: Double;
   end;
 
-  TPath = class
+  { Now all elements }
+
+  {@@
+    All elements should derive from TvEntity, regardless of whatever properties
+    they might contain.
+  }
+
+  TvEntity = class
+  public
+    {@@ The global Pen for the entire entity. In the case of paths, individual
+        elements might be able to override this setting. }
+    Pen: TvPen;
+    {@@ The global Brush for the entire entity. In the case of paths, individual
+        elements might be able to override this setting. }
+    Brush: TvBrush;
+    constructor Create; virtual;
+  end;
+
+  TPath = class(TvEntity)
     Len: Integer;
     Points: TPathSegment; // Beginning of the double-linked list
     PointsEnd: TPathSegment; // End of the double-linked list
     CurPoint: TPathSegment; // Used in PrepareForSequentialReading and Next
-    procedure Assign(APath: TPath);
-    function Count(): TPathSegment;
+    procedure Assign(ASource: TPath);
     procedure PrepareForSequentialReading;
     function Next(): TPathSegment;
   end;
@@ -113,18 +173,11 @@ type
     At the moment fonts are unsupported, only simple texts
     up to 255 chars are supported.
   }
-  TvText = class
+  TvText = class(TvEntity)
   public
     X, Y, Z: Double; // Z is ignored in 2D formats
-    FontSize: integer;
-    FontName: utf8string;
     Value: utf8string;
-  end;
-
-  {@@
-  }
-  TvEntity = class
-  public
+    Font: TvFont;
   end;
 
   {@@
@@ -145,9 +198,6 @@ type
 
   {@@
   }
-
-  { TvEllipse }
-
   TvEllipse = class(TvEntity)
   public
     // Mandatory fields
@@ -159,6 +209,41 @@ type
     procedure CalculateBoundingRectangle;
   end;
 
+  {@@
+   The brush has no effect in this class
+
+   DimensionLeft ---text--- DimensionRight
+                 |        |
+                 |        | BaseRight
+                 |
+                 | BaseLeft
+  }
+
+  { TvAlignedDimension }
+
+  TvAlignedDimension = class(TvEntity)
+  public
+    // Mandatory fields
+    BaseLeft, BaseRight, DimensionLeft, DimensionRight: T3DPoint;
+  end;
+
+  {@@
+   Vectorial images can contain raster images inside them and this entity
+   represents this.
+
+   If the Width and Height differ from the same data in the image, then
+   the raster image will be stretched.
+
+   Note that TFPCustomImage does not implement a storage, so the property
+   RasterImage should be filled with either a FPImage.TFPMemoryImage or with
+   a TLazIntfImage. The property RasterImage might be nil.
+  }
+  TvRasterImage = class(TvEntity)
+  public
+    RasterImage: TFPCustomImage;
+    Top, Left, Width, Height: Double;
+  end;
+
 type
 
   TvCustomVectorialWriter = class;
@@ -168,8 +253,6 @@ type
 
   TvVectorialDocument = class
   private
-    FPaths: TFPList;
-    FTexts: TFPList;
     FEntities: TFPList;
     FTmpPath: TPath;
     FTmpText: TvText;
@@ -184,10 +267,14 @@ type
     { Base methods }
     constructor Create;
     destructor Destroy; override;
-    procedure WriteToFile(AFileName: string; AFormat: TvVectorialFormat);
+    procedure Assign(ASource: TvVectorialDocument);
+    procedure AssignTo(ADest: TvVectorialDocument);
+    procedure WriteToFile(AFileName: string; AFormat: TvVectorialFormat); overload;
+    procedure WriteToFile(AFileName: string); overload;
     procedure WriteToStream(AStream: TStream; AFormat: TvVectorialFormat);
     procedure WriteToStrings(AStrings: TStrings; AFormat: TvVectorialFormat);
-    procedure ReadFromFile(AFileName: string; AFormat: TvVectorialFormat);
+    procedure ReadFromFile(AFileName: string; AFormat: TvVectorialFormat); overload;
+    procedure ReadFromFile(AFileName: string); overload;
     procedure ReadFromStream(AStream: TStream; AFormat: TvVectorialFormat);
     procedure ReadFromStrings(AStrings: TStrings; AFormat: TvVectorialFormat);
     class function GetFormatFromExtension(AFileName: string): TvVectorialFormat;
@@ -195,27 +282,35 @@ type
     { Data reading methods }
     function  GetPath(ANum: Cardinal): TPath;
     function  GetPathCount: Integer;
-    function  GetText(ANum: Cardinal): TvText;
-    function  GetTextCount: Integer;
     function  GetEntity(ANum: Cardinal): TvEntity;
-    function  GetEntityCount: Integer;
+    function  GetEntitiesCount: Integer;
     { Data removing methods }
     procedure Clear;
-    procedure RemoveAllPaths;
-    procedure RemoveAllTexts;
     { Data writing methods }
-    procedure AddPath(APath: TPath);
-    procedure StartPath(AX, AY: Double);
+    procedure AddEntity(AEntity: TvEntity);
+    procedure AddPathCopyMem(APath: TPath);
+    procedure StartPath(AX, AY: Double); overload;
+    procedure StartPath(); overload;
+    procedure AddMoveToPath(AX, AY: Double);
     procedure AddLineToPath(AX, AY: Double); overload;
+    procedure AddLineToPath(AX, AY: Double; AColor: TFPColor); overload;
     procedure AddLineToPath(AX, AY, AZ: Double); overload;
+    procedure GetCurrenPathPenPos(var AX, AY: Double);
     procedure AddBezierToPath(AX1, AY1, AX2, AY2, AX3, AY3: Double); overload;
     procedure AddBezierToPath(AX1, AY1, AZ1, AX2, AY2, AZ2, AX3, AY3, AZ3: Double); overload;
+    procedure SetBrushColor(AColor: TFPColor);
+    procedure SetBrushStyle(AStyle: TFPBrushStyle);
+    procedure SetPenColor(AColor: TFPColor);
+    procedure SetPenStyle(AStyle: TFPPenStyle);
+    procedure SetPenWidth(AWidth: Integer);
     procedure EndPath();
     procedure AddText(AX, AY, AZ: Double; FontName: string; FontSize: integer; AText: utf8string); overload;
     procedure AddText(AX, AY, AZ: Double; AStr: utf8string); overload;
     procedure AddCircle(ACenterX, ACenterY, ACenterZ, ARadius: Double);
-    procedure AddCircularArc(ACenterX, ACenterY, ACenterZ, ARadius, AStartAngle, AEndAngle: Double);
+    procedure AddCircularArc(ACenterX, ACenterY, ACenterZ, ARadius, AStartAngle, AEndAngle: Double; AColor: TFPColor);
     procedure AddEllipse(CenterX, CenterY, CenterZ, MajorHalfAxis, MinorHalfAxis, Angle: Double);
+    // Dimensions
+    procedure AddAlignedDimension(BaseLeft, BaseRight, DimLeft, DimRight: T3DPoint);
     { properties }
     property PathCount: Integer read GetPathCount;
     property Paths[Index: Cardinal]: TPath read GetPath;
@@ -272,6 +367,7 @@ procedure RegisterVectorialReader(
 procedure RegisterVectorialWriter(
   AWriterClass: TvVectorialWriterClass;
   AFormat: TvVectorialFormat);
+function Make2DPoint(AX, AY: Double): T3DPoint;
 
 implementation
 
@@ -362,6 +458,23 @@ begin
   end;
 end;
 
+function Make2DPoint(AX, AY: Double): T3DPoint;
+begin
+  Result.X := AX;
+  Result.Y := AY;
+  Result.Z := 0;
+end;
+
+{ TvEntity }
+
+constructor TvEntity.Create;
+begin
+  Pen.Style := psSolid;
+  Pen.Color := colBlack;
+  Brush.Style := bsClear;
+  Brush.Color := colBlue;
+end;
+
 { TvEllipse }
 
 procedure TvEllipse.CalculateBoundingRectangle;
@@ -415,8 +528,6 @@ constructor TvVectorialDocument.Create;
 begin
   inherited Create;
 
-  FPaths := TFPList.Create;
-  FTexts := TFPList.Create;
   FEntities := TFPList.Create;
   FTmpPath := TPath.Create;
 end;
@@ -428,40 +539,35 @@ destructor TvVectorialDocument.Destroy;
 begin
   Clear;
 
-  FPaths.Free;
-  FTexts.Free;
   FEntities.Free;
 
   inherited Destroy;
 end;
 
-{@@
-  Clears the list of Vectors and releases their memory.
-}
-procedure TvVectorialDocument.RemoveAllPaths;
+procedure TvVectorialDocument.Assign(ASource: TvVectorialDocument);
+var
+  i: Integer;
 begin
-//  FPaths.ForEachCall(RemoveCallback, nil);
-  FPaths.Clear;
+  Clear;
+
+  for i := 0 to ASource.GetEntitiesCount - 1 do
+    Self.AddEntity(ASource.GetEntity(i));
 end;
 
-procedure TvVectorialDocument.RemoveAllTexts;
+procedure TvVectorialDocument.AssignTo(ADest: TvVectorialDocument);
 begin
-//  FTexts.ForEachCall(RemoveCallback, nil);
-  FTexts.Clear;
+  ADest.Assign(Self);
 end;
 
-procedure TvVectorialDocument.AddPath(APath: TPath);
+procedure TvVectorialDocument.AddPathCopyMem(APath: TPath);
 var
   lPath: TPath;
   Len: Integer;
 begin
   lPath := TPath.Create;
   lPath.Assign(APath);
-  FPaths.Add(Pointer(lPath));
+  AddEntity(lPath);
   //WriteLn(':>TvVectorialDocument.AddPath 1 Len = ', Len);
-  //WriteLn(':>TvVectorialDocument.AddPath 2');
-  //WriteLn(':>TvVectorialDocument.AddPath 3');
-  //WriteLn(':>TvVectorialDocument.AddPath 4');
 end;
 
 {@@
@@ -487,6 +593,23 @@ begin
   FTmpPath.PointsEnd := segment;
 end;
 
+procedure TvVectorialDocument.StartPath();
+begin
+  ClearTmpPath();
+end;
+
+procedure TvVectorialDocument.AddMoveToPath(AX, AY: Double);
+var
+  segment: T2DSegment;
+begin
+  segment := T2DSegment.Create;
+  segment.SegmentType := stMoveTo;
+  segment.X := AX;
+  segment.Y := AY;
+
+  AppendSegmentToTmpPath(segment);
+end;
+
 {@@
   Adds one more point to the end of a Path being
   writing in multiple steps.
@@ -509,6 +632,19 @@ begin
   AppendSegmentToTmpPath(segment);
 end;
 
+procedure TvVectorialDocument.AddLineToPath(AX, AY: Double; AColor: TFPColor);
+var
+  segment: T2DSegmentWithPen;
+begin
+  segment := T2DSegmentWithPen.Create;
+  segment.SegmentType := st2DLineWithPen;
+  segment.X := AX;
+  segment.Y := AY;
+  segment.Pen.Color := AColor;
+
+  AppendSegmentToTmpPath(segment);
+end;
+
 procedure TvVectorialDocument.AddLineToPath(AX, AY, AZ: Double);
 var
   segment: T3DSegment;
@@ -522,6 +658,18 @@ begin
   AppendSegmentToTmpPath(segment);
 end;
 
+{@@
+  Gets the current Pen Pos in the temporary path
+}
+procedure TvVectorialDocument.GetCurrenPathPenPos(var AX, AY: Double);
+begin
+  // Check if we are the first segment in the tmp path
+  if FTmpPath.PointsEnd = nil then raise Exception.Create('[TvVectorialDocument.GetCurrenPathPenPos] One cannot obtain the Pen Pos if there are no segments in the temporary path');
+
+  AX := T2DSegment(FTmpPath.PointsEnd).X;
+  AY := T2DSegment(FTmpPath.PointsEnd).Y;
+end;
+
 {@@
   Adds a bezier element to the path. It starts where the previous element ended
   and it goes throw the control points [AX1, AY1] and [AX2, AY2] and ends
@@ -564,6 +712,31 @@ begin
   AppendSegmentToTmpPath(segment);
 end;
 
+procedure TvVectorialDocument.SetBrushColor(AColor: TFPColor);
+begin
+  FTmPPath.Brush.Color := AColor;
+end;
+
+procedure TvVectorialDocument.SetBrushStyle(AStyle: TFPBrushStyle);
+begin
+  FTmPPath.Brush.Style := AStyle;
+end;
+
+procedure TvVectorialDocument.SetPenColor(AColor: TFPColor);
+begin
+  FTmPPath.Pen.Color := AColor;
+end;
+
+procedure TvVectorialDocument.SetPenStyle(AStyle: TFPPenStyle);
+begin
+  FTmPPath.Pen.Style := AStyle;
+end;
+
+procedure TvVectorialDocument.SetPenWidth(AWidth: Integer);
+begin
+  FTmPPath.Pen.Width := AWidth;
+end;
+
 {@@
   Finishes writing a Path, which was created in multiple
   steps using StartPath and AddPointToPath,
@@ -577,7 +750,7 @@ end;
 procedure TvVectorialDocument.EndPath();
 begin
   if FTmPPath.Len = 0 then Exit;
-  AddPath(FTmPPath);
+  AddPathCopyMem(FTmPPath);
   ClearTmpPath();
 end;
 
@@ -590,9 +763,9 @@ begin
   lText.X := AX;
   lText.Y := AY;
   lText.Z := AZ;
-  lText.FontName := FontName;
-  lText.FontSize := FontSize;
-  FTexts.Add(lText);
+  lText.Font.Name := FontName;
+  lText.Font.Size := FontSize;
+  AddEntity(lText);
 end;
 
 procedure TvVectorialDocument.AddText(AX, AY, AZ: Double; AStr: utf8string);
@@ -609,11 +782,11 @@ begin
   lCircle.CenterY := ACenterY;
   lCircle.CenterZ := ACenterZ;
   lCircle.Radius := ARadius;
-  FEntities.Add(lCircle);
+  AddEntity(lCircle);
 end;
 
 procedure TvVectorialDocument.AddCircularArc(ACenterX, ACenterY, ACenterZ,
-  ARadius, AStartAngle, AEndAngle: Double);
+  ARadius, AStartAngle, AEndAngle: Double; AColor: TFPColor);
 var
   lCircularArc: TvCircularArc;
 begin
@@ -624,7 +797,8 @@ begin
   lCircularArc.Radius := ARadius;
   lCircularArc.StartAngle := AStartAngle;
   lCircularArc.EndAngle := AEndAngle;
-  FEntities.Add(lCircularArc);
+  lCircularArc.Pen.Color := AColor;
+  AddEntity(lCircularArc);
 end;
 
 procedure TvVectorialDocument.AddEllipse(CenterX, CenterY, CenterZ,
@@ -639,7 +813,28 @@ begin
   lEllipse.MajorHalfAxis := MajorHalfAxis;
   lEllipse.MinorHalfAxis := MinorHalfAxis;
   lEllipse.Angle := Angle;
-  FEntities.Add(lEllipse);
+  AddEntity(lEllipse);
+end;
+
+{@@
+  Don't free the passed TvText because it will be added directly to the list
+}
+procedure TvVectorialDocument.AddEntity(AEntity: TvEntity);
+begin
+  FEntities.Add(Pointer(AEntity));
+end;
+
+procedure TvVectorialDocument.AddAlignedDimension(BaseLeft, BaseRight,
+  DimLeft, DimRight: T3DPoint);
+var
+  lDim: TvAlignedDimension;
+begin
+  lDim := TvAlignedDimension.Create;
+  lDim.BaseLeft := BaseLeft;
+  lDim.BaseRight := BaseRight;
+  lDim.DimensionLeft := DimLeft;
+  lDim.DimensionRight := DimRight;
+  AddEntity(lDim);
 end;
 
 {@@
@@ -655,12 +850,13 @@ begin
   for i := 0 to Length(GvVectorialFormats) - 1 do
     if GvVectorialFormats[i].Format = AFormat then
     begin
-      Result := GvVectorialFormats[i].WriterClass.Create;
+      if GvVectorialFormats[i].WriterClass <> nil then
+        Result := GvVectorialFormats[i].WriterClass.Create;
 
       Break;
     end;
 
-  if Result = nil then raise Exception.Create('Unsuported vector graphics format.');
+  if Result = nil then raise Exception.Create('Unsupported vector graphics format.');
 end;
 
 {@@
@@ -676,12 +872,13 @@ begin
   for i := 0 to Length(GvVectorialFormats) - 1 do
     if GvVectorialFormats[i].Format = AFormat then
     begin
-      Result := GvVectorialFormats[i].ReaderClass.Create;
+      if GvVectorialFormats[i].ReaderClass <> nil then
+        Result := GvVectorialFormats[i].ReaderClass.Create;
 
       Break;
     end;
 
-  if Result = nil then raise Exception.Create('Unsuported vector graphics format.');
+  if Result = nil then raise Exception.Create('Unsupported vector graphics format.');
 end;
 
 procedure TvVectorialDocument.ClearTmpPath();
@@ -700,14 +897,28 @@ begin
   FTmpPath.Points := nil;
   FTmpPath.PointsEnd := nil;
   FTmpPath.Len := 0;
+  FTmpPath.Brush.Color := colBlue;
+  FTmpPath.Brush.Style := bsClear;
+  FTmpPath.Pen.Color := colBlack;
+  FTmpPath.Pen.Style := psSolid;
+  FTmpPath.Pen.Width := 1;
 end;
 
 procedure TvVectorialDocument.AppendSegmentToTmpPath(ASegment: TPathSegment);
 var
   L: Integer;
 begin
+  // Check if we are the first segment in the tmp path
   if FTmpPath.PointsEnd = nil then
-    Exception.Create('[TvVectorialDocument.AppendSegmentToTmpPath]' + Str_Error_Nil_Path);
+  begin
+    if FTmpPath.Len <> 0 then
+      Exception.Create('[TvVectorialDocument.AppendSegmentToTmpPath]' + Str_Error_Nil_Path);
+
+    FTmpPath.Points := ASegment;
+    FTmpPath.PointsEnd := ASegment;
+    FTmpPath.Len := 1;
+    Exit;
+  end;
 
   L := FTmpPath.Len;
   Inc(FTmpPath.Len);
@@ -736,6 +947,14 @@ begin
   end;
 end;
 
+procedure TvVectorialDocument.WriteToFile(AFileName: string);
+var
+  lFormat: TvVectorialFormat;
+begin
+  lFormat := GetFormatFromExtension(ExtractFileExt(AFileName));
+  WriteToFile(AFileName, lFormat);
+end;
+
 {@@
   Writes the document to a stream
 }
@@ -786,6 +1005,17 @@ begin
   end;
 end;
 
+{@@
+  Reads the document from a file.  A variant that auto-detects the format from the extension.
+}
+procedure TvVectorialDocument.ReadFromFile(AFileName: string);
+var
+  lFormat: TvVectorialFormat;
+begin
+  lFormat := GetFormatFromExtension(ExtractFileExt(AFileName));
+  ReadFromFile(AFileName, lFormat);
+end;
+
 {@@
   Reads the document from a stream.
 
@@ -832,6 +1062,8 @@ begin
   else if AnsiCompareText(lExt, STR_SVG_EXTENSION) = 0 then Result := vfSVG
   else if AnsiCompareText(lExt, STR_CORELDRAW_EXTENSION) = 0 then Result := vfCorelDrawCDR
   else if AnsiCompareText(lExt, STR_WINMETAFILE_EXTENSION) = 0 then Result := vfWindowsMetafileWMF
+  else if AnsiCompareText(lExt, STR_AUTOCAD_EXCHANGE_EXTENSION) = 0 then Result := vfDXF
+  else if AnsiCompareText(lExt, STR_ENCAPSULATEDPOSTSCRIPT_EXTENSION) = 0 then Result := vfEncapsulatedPostScript
   else
     raise Exception.Create('TvVectorialDocument.GetFormatFromExtension: The extension (' + lExt + ') doesn''t match any supported formats.');
 end;
@@ -842,31 +1074,32 @@ begin
 end;
 
 function TvVectorialDocument.GetPath(ANum: Cardinal): TPath;
+var
+  i: Integer;
+  Index: Integer = - 1;
 begin
-  if ANum >= FPaths.Count then raise Exception.Create('TvVectorialDocument.GetPath: Path number out of bounds');
+  Result := nil;
 
-  if FPaths.Items[ANum] = nil then raise Exception.Create('TvVectorialDocument.GetPath: Invalid Path number');
+  if ANum >= FEntities.Count then raise Exception.Create('TvVectorialDocument.GetPath: Path number out of bounds');
 
-  Result := TPath(FPaths.Items[ANum]);
+  for i := 0 to FEntities.Count - 1 do
+  begin
+    if TvEntity(FEntities.Items[i]) is TPath then
+    begin
+      Inc(Index);
+      if Index = ANum then Result := TPath(FEntities.Items[i]);
+    end;
+  end;
 end;
 
 function TvVectorialDocument.GetPathCount: Integer;
+var
+  i: Integer;
 begin
-  Result := FPaths.Count;
-end;
-
-function TvVectorialDocument.GetText(ANum: Cardinal): TvText;
-begin
-  if ANum >= FTexts.Count then raise Exception.Create('TvVectorialDocument.GetText: Text number out of bounds');
-
-  if FTexts.Items[ANum] = nil then raise Exception.Create('TvVectorialDocument.GetText: Invalid Text number');
+  Result := 0;
 
-  Result := TvText(FTexts.Items[ANum]);
-end;
-
-function TvVectorialDocument.GetTextCount: Integer;
-begin
-  Result := FTexts.Count;
+  for i := 0 to FEntities.Count - 1 do
+    if TvEntity(FEntities.Items[i]) is TPath then Inc(Result);
 end;
 
 function TvVectorialDocument.GetEntity(ANum: Cardinal): TvEntity;
@@ -878,7 +1111,7 @@ begin
   Result := TvEntity(FEntities.Items[ANum]);
 end;
 
-function TvVectorialDocument.GetEntityCount: Integer;
+function TvVectorialDocument.GetEntitiesCount: Integer;
 begin
   Result := FEntities.Count;
 end;
@@ -888,8 +1121,7 @@ end;
 }
 procedure TvVectorialDocument.Clear;
 begin
-  RemoveAllPaths();
-  RemoveAllTexts();
+  FEntities.Clear();
 end;
 
 { TvCustomVectorialReader }
@@ -1000,17 +1232,14 @@ end;
 
 { TPath }
 
-procedure TPath.Assign(APath: TPath);
+procedure TPath.Assign(ASource: TPath);
 begin
-  Len := APath.Len;
-  Points := APath.Points;
-  PointsEnd := APath.PointsEnd;
-  CurPoint := APath.CurPoint;
-end;
-
-function TPath.Count(): TPathSegment;
-begin
-
+  Len := ASource.Len;
+  Points := ASource.Points;
+  PointsEnd := ASource.PointsEnd;
+  CurPoint := ASource.CurPoint;
+  Pen := ASource.Pen;
+  Brush := ASource.Brush;
 end;
 
 procedure TPath.PrepareForSequentialReading;

+ 350 - 105
packages/fpvectorial/src/fpvtocanvas.pas

@@ -10,21 +10,30 @@ uses
   Classes, SysUtils, Math,
   {$ifdef USE_LCL_CANVAS}
   Graphics, LCLIntf,
-  {$else}
-  fpcanvas,
   {$endif}
+  fpcanvas,
+  fpimage,
   fpvectorial;
 
 procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
-  {$ifdef USE_LCL_CANVAS}
-  ADest: TCanvas;
-  {$else}
   ADest: TFPCustomCanvas;
-  {$endif}
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+procedure DrawFPVPathToCanvas(ASource: TvVectorialDocument; CurPath: TPath;
+  ADest: TFPCustomCanvas;
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+procedure DrawFPVEntityToCanvas(ASource: TvVectorialDocument; CurEntity: TvEntity;
+  ADest: TFPCustomCanvas;
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+procedure DrawFPVTextToCanvas(ASource: TvVectorialDocument; CurText: TvText;
+  ADest: TFPCustomCanvas;
   ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
 
 implementation
 
+{$ifndef Windows}
+{$define FPVECTORIALDEBUG}
+{$endif}
+
 function Rotate2DPoint(P,Fix :TPoint; alpha:double): TPoint;
 var
   sinus, cosinus : Extended;
@@ -37,17 +46,16 @@ begin
 end;
 
 procedure DrawRotatedEllipse(
-  {$ifdef USE_LCL_CANVAS}
-  ADest: TCanvas;
-  {$else}
   ADest: TFPCustomCanvas;
-  {$endif}
   CurEllipse: TvEllipse;
   ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
 var
   PointList: array[0..6] of TPoint;
   f: TPoint;
   dk, x1, x2, y1, y2: Integer;
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest: TCanvas absolute ADest;
+  {$endif}
 begin
   {$ifdef USE_LCL_CANVAS}
   CurEllipse.CalculateBoundingRectangle();
@@ -72,7 +80,7 @@ begin
   // Conrollpoint of secondpart endpoint
   PointList[6] := PointList[0];   // Endpoint of
    // Back to the startpoint
-  ADest.PolyBezier(Pointlist[0]);
+  ALCLDest.PolyBezier(Pointlist[0]);
   {$endif}
 end;
 
@@ -90,15 +98,48 @@ end;
 
   DrawFPVectorialToCanvas(ASource, ADest, 0, ASource.Height, 1.0, -1.0);
 }
+{.$define FPVECTORIAL_TOCANVAS_DEBUG}
 procedure DrawFPVectorialToCanvas(ASource: TvVectorialDocument;
-  {$ifdef USE_LCL_CANVAS}
-  ADest: TCanvas;
-  {$else}
   ADest: TFPCustomCanvas;
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+var
+  i: Integer;
+  CurEntity: TvEntity;
+begin
+  {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+  WriteLn(':>DrawFPVectorialToCanvas');
+  {$endif}
+
+  for i := 0 to ASource.GetEntitiesCount - 1 do
+  begin
+    CurEntity := ASource.GetEntity(i);
+
+    if CurEntity is TPath then DrawFPVPathToCanvas(ASource, TPath(CurEntity), ADest, ADestX, ADestY, AMulX, AMulY)
+    else if CurEntity is TvText then DrawFPVTextToCanvas(ASource, TvText(CurEntity), ADest, ADestX, ADestY, AMulX, AMulY)
+    else DrawFPVEntityToCanvas(ASource, CurEntity, ADest, ADestX, ADestY, AMulX, AMulY);
+  end;
+
+  {$ifdef FPVECTORIALDEBUG}
+  WriteLn(':<DrawFPVectorialToCanvas');
   {$endif}
+end;
+
+procedure DrawFPVPathToCanvas(ASource: TvVectorialDocument; CurPath: TPath;
+  ADest: TFPCustomCanvas;
   ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+
+  function CoordToCanvasX(ACoord: Double): Integer;
+  begin
+    Result := Round(ADestX + AmulX * ACoord);
+  end;
+
+  function CoordToCanvasY(ACoord: Double): Integer;
+  begin
+    Result := Round(ADestY + AmulY * ACoord);
+  end;
+
 var
-  i, j, k: Integer;
+  j, k: Integer;
   PosX, PosY: Integer; // Not modified by ADestX, etc
   CurSegment: TPathSegment;
   Cur2DSegment: T2DSegment absolute CurSegment;
@@ -107,123 +148,327 @@ var
   CurX, CurY: Integer; // Not modified by ADestX, etc
   CurveLength: Integer;
   t: Double;
-  // For text
-  CurText: TvText;
-  // For entities
-  CurEntity: TvEntity;
-  CurCircle: TvCircle;
-  CurEllipse: TvEllipse;
-  CurArc: TvCircularArc;
 begin
-  {$ifdef FPVECTORIALDEBUG}
-  WriteLn(':>DrawFPVectorialToCanvas');
-  {$endif}
-
   PosX := 0;
   PosY := 0;
+  ADest.Brush.Style := bsClear;
 
   ADest.MoveTo(ADestX, ADestY);
 
-  // Draws all paths
-  for i := 0 to ASource.PathCount - 1 do
+  CurPath.PrepareForSequentialReading;
+
+  // Set the path Pen and Brush options
+  ADest.Pen.Style := CurPath.Pen.Style;
+  ADest.Pen.Width := CurPath.Pen.Width;
+  ADest.Brush.Style := CurPath.Brush.Style;
+  ADest.Pen.FPColor := CurPath.Pen.Color;
+  ADest.Brush.FPColor := CurPath.Brush.Color;
+
+  {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+  Write(Format('[Path] ID=%d', [i]));
+  {$endif}
+
+  for j := 0 to CurPath.Len - 1 do
   begin
-    //WriteLn('i = ', i);
-    ASource.Paths[i].PrepareForSequentialReading;
+    //WriteLn('j = ', j);
+    CurSegment := TPathSegment(CurPath.Next());
 
-    for j := 0 to ASource.Paths[i].Len - 1 do
+    case CurSegment.SegmentType of
+    stMoveTo:
+    begin
+      ADest.MoveTo(CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y));
+      {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+      Write(Format(' M%d,%d', [CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y)]));
+      {$endif}
+    end;
+    // This element can override temporarely the Pen
+    st2DLineWithPen:
     begin
-      //WriteLn('j = ', j);
-      CurSegment := TPathSegment(ASource.Paths[i].Next());
+      ADest.Pen.FPColor := T2DSegmentWithPen(Cur2DSegment).Pen.Color;
 
-      case CurSegment.SegmentType of
-      stMoveTo:
-      begin
-        ADest.MoveTo(
-          Round(ADestX + AMulX * Cur2DSegment.X),
-          Round(ADestY + AMulY * Cur2DSegment.Y)
-          );
-      end;
-      st2DLine, st3DLine:
-      begin
-        ADest.LineTo(
-          Round(ADestX + AMulX * Cur2DSegment.X),
-          Round(ADestY + AMulY * Cur2DSegment.Y)
-          );
-      end;
-      { To draw a bezier we need to divide the interval in parts and make
-        lines between this parts }
-      st2DBezier, st3DBezier:
+      ADest.LineTo(CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y));
+
+      ADest.Pen.FPColor := CurPath.Pen.Color;
+
+      {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+      Write(Format(' L%d,%d', [CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y)]));
+      {$endif}
+    end;
+    st2DLine, st3DLine:
+    begin
+      ADest.LineTo(CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y));
+      {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+      Write(Format(' L%d,%d', [CoordToCanvasX(Cur2DSegment.X), CoordToCanvasY(Cur2DSegment.Y)]));
+      {$endif}
+    end;
+    { To draw a bezier we need to divide the interval in parts and make
+      lines between this parts }
+    st2DBezier, st3DBezier:
+    begin
+      CurveLength :=
+        Round(sqrt(sqr(Cur2DBSegment.X3 - PosX) + sqr(Cur2DBSegment.Y3 - PosY))) +
+        Round(sqrt(sqr(Cur2DBSegment.X2 - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y2 - Cur2DBSegment.Y3))) +
+        Round(sqrt(sqr(Cur2DBSegment.X - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y - Cur2DBSegment.Y3)));
+
+      for k := 1 to CurveLength do
       begin
-        CurveLength :=
-          Round(sqrt(sqr(Cur2DBSegment.X3 - PosX) + sqr(Cur2DBSegment.Y3 - PosY))) +
-          Round(sqrt(sqr(Cur2DBSegment.X2 - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y2 - Cur2DBSegment.Y3))) +
-          Round(sqrt(sqr(Cur2DBSegment.X - Cur2DBSegment.X3) + sqr(Cur2DBSegment.Y - Cur2DBSegment.Y3)));
-
-        for k := 1 to CurveLength do
-        begin
-          t := k / CurveLength;
-          CurX := Round(sqr(1 - t) * (1 - t) * PosX + 3 * t * sqr(1 - t) * Cur2DBSegment.X2 + 3 * t * t * (1 - t) * Cur2DBSegment.X3 + t * t * t * Cur2DBSegment.X);
-          CurY := Round(sqr(1 - t) * (1 - t) * PosY + 3 * t * sqr(1 - t) * Cur2DBSegment.Y2 + 3 * t * t * (1 - t) * Cur2DBSegment.Y3 + t * t * t * Cur2DBSegment.Y);
-          ADest.LineTo(
-            Round(ADestX + AMulX * CurX),
-            Round(ADestY + AMulY * CurY));
-        end;
-        PosX := Round(Cur2DBSegment.X);
-        PosY := Round(Cur2DBSegment.Y);
-      end;
+        t := k / CurveLength;
+        CurX := Round(sqr(1 - t) * (1 - t) * PosX + 3 * t * sqr(1 - t) * Cur2DBSegment.X2 + 3 * t * t * (1 - t) * Cur2DBSegment.X3 + t * t * t * Cur2DBSegment.X);
+        CurY := Round(sqr(1 - t) * (1 - t) * PosY + 3 * t * sqr(1 - t) * Cur2DBSegment.Y2 + 3 * t * t * (1 - t) * Cur2DBSegment.Y3 + t * t * t * Cur2DBSegment.Y);
+        ADest.LineTo(CoordToCanvasX(CurX), CoordToCanvasY(CurY));
       end;
+      PosX := Round(Cur2DBSegment.X);
+      PosY := Round(Cur2DBSegment.Y);
+    end;
     end;
   end;
+  {$ifdef FPVECTORIAL_TOCANVAS_DEBUG}
+  WriteLn('');
+  {$endif}
+end;
+
+procedure DrawFPVEntityToCanvas(ASource: TvVectorialDocument; CurEntity: TvEntity;
+  ADest: TFPCustomCanvas;
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
 
-  // Draws all entities
-  for i := 0 to ASource.GetEntityCount - 1 do
+  function CoordToCanvasX(ACoord: Double): Integer;
   begin
-    CurEntity := ASource.GetEntity(i);
-    if CurEntity is TvCircle then
+    Result := Round(ADestX + AmulX * ACoord);
+  end;
+
+  function CoordToCanvasY(ACoord: Double): Integer;
+  begin
+    Result := Round(ADestY + AmulY * ACoord);
+  end;
+
+var
+  i: Integer;
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest: TCanvas;
+  {$endif}
+  // For entities
+  CurCircle: TvCircle;
+  CurEllipse: TvEllipse;
+  //
+  CurArc: TvCircularArc;
+  FinalStartAngle, FinalEndAngle: double;
+  BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
+   IntStartAngle, IntAngleLength, IntTmp: Integer;
+  //
+  CurDim: TvAlignedDimension;
+  Points: array of TPoint;
+  UpperDim, LowerDim: T3DPoint;
+begin
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest := TCanvas(ADest);
+  {$endif}
+
+  ADest.Brush.Style := CurEntity.Brush.Style;
+  ADest.Pen.Style := CurEntity.Pen.Style;
+  ADest.Pen.FPColor := CurEntity.Pen.Color;
+  ADest.Brush.FPColor := CurEntity.Brush.Color;
+
+  if CurEntity is TvCircle then
+  begin
+    CurCircle := CurEntity as TvCircle;
+    ADest.Ellipse(
+      CoordToCanvasX(CurCircle.CenterX - CurCircle.Radius),
+      CoordToCanvasY(CurCircle.CenterY - CurCircle.Radius),
+      CoordToCanvasX(CurCircle.CenterX + CurCircle.Radius),
+      CoordToCanvasY(CurCircle.CenterY + CurCircle.Radius)
+      );
+  end
+  else if CurEntity is TvEllipse then
+  begin
+    CurEllipse := CurEntity as TvEllipse;
+    DrawRotatedEllipse(ADest, CurEllipse);
+  end
+  else if CurEntity is TvCircularArc then
+  begin
+    CurArc := CurEntity as TvCircularArc;
+    {$ifdef USE_LCL_CANVAS}
+    // ToDo: Consider a X axis inversion
+    // If the Y axis is inverted, then we need to mirror our angles as well
+    BoundsLeft := CoordToCanvasX(CurArc.CenterX - CurArc.Radius);
+    BoundsTop := CoordToCanvasY(CurArc.CenterY - CurArc.Radius);
+    BoundsRight := CoordToCanvasX(CurArc.CenterX + CurArc.Radius);
+    BoundsBottom := CoordToCanvasY(CurArc.CenterY + CurArc.Radius);
+    {if AMulY > 0 then
+    begin}
+      FinalStartAngle := CurArc.StartAngle;
+      FinalEndAngle := CurArc.EndAngle;
+    {end
+    else // AMulY is negative
     begin
-      CurCircle := CurEntity as TvCircle;
-      ADest.Ellipse(
-        Round(ADestX + AmulX * (CurCircle.CenterX - CurCircle.Radius)),
-        Round(ADestY + AMulY * (CurCircle.CenterY - CurCircle.Radius)),
-        Round(ADestX + AmulX * (CurCircle.CenterX + CurCircle.Radius)),
-        Round(ADestY + AMulY * (CurCircle.CenterY + CurCircle.Radius))
-        );
-    end
-    else if CurEntity is TvEllipse then
+      // Inverting the angles generates the correct result for Y axis inversion
+      if CurArc.EndAngle = 0 then FinalStartAngle := 0
+      else FinalStartAngle := 360 - 1* CurArc.EndAngle;
+      if CurArc.StartAngle = 0 then FinalEndAngle := 0
+      else FinalEndAngle := 360 - 1* CurArc.StartAngle;
+    end;}
+    IntStartAngle := Round(16*FinalStartAngle);
+    IntAngleLength := Round(16*(FinalEndAngle - FinalStartAngle));
+    // On Gtk2 and Carbon, the Left really needs to be to the Left of the Right position
+    // The same for the Top and Bottom
+    // On Windows it works fine either way
+    // On Gtk2 if the positions are inverted then the arcs are screwed up
+    // In Carbon if the positions are inverted, then the arc is inverted
+    if BoundsLeft > BoundsRight then
+    begin
+      IntTmp := BoundsLeft;
+      BoundsLeft := BoundsRight;
+      BoundsRight := IntTmp;
+    end;
+    if BoundsTop > BoundsBottom then
+    begin
+      IntTmp := BoundsTop;
+      BoundsTop := BoundsBottom;
+      BoundsBottom := IntTmp;
+    end;
+    // Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer);
+    {$ifdef FPVECTORIALDEBUG}
+    WriteLn(Format('Drawing Arc Center=%f,%f Radius=%f StartAngle=%f AngleLength=%f',
+      [CurArc.CenterX, CurArc.CenterY, CurArc.Radius, IntStartAngle/16, IntAngleLength/16]));
+    {$endif}
+    ADest.Pen.FPColor := CurArc.Pen.Color;
+    ALCLDest.Arc(
+      BoundsLeft, BoundsTop, BoundsRight, BoundsBottom,
+      IntStartAngle, IntAngleLength
+      );
+    ADest.Pen.FPColor := colBlack;
+    // Debug info
+//      {$define FPVECTORIALDEBUG}
+//      {$ifdef FPVECTORIALDEBUG}
+//      WriteLn(Format('Drawing Arc x1y1=%d,%d x2y2=%d,%d start=%d end=%d',
+//        [BoundsLeft, BoundsTop, BoundsRight, BoundsBottom, IntStartAngle, IntAngleLength]));
+//      {$endif}
+{      ADest.TextOut(CoordToCanvasX(CurArc.CenterX), CoordToCanvasY(CurArc.CenterY),
+      Format('R=%d S=%d L=%d', [Round(CurArc.Radius*AMulX), Round(FinalStartAngle),
+      Abs(Round((FinalEndAngle - FinalStartAngle)))]));
+    ADest.Pen.Color := TColor($DDDDDD);
+    ADest.Rectangle(
+      BoundsLeft, BoundsTop, BoundsRight, BoundsBottom);
+    ADest.Pen.Color := clBlack;}
+    {$endif}
+  end
+  else if CurEntity is TvAlignedDimension then
+  begin
+    CurDim := CurEntity as TvAlignedDimension;
+    //
+    // Draws this shape:
+    // vertical     horizontal
+    // ___
+    // | |     or   ---| X cm
+    //   |           --|
+    // Which marks the dimension
+    ADest.MoveTo(CoordToCanvasX(CurDim.BaseRight.X), CoordToCanvasY(CurDim.BaseRight.Y));
+    ADest.LineTo(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y));
+    ADest.LineTo(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y));
+    ADest.LineTo(CoordToCanvasX(CurDim.BaseLeft.X), CoordToCanvasY(CurDim.BaseLeft.Y));
+    // Now the arrows
+    // horizontal
+    SetLength(Points, 3);
+    if CurDim.DimensionRight.Y = CurDim.DimensionLeft.Y then
     begin
-      CurEllipse := CurEntity as TvEllipse;
-      DrawRotatedEllipse(ADest, CurEllipse);
+      ADest.Brush.FPColor := colBlack;
+      ADest.Brush.Style := bsSolid;
+      // Left arrow
+      Points[0] := Point(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y));
+      Points[1] := Point(Points[0].X + 7, Points[0].Y - 3);
+      Points[2] := Point(Points[0].X + 7, Points[0].Y + 3);
+      ADest.Polygon(Points);
+      // Right arrow
+      Points[0] := Point(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y));
+      Points[1] := Point(Points[0].X - 7, Points[0].Y - 3);
+      Points[2] := Point(Points[0].X - 7, Points[0].Y + 3);
+      ADest.Polygon(Points);
+      ADest.Brush.Style := bsClear;
+      // Dimension text
+      Points[0].X := CoordToCanvasX((CurDim.DimensionLeft.X+CurDim.DimensionRight.X)/2);
+      Points[0].Y := CoordToCanvasY(CurDim.DimensionLeft.Y);
+      LowerDim.X := CurDim.DimensionRight.X-CurDim.DimensionLeft.X;
+      ADest.Font.Size := 10;
+      ADest.TextOut(Points[0].X, Points[0].Y, Format('%.1f', [LowerDim.X]));
     end
-    else if CurEntity is TvCircularArc then
+    else
     begin
-      CurArc := CurEntity as TvCircularArc;
-      {$ifdef USE_LCL_CANVAS}
-      // Arc(ALeft, ATop, ARight, ABottom, Angle16Deg, Angle16DegLength: Integer);
-      ADest.Arc(
-        Round(ADestX + AmulX * (CurArc.CenterX - CurArc.Radius)),
-        Round(ADestY + AmulY * (CurArc.CenterY - CurArc.Radius)),
-        Round(ADestX + AmulX * (CurArc.CenterX + CurArc.Radius)),
-        Round(ADestY + AmulY * (CurArc.CenterY + CurArc.Radius)),
-        Round(16*CurArc.StartAngle),
-        Round(16*CurArc.EndAngle - CurArc.StartAngle)
-        );
-      {$endif}
+      ADest.Brush.FPColor := colBlack;
+      ADest.Brush.Style := bsSolid;
+      // There is no upper/lower preference for DimensionLeft/Right, so we need to check
+      if CurDim.DimensionLeft.Y > CurDim.DimensionRight.Y then
+      begin
+        UpperDim := CurDim.DimensionLeft;
+        LowerDim := CurDim.DimensionRight;
+      end
+      else
+      begin
+        UpperDim := CurDim.DimensionRight;
+        LowerDim := CurDim.DimensionLeft;
+      end;
+      // Upper arrow
+      Points[0] := Point(CoordToCanvasX(UpperDim.X), CoordToCanvasY(UpperDim.Y));
+      Points[1] := Point(Points[0].X + Round(AMulX), Points[0].Y - Round(AMulY*3));
+      Points[2] := Point(Points[0].X - Round(AMulX), Points[0].Y - Round(AMulY*3));
+      ADest.Polygon(Points);
+      // Lower arrow
+      Points[0] := Point(CoordToCanvasX(LowerDim.X), CoordToCanvasY(LowerDim.Y));
+      Points[1] := Point(Points[0].X + Round(AMulX), Points[0].Y + Round(AMulY*3));
+      Points[2] := Point(Points[0].X - Round(AMulX), Points[0].Y + Round(AMulY*3));
+      ADest.Polygon(Points);
+      ADest.Brush.Style := bsClear;
+      // Dimension text
+      Points[0].X := CoordToCanvasX(CurDim.DimensionLeft.X);
+      Points[0].Y := CoordToCanvasY((CurDim.DimensionLeft.Y+CurDim.DimensionRight.Y)/2);
+      LowerDim.Y := CurDim.DimensionRight.Y-CurDim.DimensionLeft.Y;
+      if LowerDim.Y < 0 then LowerDim.Y := -1 * LowerDim.Y;
+      ADest.Font.Size := 10;
+      ADest.TextOut(Points[0].X, Points[0].Y, Format('%.1f', [LowerDim.Y]));
     end;
+    SetLength(Points, 0);
+{      // Debug info
+    ADest.TextOut(CoordToCanvasX(CurDim.BaseRight.X), CoordToCanvasY(CurDim.BaseRight.Y), 'BR');
+    ADest.TextOut(CoordToCanvasX(CurDim.DimensionRight.X), CoordToCanvasY(CurDim.DimensionRight.Y), 'DR');
+    ADest.TextOut(CoordToCanvasX(CurDim.DimensionLeft.X), CoordToCanvasY(CurDim.DimensionLeft.Y), 'DL');
+    ADest.TextOut(CoordToCanvasX(CurDim.BaseLeft.X), CoordToCanvasY(CurDim.BaseLeft.Y), 'BL');}
   end;
+end;
 
-  // Draws all text
-  for i := 0 to ASource.GetTextCount - 1 do
+procedure DrawFPVTextToCanvas(ASource: TvVectorialDocument; CurText: TvText;
+  ADest: TFPCustomCanvas;
+  ADestX: Integer = 0; ADestY: Integer = 0; AMulX: Double = 1.0; AMulY: Double = 1.0);
+
+  function CoordToCanvasX(ACoord: Double): Integer;
   begin
-    CurText := ASource.GetText(i);
-    ADest.Font.Height := Round(AmulY * CurText.FontSize);
-    ADest.Pen.Style := psSolid;
-    ADest.Pen.Color := clBlack;
-    ADest.TextOut(Round(CurText.X), Round(CurText.Y), CurText.Value);
+    Result := Round(ADestX + AmulX * ACoord);
   end;
 
-  {$ifdef FPVECTORIALDEBUG}
-  WriteLn(':<DrawFPVectorialToCanvas');
+  function CoordToCanvasY(ACoord: Double): Integer;
+  begin
+    Result := Round(ADestY + AmulY * ACoord);
+  end;
+
+var
+  i: Integer;
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest: TCanvas;
   {$endif}
+  //
+  LowerDim: T3DPoint;
+begin
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest := TCanvas(ADest);
+  {$endif}
+
+  ADest.Font.Size := Round(AmulX * CurText.Font.Size);
+  ADest.Pen.Style := psSolid;
+  ADest.Pen.FPColor := colBlack;
+  ADest.Brush.Style := bsClear;
+  {$ifdef USE_LCL_CANVAS}
+  ALCLDest.Font.Orientation := Round(CurText.Font.Orientation * 16);
+  {$endif}
+
+  LowerDim.Y := CurText.Y + CurText.Font.Size;
+  ADest.TextOut(CoordToCanvasX(CurText.X), CoordToCanvasY(LowerDim.Y), CurText.Value);
 end;
 
 end.

+ 114 - 0
packages/fpvectorial/src/fpvutils.pas

@@ -0,0 +1,114 @@
+{
+fpvutils.pas
+
+Vector graphics document
+
+License: The same modified LGPL as the Free Pascal RTL
+         See the file COPYING.modifiedLGPL for more details
+
+AUTHORS: Felipe Monteiro de Carvalho
+         Pedro Sol Pegorini L de Lima
+}
+unit fpvutils;
+
+{$ifdef fpc}
+  {$mode delphi}
+{$endif}
+
+interface
+
+uses
+  Classes, SysUtils, Math,
+  fpvectorial, fpimage;
+
+type
+  T10Strings = array[0..9] of shortstring;
+
+// Color Conversion routines
+function FPColorToRGBHexString(AColor: TFPColor): string;
+function RGBToFPColor(AR, AG, AB: byte): TFPColor; inline;
+// Other routine
+function CanvasCoordsToFPVectorial(AY: Integer; AHeight: Integer): Integer; inline;
+function CanvasTextPosToFPVectorial(AY: Integer; ACanvasHeight, ATextHeight: Integer): Integer;
+function SeparateString(AString: string; ASeparator: char): T10Strings;
+
+implementation
+
+{@@ This function is utilized by the SVG writer and some other places, so
+    it shouldn't be changed.
+}
+function FPColorToRGBHexString(AColor: TFPColor): string;
+begin
+  Result := Format('%.2x%.2x%.2x', [AColor.Red shr 8, AColor.Green shr 8, AColor.Blue shr 8]);
+end;
+
+function RGBToFPColor(AR, AG, AB: byte): TFPColor; inline;
+begin
+  Result.Red := (AR shl 8) + AR;
+  Result.Green := (AG shl 8) + AG;
+  Result.Blue := (AB shl 8) + AB;
+  Result.Alpha := $FFFF;
+end;
+
+{@@ Converts the coordinate system from a TCanvas to FPVectorial
+    The basic difference is that the Y axis is positioned differently and
+    points upwards in FPVectorial and downwards in TCanvas.
+    The X axis doesn't change. The fix is trivial and requires only the Height of
+    the Canvas as extra info.
+
+    @param AHeight Should receive TCanvas.Height
+}
+function CanvasCoordsToFPVectorial(AY: Integer; AHeight: Integer): Integer; inline;
+begin
+  Result := AHeight - AY;
+end;
+
+{@@
+  LCL Text is positioned based on the top-left corner of the text.
+  Besides that, one also needs to take the general coordinate change into account too.
+
+  @param ACanvasHeight Should receive TCanvas.Height
+  @param ATextHeight   Should receive TFont.Size
+}
+function CanvasTextPosToFPVectorial(AY: Integer; ACanvasHeight, ATextHeight: Integer): Integer;
+begin
+  Result := CanvasCoordsToFPVectorial(AY, ACanvasHeight) - ATextHeight;
+end;
+
+{@@
+  Reads a string and separates it in substring
+  using ASeparator to delimite them.
+
+  Limits:
+
+  Number of substrings: 10 (indexed 0 to 9)
+  Length of each substring: 255 (they are shortstrings)
+}
+function SeparateString(AString: string; ASeparator: char): T10Strings;
+var
+  i, CurrentPart: integer;
+begin
+  CurrentPart := 0;
+
+  { Clears the result }
+  for i := 0 to 9 do
+    Result[i] := '';
+
+  { Iterates througth the string, filling strings }
+  for i := 1 to Length(AString) do
+  begin
+    if Copy(AString, i, 1) = ASeparator then
+    begin
+      Inc(CurrentPart);
+
+      { Verifies if the string capacity wasn't exceeded }
+      if CurrentPart > 9 then
+        Exit;
+    end
+    else
+      Result[CurrentPart] := Result[CurrentPart] + Copy(AString, i, 1);
+  end;
+end;
+
+end.
+

+ 365 - 0
packages/fpvectorial/src/svgvectorialreader.pas

@@ -0,0 +1,365 @@
+{
+Reads an SVG Document
+
+License: The same modified LGPL as the Free Pascal RTL
+         See the file COPYING.modifiedLGPL for more details
+
+AUTHORS: Felipe Monteiro de Carvalho
+}
+unit svgvectorialreader;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+  Classes, SysUtils, math,
+  xmlread, dom, fgl,
+  fpvectorial, fpvutils;
+
+type
+  TSVGTokenType = (sttMoveTo, sttLineTo, sttBezierTo, sttFloatValue);
+
+  TSVGToken = class
+    TokenType: TSVGTokenType;
+    Value: Float;
+  end;
+
+  TSVGTokenList = specialize TFPGList<TSVGToken>;
+
+  { TSVGPathTokenizer }
+
+  TSVGPathTokenizer = class
+  public
+    FPointSeparator, FCommaSeparator: TFormatSettings;
+    Tokens: TSVGTokenList;
+    constructor Create;
+    Destructor Destroy; override;
+    procedure AddToken(AStr: string);
+    procedure TokenizePathString(AStr: string);
+  end;
+
+  { TvSVGVectorialReader }
+
+  TvSVGVectorialReader = class(TvCustomVectorialReader)
+  private
+    FPointSeparator, FCommaSeparator: TFormatSettings;
+    FSVGPathTokenizer: TSVGPathTokenizer;
+    procedure ReadPathFromNode(APath: TDOMNode; AData: TvVectorialDocument);
+    procedure ReadPathFromString(AStr: string; AData: TvVectorialDocument);
+    function  StringWithUnitToFloat(AStr: string): Single;
+    procedure ConvertSVGCoordinatesToFPVCoordinates(
+      const AData: TvVectorialDocument;
+      const ASrcX, ASrcY: Float; var ADestX, ADestY: Float);
+    procedure ConvertSVGDeltaToFPVDelta(
+      const AData: TvVectorialDocument;
+      const ASrcX, ASrcY: Float; var ADestX, ADestY: Float);
+  public
+    { General reading methods }
+    constructor Create; override;
+    Destructor Destroy; override;
+    procedure ReadFromStream(AStream: TStream; AData: TvVectorialDocument); override;
+  end;
+
+implementation
+
+const
+  // SVG requires hardcoding a DPI value
+
+  // The Opera Browser and Inkscape use 90 DPI, so we follow that
+
+  // 1 Inch = 25.4 milimiters
+  // 90 inches per pixel = (1 / 90) * 25.4 = 0.2822
+  // FLOAT_MILIMETERS_PER_PIXEL = 0.3528; // DPI 72 = 1 / 72 inches per pixel
+
+  FLOAT_MILIMETERS_PER_PIXEL = 0.2822; // DPI 90 = 1 / 90 inches per pixel
+  FLOAT_PIXELS_PER_MILIMETER = 3.5433; // DPI 90 = 1 / 90 inches per pixel
+
+{ TSVGPathTokenizer }
+
+constructor TSVGPathTokenizer.Create;
+begin
+  inherited Create;
+
+  FPointSeparator := DefaultFormatSettings;
+  FPointSeparator.DecimalSeparator := '.';
+  FPointSeparator.ThousandSeparator := '#';// disable the thousand separator
+
+  Tokens := TSVGTokenList.Create;
+end;
+
+destructor TSVGPathTokenizer.Destroy;
+begin
+  Tokens.Free;
+
+  inherited Destroy;
+end;
+
+procedure TSVGPathTokenizer.AddToken(AStr: string);
+var
+  lToken: TSVGToken;
+begin
+  lToken := TSVGToken.Create;
+
+  if AStr = 'm' then lToken.TokenType := sttMoveTo
+  else if AStr = 'l' then lToken.TokenType := sttLineTo
+  else if AStr = 'c' then lToken.TokenType := sttBezierTo
+  else
+  begin
+    lToken.TokenType := sttFloatValue;
+    lToken.Value := StrToFloat(AStr, FPointSeparator);
+  end;
+
+  Tokens.Add(lToken);
+end;
+
+procedure TSVGPathTokenizer.TokenizePathString(AStr: string);
+const
+  Str_Space: Char = ' ';
+  Str_Comma: Char = ',';
+var
+  i: Integer;
+  lTmpStr: string;
+  lState: Integer;
+  lCurChar: Char;
+begin
+  lState := 0;
+
+  i := 1;
+  while i <= Length(AStr) do
+  begin
+    case lState of
+    0: // Adding to the tmp string
+    begin
+      lCurChar := AStr[i];
+      if lCurChar = Str_Space then
+      begin
+        lState := 1;
+        AddToken(lTmpStr);
+        lTmpStr := '';
+      end
+      else if lCurChar = Str_Comma then
+      begin
+        AddToken(lTmpStr);
+        lTmpStr := '';
+      end
+      else
+        lTmpStr := lTmpStr + lCurChar;
+
+      Inc(i);
+    end;
+    1: // Removing spaces
+    begin
+      if AStr[i] <> Str_Space then lState := 0
+      else Inc(i);
+    end;
+    end;
+  end;
+end;
+
+{ Example of a supported SVG image:
+
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with fpVectorial (http://wiki.lazarus.freepascal.org/fpvectorial) -->
+
+<svg
+  xmlns:dc="http://purl.org/dc/elements/1.1/"
+  xmlns:cc="http://creativecommons.org/ns#"
+  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+  xmlns:svg="http://www.w3.org/2000/svg"
+  xmlns="http://www.w3.org/2000/svg"
+  xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+  width="100mm"
+  height="100mm"
+  id="svg2"
+  version="1.1"
+  sodipodi:docname="New document 1">
+  <g id="layer1">
+  <path
+    style="fill:none;stroke:#000000;stroke-width:10px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+    d="m 0,283.486888731396 l 106.307583274274,-35.4358610914245 "
+  id="path0" />
+  <path
+    style="fill:none;stroke:#000000;stroke-width:10px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+    d="m 0,354.358610914245 l 354.358610914245,0 l 0,-354.358610914245 l -354.358610914245,0 l 0,354.358610914245 "
+  id="path1" />
+  <path
+    style="fill:none;stroke:#000000;stroke-width:10px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+    d="m 0,354.358610914245 l 35.4358610914245,-35.4358610914245 c 0,-35.4358610914246 35.4358610914245,-35.4358610914246 35.4358610914245,0 l 35.4358610914245,35.4358610914245 "
+  id="path2" />
+  </g>
+</svg>
+}
+
+{ TvSVGVectorialReader }
+
+procedure TvSVGVectorialReader.ReadPathFromNode(APath: TDOMNode;
+  AData: TvVectorialDocument);
+var
+  lNodeName, lStyleStr, lDStr: WideString;
+  i: Integer;
+begin
+  for i := 0 to APath.Attributes.Length - 1 do
+  begin
+    lNodeName := APath.Attributes.Item[i].NodeName;
+    if  lNodeName = 'style' then
+      lStyleStr := APath.Attributes.Item[i].NodeValue
+    else if lNodeName = 'd' then
+      lDStr := APath.Attributes.Item[i].NodeValue
+  end;
+
+  AData.StartPath();
+  ReadPathFromString(UTF8Encode(lDStr), AData);
+  AData.EndPath();
+end;
+
+procedure TvSVGVectorialReader.ReadPathFromString(AStr: string;
+  AData: TvVectorialDocument);
+var
+  i: Integer;
+  X, Y, X2, Y2, X3, Y3: Float;
+  CurX, CurY: Float;
+begin
+  FSVGPathTokenizer.Tokens.Clear;
+  FSVGPathTokenizer.TokenizePathString(AStr);
+  CurX := 0;
+  CurY := 0;
+
+  i := 0;
+  while i < FSVGPathTokenizer.Tokens.Count do
+  begin
+    if FSVGPathTokenizer.Tokens.Items[i].TokenType = sttMoveTo then
+    begin
+      CurX := FSVGPathTokenizer.Tokens.Items[i+1].Value;
+      CurY := FSVGPathTokenizer.Tokens.Items[i+2].Value;
+      ConvertSVGCoordinatesToFPVCoordinates(AData, CurX, CurY, CurX, CurY);
+
+      AData.AddMoveToPath(CurX, CurY);
+
+      Inc(i, 3);
+    end
+    else if FSVGPathTokenizer.Tokens.Items[i].TokenType = sttLineTo then
+    begin
+      X := FSVGPathTokenizer.Tokens.Items[i+1].Value;
+      Y := FSVGPathTokenizer.Tokens.Items[i+2].Value;
+      ConvertSVGDeltaToFPVDelta(AData, X, Y, X, Y);
+
+      // LineTo uses relative coordenates in SVG
+      CurX := CurX + X;
+      CurY := CurY + Y;
+
+      AData.AddLineToPath(CurX, CurY);
+
+      Inc(i, 3);
+    end
+    else if FSVGPathTokenizer.Tokens.Items[i].TokenType = sttBezierTo then
+    begin
+      X2 := FSVGPathTokenizer.Tokens.Items[i+1].Value;
+      Y2 := FSVGPathTokenizer.Tokens.Items[i+2].Value;
+      X3 := FSVGPathTokenizer.Tokens.Items[i+3].Value;
+      Y3 := FSVGPathTokenizer.Tokens.Items[i+4].Value;
+      X := FSVGPathTokenizer.Tokens.Items[i+5].Value;
+      Y := FSVGPathTokenizer.Tokens.Items[i+6].Value;
+
+      ConvertSVGDeltaToFPVDelta(AData, X2, Y2, X2, Y2);
+      ConvertSVGDeltaToFPVDelta(AData, X3, Y3, X3, Y3);
+      ConvertSVGDeltaToFPVDelta(AData, X, Y, X, Y);
+
+      AData.AddBezierToPath(X2 + CurX, Y2 + CurY, X3 + CurX, Y3 + CurY, X + CurX, Y + CurY);
+
+      // BezierTo uses relative coordenates in SVG
+      CurX := CurX + X;
+      CurY := CurY + Y;
+
+      Inc(i, 7);
+    end
+    else
+    begin
+      Inc(i);
+    end;
+  end;
+end;
+
+function TvSVGVectorialReader.StringWithUnitToFloat(AStr: string): Single;
+var
+  UnitStr, ValueStr: string;
+  Len: Integer;
+begin
+  // Check the unit
+  Len := Length(AStr);
+  UnitStr := Copy(AStr, Len-1, 2);
+  if UnitStr = 'mm' then
+  begin
+    ValueStr := Copy(AStr, 1, Len-2);
+    Result := StrToInt(ValueStr);
+  end;
+end;
+
+procedure TvSVGVectorialReader.ConvertSVGCoordinatesToFPVCoordinates(
+  const AData: TvVectorialDocument; const ASrcX, ASrcY: Float;
+  var ADestX,ADestY: Float);
+begin
+  ADestX := ASrcX * FLOAT_MILIMETERS_PER_PIXEL;
+  ADestY := AData.Height - ASrcY * FLOAT_MILIMETERS_PER_PIXEL;
+end;
+
+procedure TvSVGVectorialReader.ConvertSVGDeltaToFPVDelta(
+  const AData: TvVectorialDocument; const ASrcX, ASrcY: Float; var ADestX,
+  ADestY: Float);
+begin
+  ADestX := ASrcX * FLOAT_MILIMETERS_PER_PIXEL;
+  ADestY := - ASrcY * FLOAT_MILIMETERS_PER_PIXEL;
+end;
+
+constructor TvSVGVectorialReader.Create;
+begin
+  inherited Create;
+
+  FPointSeparator := DefaultFormatSettings;
+  FPointSeparator.DecimalSeparator := '.';
+  FPointSeparator.ThousandSeparator := '#';// disable the thousand separator
+
+  FSVGPathTokenizer := TSVGPathTokenizer.Create;
+end;
+
+destructor TvSVGVectorialReader.Destroy;
+begin
+  FSVGPathTokenizer.Free;
+
+  inherited Destroy;
+end;
+
+procedure TvSVGVectorialReader.ReadFromStream(AStream: TStream;
+  AData: TvVectorialDocument);
+var
+  Doc: TXMLDocument;
+  lFirstLayer, lCurNode: TDOMNode;
+begin
+  try
+    // Read in xml file from the stream
+    ReadXMLFile(Doc, AStream);
+
+    // Read the properties of the <svg> tag
+    AData.Width := StringWithUnitToFloat(Doc.DocumentElement.GetAttribute('width'));
+    AData.Height := StringWithUnitToFloat(Doc.DocumentElement.GetAttribute('height'));
+
+    // Now process the elements inside the first layer
+    lFirstLayer := Doc.DocumentElement.FirstChild;
+    lCurNode := lFirstLayer.FirstChild;
+    while Assigned(lCurNode) do
+    begin
+      ReadPathFromNode(lCurNode, AData);
+      lCurNode := lCurNode.NextSibling;
+    end;
+  finally
+    // finally, free the document
+    Doc.Free;
+  end;
+end;
+
+initialization
+
+  RegisterVectorialReader(TvSVGVectorialReader, vfSVG);
+
+end.
+

+ 118 - 92
packages/fpvectorial/src/svgvectorialwriter.pas

@@ -13,7 +13,7 @@ unit svgvectorialwriter;
 interface
 
 uses
-  Classes, SysUtils, math, fpvectorial;
+  Classes, SysUtils, math, fpvectorial, fpvutils, fpcanvas;
 
 type
   { TvSVGVectorialWriter }
@@ -23,8 +23,9 @@ type
     FPointSeparator, FCommaSeparator: TFormatSettings;
     procedure WriteDocumentSize(AStrings: TStrings; AData: TvVectorialDocument);
     procedure WriteDocumentName(AStrings: TStrings; AData: TvVectorialDocument);
-    procedure WritePaths(AStrings: TStrings; AData: TvVectorialDocument);
-    procedure WriteTexts(AStrings: TStrings; AData: TvVectorialDocument);
+    procedure WritePath(AIndex: Integer; APath: TPath; AStrings: TStrings; AData: TvVectorialDocument);
+    procedure WriteText(AStrings: TStrings; lText: TvText; AData: TvVectorialDocument);
+    procedure WriteEntities(AStrings: TStrings; AData: TvVectorialDocument);
     procedure ConvertFPVCoordinatesToSVGCoordinates(
       const AData: TvVectorialDocument;
       const ASrcX, ASrcY: Double; var ADestX, ADestY: double);
@@ -74,90 +75,106 @@ end;
   SVG uses commas "," to separate the X,Y coordinates, so it always uses points
   "." as decimal separators and uses no thousand separators
 }
-procedure TvSVGVectorialWriter.WritePaths(AStrings: TStrings; AData: TvVectorialDocument);
+procedure TvSVGVectorialWriter.WritePath(AIndex: Integer; APath: TPath; AStrings: TStrings;
+  AData: TvVectorialDocument);
 var
-  i, j: Integer;
+  j: Integer;
   PathStr: string;
-  lPath: TPath;
   PtX, PtY, OldPtX, OldPtY: double;
   BezierCP1X, BezierCP1Y, BezierCP2X, BezierCP2Y: double;
   segment: TPathSegment;
   l2DSegment: T2DSegment absolute segment;
   l2DBSegment: T2DBezierSegment absolute segment;
+  // Pen properties
+  lPenWidth: Integer;
+  lPenColor: string;
+  // Brush properties
+  lFillColor: string;
 begin
-  for i := 0 to AData.GetPathCount() - 1 do
-  begin
-    OldPtX := 0;
-    OldPtY := 0;
+  OldPtX := 0;
+  OldPtY := 0;
+  PathStr := '';
 
-    PathStr := '';
-    lPath := AData.GetPath(i);
-    lPath.PrepareForSequentialReading;
+  APath.PrepareForSequentialReading();
 
-    for j := 0 to lPath.Len - 1 do
-    begin
-      segment := TPathSegment(lPath.Next());
+  for j := 0 to APath.Len - 1 do
+  begin
+    segment := TPathSegment(APath.Next());
+
+    if (segment.SegmentType <> st2DLine)
+      and (segment.SegmentType <> stMoveTo)
+      and (segment.SegmentType <> st2DBezier)
+      then Break; // unsupported line type
 
-      if (segment.SegmentType <> st2DLine)
-        and (segment.SegmentType <> stMoveTo)
-        and (segment.SegmentType <> st2DBezier)
-        then Break; // unsupported line type
+    // Coordinate conversion from fpvectorial to SVG
+    ConvertFPVCoordinatesToSVGCoordinates(
+      AData, l2DSegment.X, l2DSegment.Y, PtX, PtY);
+    PtX := PtX - OldPtX;
+    PtY := PtY - OldPtY;
 
-      // Coordinate conversion from fpvectorial to SVG
+    if (segment.SegmentType = stMoveTo) then
+    begin
+      PathStr := PathStr + 'm '
+        + FloatToStr(PtX, FPointSeparator) + ','
+        + FloatToStr(PtY, FPointSeparator) + ' ';
+    end
+    else if (segment.SegmentType = st2DLine) then
+    begin
+      PathStr := PathStr + 'l '
+        + FloatToStr(PtX, FPointSeparator) + ','
+        + FloatToStr(PtY, FPointSeparator) + ' ';
+    end
+    else if (segment.SegmentType = st2DBezier) then
+    begin
+      // Converts all coordinates to absolute values
+      ConvertFPVCoordinatesToSVGCoordinates(
+        AData, l2DBSegment.X2, l2DBSegment.Y2, BezierCP1X, BezierCP1Y);
       ConvertFPVCoordinatesToSVGCoordinates(
-        AData, l2DSegment.X, l2DSegment.Y, PtX, PtY);
-      PtX := PtX - OldPtX;
-      PtY := PtY - OldPtY;
-
-      if (segment.SegmentType = stMoveTo) then
-      begin
-        PathStr := PathStr + 'm '
-          + FloatToStr(PtX, FPointSeparator) + ','
-          + FloatToStr(PtY, FPointSeparator) + ' ';
-      end
-      else if (segment.SegmentType = st2DLine) then
-      begin
-        PathStr := PathStr + 'l '
-          + FloatToStr(PtX, FPointSeparator) + ','
-          + FloatToStr(PtY, FPointSeparator) + ' ';
-      end
-      else if (segment.SegmentType = st2DBezier) then
-      begin
-        // Converts all coordinates to absolute values
-        ConvertFPVCoordinatesToSVGCoordinates(
-          AData, l2DBSegment.X2, l2DBSegment.Y2, BezierCP1X, BezierCP1Y);
-        ConvertFPVCoordinatesToSVGCoordinates(
-          AData, l2DBSegment.X3, l2DBSegment.Y3, BezierCP2X, BezierCP2Y);
-
-        // Transforms them into values relative to the initial point
-        BezierCP1X := BezierCP1X - OldPtX;
-        BezierCP1Y := BezierCP1Y - OldPtY;
-        BezierCP2X := BezierCP2X - OldPtX;
-        BezierCP2Y := BezierCP2Y - OldPtY;
-
-        // PtX and PtY already contains the destination point
-
-        // Now render our 2D cubic bezier
-        PathStr := PathStr + 'c '
-          + FloatToStr(BezierCP1X, FPointSeparator) + ','
-          + FloatToStr(BezierCP1Y, FPointSeparator) + ' '
-          + FloatToStr(BezierCP2X, FPointSeparator) + ','
-          + FloatToStr(BezierCP2Y, FPointSeparator) + ' '
-          + FloatToStr(PtX, FPointSeparator) + ','
-          + FloatToStr(PtY, FPointSeparator) + ' '
-          ;
-      end;
-
-      // Store the current position for future points
-      OldPtX := OldPtX + PtX;
-      OldPtY := OldPtY + PtY;
+        AData, l2DBSegment.X3, l2DBSegment.Y3, BezierCP2X, BezierCP2Y);
+
+      // Transforms them into values relative to the initial point
+      BezierCP1X := BezierCP1X - OldPtX;
+      BezierCP1Y := BezierCP1Y - OldPtY;
+      BezierCP2X := BezierCP2X - OldPtX;
+      BezierCP2Y := BezierCP2Y - OldPtY;
+
+      // PtX and PtY already contains the destination point
+
+      // Now render our 2D cubic bezier
+      PathStr := PathStr + 'c '
+        + FloatToStr(BezierCP1X, FPointSeparator) + ','
+        + FloatToStr(BezierCP1Y, FPointSeparator) + ' '
+        + FloatToStr(BezierCP2X, FPointSeparator) + ','
+        + FloatToStr(BezierCP2Y, FPointSeparator) + ' '
+        + FloatToStr(PtX, FPointSeparator) + ','
+        + FloatToStr(PtY, FPointSeparator) + ' '
+        ;
     end;
 
-    AStrings.Add('  <path');
-    AStrings.Add('    style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"');
-    AStrings.Add('    d="' + PathStr + '"');
-    AStrings.Add('  id="path' + IntToStr(i) + '" />');
+    // Store the current position for future points
+    OldPtX := OldPtX + PtX;
+    OldPtY := OldPtY + PtY;
   end;
+
+  // Get the Pen Width
+  if APath.Pen.Width >= 1 then lPenWidth := APath.Pen.Width
+  else lPenWidth := 1;
+
+  // Get the Pen Color and Style
+  if APath.Pen.Style = psClear then lPenColor := 'none'
+  else lPenColor := '#' + FPColorToRGBHexString(APath.Pen.Color);
+
+  // Get the Brush color and style
+  if APath.Brush.Style = bsClear then lFillColor := 'none'
+  else lFillColor := '#' + FPColorToRGBHexString(APath.Brush.Color);
+
+  // Now effectively write the path
+  AStrings.Add('  <path');
+  AStrings.Add(Format('    style="fill:%s;stroke:%s;stroke-width:%dpx;'
+   + 'stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"',
+   [lFillColor, lPenColor, lPenWidth]));
+  AStrings.Add('    d="' + PathStr + '"');
+  AStrings.Add('  id="path' + IntToStr(AIndex) + '" />');
 end;
 
 procedure TvSVGVectorialWriter.ConvertFPVCoordinatesToSVGCoordinates(
@@ -197,43 +214,52 @@ begin
 
   // Now data
   AStrings.Add('  <g id="layer1">');
-  WritePaths(AStrings, AData);
-  WriteTexts(AStrings, AData);
+  WriteEntities(AStrings, AData);
   AStrings.Add('  </g>');
 
   // finalization
   AStrings.Add('</svg>');
 end;
 
-procedure TvSVGVectorialWriter.WriteTexts(AStrings: TStrings; AData: TvVectorialDocument);
+procedure TvSVGVectorialWriter.WriteText(AStrings: TStrings; lText: TvText; AData: TvVectorialDocument);
 var
   i, j, FontSize: Integer;
   TextStr, FontName, SVGFontFamily: string;
-  lText: TvText;
   PtX, PtY: double;
 begin
-  for i := 0 to AData.GetTextCount() - 1 do
-  begin
-    TextStr := '';
-    lText := AData.GetText(i);
+  TextStr := '';
 
-    ConvertFPVCoordinatesToSVGCoordinates(
-        AData, lText.X, lText.Y, PtX, PtY);
+  ConvertFPVCoordinatesToSVGCoordinates(
+      AData, lText.X, lText.Y, PtX, PtY);
 
-    TextStr := lText.Value;
-    FontSize:= ceil(lText.FontSize / FLOAT_MILIMETERS_PER_PIXEL);
-    SVGFontFamily := 'Arial, sans-serif';//lText.FontName;
+  TextStr := lText.Value;
+  FontSize:= ceil(lText.Font.Size / FLOAT_MILIMETERS_PER_PIXEL);
+  SVGFontFamily := 'Arial, sans-serif';//lText.FontName;
 
-    AStrings.Add('  <text ');
-    AStrings.Add('    x="' + FloatToStr(PtX, FPointSeparator) + '"');
-    AStrings.Add('    y="' + FloatToStr(PtY, FPointSeparator) + '"');
+  AStrings.Add('  <text ');
+  AStrings.Add('    x="' + FloatToStr(PtX, FPointSeparator) + '"');
+  AStrings.Add('    y="' + FloatToStr(PtY, FPointSeparator) + '"');
 //    AStrings.Add('    font-size="' + IntToStr(FontSize) + '"'); Doesn't seam to work, we need to use the tspan
-    AStrings.Add('    font-family="' + SVGFontFamily + '">');
-    AStrings.Add('    <tspan ');
-    AStrings.Add('      style="font-size:' + IntToStr(FontSize) + '" ');
+  AStrings.Add('    font-family="' + SVGFontFamily + '">');
+  AStrings.Add('    <tspan ');
+  AStrings.Add('      style="font-size:' + IntToStr(FontSize) + '" ');
 //    AStrings.Add('      id="tspan2828" ');
-    AStrings.Add('    >');
-    AStrings.Add(TextStr + '</tspan></text>');
+  AStrings.Add('    >');
+  AStrings.Add(TextStr + '</tspan></text>');
+end;
+
+procedure TvSVGVectorialWriter.WriteEntities(AStrings: TStrings;
+  AData: TvVectorialDocument);
+var
+  lEntity: TvEntity;
+  i: Integer;
+begin
+  for i := 0 to AData.GetEntitiesCount() - 1 do
+  begin
+    lEntity := AData.GetEntity(i);
+
+    if lEntity is TPath then WritePath(i, TPath(lEntity), AStrings, AData)
+    else if lEntity is TvText then WriteText(AStrings, TvText(lEntity), AData);
   end;
 end;