What's the purpose of the program
The fig2vect program converts Fig drawings to MetaPost, EPS, PDF, TeX and SVG
files.
It is intended for LaTeX users which want to use their Fig
drawings with both LaTeX and pdfLaTeX.
How does fig2vect compare against other Fig to xxx conversion software
What license applies to the package?
Yes, you should. AFAIK there are no binary installation packages out there.
Which libraries do I need to install before building fig2vect?
Note: If you installed these packages using your
OS vendors package management
software make sure the header files... are also installed.
Some systems have separated packages: one for binaries and shared libraries
and an additional one (mostly called "xxx developer support")
containing C header files and other material needed to compile programs
using the library.
The source code is available at http://sourceforge.net/projects/fig2vect.
How do I build and install the software?
The usual procedure
./configure make make install
can be used to install the software.
Should I use the executable setup or install from source?
For most users I recommed to use the executable setup, see below.
Installing from source is recommended for experienced programmers only. You need
a good working knowledge of your development system, your C compiler and linker's
options and makefiles.
You should also read
http://dklibs.sourceforge.net/inst_w32.html.
This document gives some
hints about installing the dklibs library set and applications using it from
source.
Where can I obtain the executable setup?
The dklibs-win32 package of the dklibs SourceForge project at
http://sourceforge.net/projects/dklibs
contains the executable files
dklibs-win32-user-*.exe and dklibs-win32-base-*.exe.
The dklibs-win32-user-*.exe file is the recommended setup, it installs
binaries and documentation to the local hard disk. The dklibs-win32-base-*.exe
file only installs the binaries, start menu entries for documentation will
point to web resources. This is recommended only for computers connected
to the internet permanently.
What is the fig2vect.cfg.sample file?
A file ${prefix}/etc/fig2vect/fig2vect.cfg is created when the fig2vect
package is installed the first time. Additionally a file
fig2vect.cfg.sample is installed.
During update installation the fig2vect.cfg file is not changed as it
might be modified. The current version of the fig2vect.cfg file from
the distribution is installed as fig2vect.cfg.sample.
How do I manage configuration after a fig2vect update?
The configuration file is prepared to have three section:
A system administrator should set up site-specific configurations in
section 2 only.
After an update of the fig2vect software the administrator should:
Use
fig2vect options input-file output-file
fig2vect options directory
to run the program. When using the MetaPost driver you can also use
fig2vect options input-file
fig2vect options
If there is no file name for the output file specified output goes to standard
input. If the file name for the input file is omitted the program
processes standard input.
Can I process compressed files directly?
Yes, it's possible if support for zlib and/or the bzip2 library was
enabled during build. Simply specify a file name "*.fig.gz" or "*.fig.bz2"
for input files or "*.mp.gz"..."*.eps.bz2" for output files.
To find out whether or not zlib/bzip2 support is enabled run
fig2vect --version
If the output contains the lines
zlib General compression library libbz2 Library for compressing/decompressing data in the bzip2 format
in the "Libraries used:" section support for zlib/bzip2 is enabled.
How do I provide configuration options to the program?
The fig2vect program uses a configuration file fig2vect.cfg. This file consists of serveral sections, each section describes one configuration. A section consists of a configuration name and several key/value pairs. Keys can consist of multi-part strings. The keys are also referred to as options.
How do I choose a name for a configuration?
The name for a configuration consists of the base driver name ("mp", "eps",
"tex" or "svg"),
a dot (".") and a unique name of your choice containing numbers, digits,
underscore and minus.
In the configuration file the name is surrounded by "[" and "]".
How does option inheritance work?
If a user chooses a configuration "mp.my-conf" by specifying
fig2vect -l mp.my-conf ...
on the command line the program searches for a configuration section "[*]" first
and processes this section. The "[mp]" section is processed next, settings in
this section overwrite settings from the "[*]" section. The
"[mp.my-conf]" section is processed at the end, overwriting all earlier
settings.
Note: only the first dot separating the base driver from the remainder
of the name is of importance. Naming a section "[mp.users.me.docs]"
will result in processing "[*]", "[mp]" and "[mp.users.me.docs]",
not "[*]", "[mp]", "[mp.users]", "[mp.users.me]" and "[mp.users.me.docs]".
What is the name of the configuration file?
By default the configuration file "${prefix}/etc/fig2vect/fig2vect.cfg" is used. If a file "$HOME/.defaults/fig2vect.cfg" is found, this file is used instead of the default configuration file.
How does fig2vect calculate the image dimensions?
The fig2vect program inspects all drawing elements except the
texts and calculates the elements dimensions. The element dimensions
of all elements are combined to calculate the dimensions for the entire
drawing. The output file dimensions are choosen to match the borders
of the outermost elements.
Texts are skipped for two reasons:
If you use drivers writing graphics dimensions to the output
(EPS, PDF or SVG) texts must not be the outermost left, right, top or bottom
elements.
For the MetaPost driver this is not a problem as there
is no bounding box information in the *.mp file.
How do I handle text on the outermost left/right/top/bottom position?
If your Fig file contains text on the outermost left/right/top/bottom position you can use either
below all other graphics elements. A white filled rectangle can only be used on white page background. The rectangle must include the drawing elements, especially the texts.
How can I add some border space?
Use either
below all other graphics elements. A white filled rectangle can only be used on white page background. The rectangle must include the drawing elements and the border space you want to add.
What is a background rectangle, how do I use it?
A background rectangle is an additional rectangle you add to the Fig file. This rectangle is not drawn to the output file, it is only used to calculate the output file dimensions. A background rectangle must have the following features assigned:
The configuration option
remove background rectangle = yes
must be used to prevent drawing of the background rectangle.
How can I produce bitmap images?
Produce a PNG image first (see below) and convert the PNG image to the bitmap type you need, i.e. using NetPBM, ImageMagick, Xnview (the nconvert program) or Gimp.
How can I produce a PNG image?
There are four choices:
fig2vect -lsvg image.fig image.svg java -jar /.../batik-rasterizer.jar image.svgThe Batik software is available from xml.apache.org. A java program is available in the Java Runtime Environment (JRE) from java.sun.com.
fig2vect -l pdf.tex image.fig imagei.pdf fig2vect -l tex.full -i imagei image.fig image.tex pdflatex image && pdflatex image pdftoppm -t1lib yes -freetype yes -aa yes -aaVector yes image.pdf image pnmtopng < image-000001.ppm> image.png
fig2vect -lpdf.tex image.fig imagei.pdf fig2vect -ltex.full -iimagei image.fig image.tex pdflatex image && pdflatex image && pdflatex image gs ... -sOutputFile=image.png image.pdfUse the following options for Ghostscript:
| -dBATCH | run in batch mode |
| -dNOPAUSE | do not pause after each page |
| -dNOCACHE | do not cache rendered characters |
| -sDEVICE=png16m | choose output file type PNG |
| -dGraphicsAlphaBits=4 | Anti-Aliasing for graphics uses 4 bits (1, 2 or 4 bits, or omit this option) |
| -dTextAlphaBits=4 | Anti-Aliasing for text uses 4 bits (1, 2 or 4 bits, or omit this option) |
| -dNOCACHE | do not cache rendered characters |
| -r300 | use 300 dpi (you may choose another resolution) |
fig2vect -leps image.fig image.eps gs ... -sOutputFile=image.png image.epsUse the following options for Ghostscript:
| -dBATCH | run in batch mode |
| -dNOPAUSE | do not pause after each page |
| -dEPSCrop | choose output image size to fit EPS BoundingBox |
| -dNOCACHE | do not cache rendered characters |
| -sDEVICE=png16m | choose output file type PNG |
| -dGraphicsAlphaBits=4 | Anti-Aliasing for graphics uses 4 bits (1, 2 or 4 bits, or omit this option) |
| -dTextAlphaBits=4 | Anti-Aliasing for text uses 4 bits (1, 2 or 4 bits, or omit this option) |
| -dNOCACHE | do not cache rendered characters |
| -r300 | use 300 dpi (you may choose another resolution) |
Once I have produced a PNG, how can I compress it?
Use the optipng program, this program can be found on SourceForge at
http://sourceforge.net/projects/optipng.
For normal compression run:
optipng image.png
To suppress the messages add the -q option:
optipng -q image.png
To create an image for use on web servers, use -i1 to make the image interlaced:
optipng -i1 image.png
For better compression use -o7:
optipng -o7 image.png
To attempt a large amount of combinations for compression options (this will not necessarily result in smaller files but will result in larger computation time) use:
optipng -zc1-9 -zm1-9 -zs0-3 -f0-5 image.png
The options -i1, -q and the compression options can be combined.
What about the pros and cons of the MetaPost driver?
The MetaPost program can handle LaTeX special text, so you can use special
text in your Fig files when using this driver. The output created
by MetaPost can be used with both LaTeX and pdfLateX. As I nearly always
use the MetaPost driver, this driver is better tested than the other
drivers.
The MetaPost language does not provide a possibility to include any
images, so you can not use included images when using this driver.
Which settings are recommended for images to be included in LaTeX documents?
tex command = latexOnly if the document is processed by plain TeX or pdfTeX you should use
tex command = texRemember to either set the TEX environment output variable to "latex" before running mpost or to invoke mpost using
mpost -tex=latexor
mpost --tex=latexto process the *.mp file. The number of minuses may differ depending on your LaTeX distribution.
preamble file = ...to refer to this minimal preamble.
\documentclass[12pt]{book}
\usepackage{ifpdf}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[intlimits]{amsmath}
\usepackage{amssymb}
\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
\usepackage{courier}
\usepackage{array}
\usepackage{enumerate}
\usepackage{longtable}
\usepackage{latexsym}
\usepackage{varioref}
\usepackage{makeidx}
\usepackage{listings}
\lstset{numbers=left, numberstyle=\tiny, numbersep=5pt, basicstyle=\small}
\usepackage{color}
\ifpdf
\usepackage[activate=normal]{pdfcprot}
\usepackage[pdftex]{graphicx}
\usepackage{epstopdf}
\pdfcompresslevel=9
\usepackage[
pdftex,
a4paper=true,
pdftitle={The fig2vect manual},
pdfsubject={fig2vect},
pdfauthor={Dipl.-Ing. D. Krause},
colorlinks=true,
bookmarks,
bookmarksnumbered,
linkcolor=linkgreen,
pdfpagemode=None,
pdfstartview=FitH
]{hyperref}
\else
\usepackage[dvips]{graphicx}
\DeclareGraphicsRule{.png}{eps}{.bb}{`bmeps #1}
\usepackage[dvips]{hyperref}
\fi
\definecolor{linkgreen}{rgb}{0,0.5,0}
\def\theyear{2002}
\author{Dipl.-Ing.~D.~Krause}
\title{The fig2vect manual}
\include{cover}
\DeclareMathOperator{\element}{\in}
\DeclareMathOperator{\notelement}{!\in}
\newcommand{\ora}[1]{\overrightarrow{#1}}
\DeclareMathOperator{\grad}{grad}
\DeclareMathOperator{\divergence}{div}
\DeclareMathOperator{\rot}{rot}
\newcommand{\atpos}[2]{{\left.#1\right|}_{#2}}
\newcommand{\inrange}[3]{{\left.#1\right|}_{#2}^{#3}}
\newcommand{\intd}[0]{\mathrm{d}}
\DeclareMathOperator{\arcsinh}{arcsinh}
\DeclareMathOperator{\card}{card}
\DeclareMathOperator{\Res}{Res}
\newcommand{\imagelw}[2]{
\begin{figure}[ht]
{\centering
\includegraphics[width=\linewidth]{#1.mps}
\caption{#2}
\label{fig:#1}
}
\end{figure}
}
\newcommand{\ximagelw}[3]{
\begin{figure}[ht]
{\centering
\includegraphics[width=#1\linewidth]{#2.mps}
\caption{#3}
\label{fig:#2}
}
\end{figure}
}
\DeclareMathOperator{\oplaplace}{\triangle}
\DeclareMathOperator{\opLaplace}{{\mathfrak L}}
\DeclareMathOperator{\iopLaplace}{{\opLaplace}^{-1}}
\DeclareMathOperator{\definedas}{\overset{=}{\text{\tiny{Def}}}}
\DeclareMathOperator{\lcorrelates}{\laplace}
\DeclareMathOperator{\ilcorrelates}{\Laplace}
\DeclareMathOperator{\mustbe}{\overset{\text{\tiny !}}{=}}
\makeindex
create a stripped down file
\documentclass[12pt]{book}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{textcomp}
\usepackage[intlimits]{amsmath}
\usepackage{amssymb}
\usepackage{mathptmx}
\usepackage[scaled=.92]{helvet}
\usepackage{courier}
and save it as "/home/jim/mypreamble.tex".preamble file = /home/jim/mypreamble.tex
normal text = handling:tex,font:similar,size:fig special text = handling:tex,font:tex,size:tex,mboxto allow automatic font changing for normal text. If -- for example -- a Fig file uses "Palatino-Bold" for a text and fig2vect was configured to use the preamble file "/home/jim/mypreamble.tex" the text is written in roman font configured by that preamble, fontweight bold, upright style (not italic).
embed fonts = no
use metapost arrowheads = yesto allow usage of MetaPost arrowheads. MetaPost produces curved arrowheads at the end of curved lines.
Which settings are recommended to produce standalone settings?
normal text = handling:none,font:fig,size:figto make sure that only the 35 well-known PostScript fonts are used.
embed fonts = yesto make sure the mpost output file contains all the fonts needed to show the texts.
What about the pros and cons of the PS/EPS driver?
When using this driver you can use included images (PNG, JPEG, NetPBM and EPS)
in the Fig file.
You can not use LaTeX special text in conjunction with this driver. In theory we
could do the same things as MetaPost: write special text to a LaTeX file, process
the file using LaTeX, read the DVI file and convert to EPS. Practically this is
a lot of work, requiring a good knowledge of DVI file structure, PS font encodings,
font metrics... and a team of volunteers contributing code.
How do I configure the PS level?
Use
ps level = 1
to produce PostScript level 1 output. Alternatively use "2" or "3".
Should I use DSC comments, how do I configure this?
Use
dsc comments = yes
to write DSC comments or
dsc comments = no
to suppress writing of DSC comments.
Alternatively you can use "1", "2" or "3" to get DSC comments matching
a certain PS level.
Normally there is no need to use DSC comments.
Should I use the showpage operator?
This operator is only allowed in PS files, not in EPS files. PS images included into documents should not contain the showpage operator, use
ps showpage = no
for these images.
Standalone image to be viewed using i.e. GhostView should contain this
operator, use
ps showpage = yes
to use the operator.
Should I use the setpagedevice operator?
This operator is only allowed in PS files, not in EPS files. In theory you could use this operator in PS files you want to convert into other graphics formats using GhostScript to set the the output media size. A better way to restrict media size to the size of the PS bounding box is to use GhostScript's -dEPSCrop option.
If you are really sure you want to use the setpagedevice operator, use the configuration option
ps setpagedevice = yes
Which options are related to included images?
remove bitmap border = yesTo draw the image box border use
remove bitmap border = no
keep bitmap aspect ratio = yesto keep the original ratio leaving some parts of the image box unused.
keep bitmap aspect ratio = noyou can fill the entire polygon using different scale factors for width and height.
fill bitmap background = noto ignore any background filling information from the Fig file or
fill bitmap background = yesto fill the polygon before adding the bitmap.
separated rgb channels = no
separated rgb channels = yes
Which options are related to PostScript virtual memory?
bitmap image dictionary = yesto encapsulate the drawing code in a
... dict begin % drawing code here endstructure. All the strings required to uncompress bitmap image data are now defined in this new dictionary. After finishing all drawing operations the dictionary is removed from the dict stack. As there is no reference to the dictionary it is unusable now, the garbage collection is allowed to remove the dictionary. The only references to the strings are contained in the dictionary, as no access to the dictionary is possible there is also no access to the strings possible. So the strings can be removed by the garbage collection too.
force garbage collection = yesto add a line
1 vmreclaimto the end of EPS output. This tells the PostScript interpreter to attempt to run the garbage collection after finishing the drawing operations.
What about the pros and cons of the PDF driver?
This driver produces PDF images which can be included in a LaTeX source processed
with pdflatex.
If there are alpha channels in embedded PNG images, the
alpha channel is converted into PDF transparency data.
This allows to place partially transparent images over other content.
The PDF driver has only minimal text processing capabilities (only
non-special left-aligned text, all fonts are converted into the
14 PDF base fonts). It is recommended to use the PDF driver in conjunction
with the TeX driver, the TeX driver should be used for both special
and non-special text.
How can I inspect the graphics instructions in the PDF file?
Use the configuration entry
plain text streams = yes
or the command line option
-o plain.text.streams=yes
to produce uncompressed plain text streams, you can open the resulting PDF file in a text editor.
How can I improve the on-screen rendering of embedded images?
Use the configuration entry
interpolate images = yes
or the command line option
-o interpolate.images=yes
to activate image interpolation.
Should I embed images containing transparency (alpha channel)?
Yes, you can. But if you use PDFs containing alpha channels with pdfLaTeX you need a special line
\pdfpageattr {/Group << /S /Transparency /I true /CS /DeviceRGB>>}
in the document preamble (suggested by J. Quirk in the pdftex mailing list).
The purpose of this line is to prevent PDF viewers from using CMYK as
color space for temporary calculations.
Note: This instruction overwrites any PDF page attributes settings
made previously by used packages... (the entire attributes set is replaced by
the attributes specified in the \pdfpageattr instruction. Use with care!
How can I get rid of the ``At least one alpha channel...'' message?
The message
At least one alpha channel was converted to PDF.
When referencing PDFs containing alpha data from your *.tex sources, you should use
\ifpdf\pdfpageattr{/Group <</S /Transparency /I true /CS /DeviceRGB>>}\fi
in the preamble.
or the german version
Ein Alpha-Kanal wurde in eine PDF-Ausgabe übertragen.
Um PDFs mit Alpha-Kanal mit pdfLaTeX zu verwenden, sollten Sie
\ifpdf\pdfpageattr{/Group <>}\fi
in der Präambel der LaTeX-Quelle verwenden.
is printed when converting *.fig files referencing PNG or TIFF files containing
alpha channels to PDF.
To suppress this message, use the -A option.
Use
bmeps -c -A
to configure it as a permanent option.
Alternatively you can create preferences file (Unix/Linux) or registry (Windows) entries manually:
[fig2vect] /pdf/suppress-alpha-info=true
REGEDIT4 [HKEY_CURRENT_USER\Software\DkApp\fig2vect] "/pdf/suppress-alpha-info"="true"
Once I have created a PDF file, how can I optimize it?
java -Xms64m -Xmx1024m -cp ...path.../Multivalent20060102.jar tool.pdf.Compress -compatible file.pdfThis creates file-o.pdf.
pdfopt input.pdf output.pdf
What is the purpose of this driver?
This driver supports other drivers which can not handle special text theirselves (i.e. the EPS or PDF driver).
Which configuration entries are needed for the TeX driver?
It depends how you want to handle normal (non-special) text. There are two choices:
[eps.tex] normal text = handling:none,font:fig,size:fig skip all texts = yes [tex] normal text = handling:none
[eps.tex] normal text = handling:tex,font:similar,size:fig,mbox skip all texts = yes [tex] normal text = handling:tex,font:similar,size:fig,mbox
how do I create the EPS- and TeX-files?
Run
fig2vect -leps.tex myfile.fig myfile.eps fig2vect -ltex myfile.fig myfile.tex
In the LaTeX source include
\begin{figure}
{\centering
\input{myfile.tex}
\caption{My image caption}
\label{fig:my-image-label}
}
\end{figure}
The document LaTeX source imports the figure LaTeX source which in turn imports the figure EPS file and write the special texts on top of it.
Use the \resizebox instruction if you need to resize the image.
\begin{figure}
{\centering
\resizebox{\linewidth}{!}{\input{myfile.tex}}
\caption{My image caption}
\label{fig:my-image-label}
}
\end{figure}
What about the pros and cons of the SVG driver?
When using this driver you can use included images of any type in the
Fig file as the driver does not need to convert included images, it simply
writes a reference. But you must make sure your SVG viewer can render the
included image.
Special comments can be used to insert ECMA-Script code into the SVG output
and to attach event handlers and links to objects.
Using the Adobe SVG viewer you can embed SVG images into other applications
(i.e. Office applications) on Windows systems.
Special text can not be used with this driver.
Why are some SVG images malformed when using Adobe SVG viewer plugin on Linux systems?
You should try to set the environment variable LC_NUMERIC like this
LC_NUMERIC=C export LC_NUMERIC
before starting the web browser.
The locale definition (LANG environment variable) might indicate the use of
"," instead of "." as decimal point in floating point numbers.
The SVG file format always uses "." and does not care about
your language.
I think the plugin should take care of this and use
localization-independent functions to read floating point numbers. Unfortunately
version 3.01 doesn't.
How do I configure the SVG level?
Use the
svg version = 1.0
configuration option, you can either specify "1.0", "1.1" or "1.2" here.
Should I create standalone SVG images or embedded fragments?
The driver can produce both standalone SVG images and SVG fragments
for embedding in XML documents.
To produce standalone images use
embedded svg fragment = no
to produce an embedded fragment switch to "yes". When embedding an SVG fragment in an XML document the surrounding XML document must be prepared to use the XML namespaces "svg" and "xlink".
How can I choose a unit for width and height?
The SVG tag contains width/height information and a viewport
specification. The width and height attributes specify the physical size
of the image, the viewport attribute specifies the logical coordinates
assigned to that area.
The
wh specification = inches
configuration setting allows to choose whether to produce with attributes measured in inches, without units ("points") or in px ("pixels").
How do I control object styling?
There are three ways to specify an SVG object's style:
<rect fill="yellow" stroke="black" stroke-width="0.9" .../>
<rect style="fill: yellow; stroke: black; stroke-width: 0.9;" .../>
<style type="text/css"><![CDATA[
.c1 {
fill: yellow;
stroke: black;
stroke-width: 0.9;
}
]]></style>
<rect class="c1" .../>
Both style and class attribute have higher priority
than the multiple simple property attributes. This is
important if you plan to use animation or event handlers
to change simple properties.
If an objects style is defined via style or class
attribute, changes made on simple properties have no
visible impact.
The multiple property attributes are used by fig2vect
automatically if
prepare for modifications = yesconfiguration setting is used.
If none of these conditions is fullfilled the
use css = yes
setting enables the use of class attributes, "no" uses style attributes instead.
How do I add ECMA-script (JavaScript) code?
To add ECMA-script code into a <script> tag, write it into a file, i.e. "mycode.js". Use either the configuration setting
js library = mycode.js
or add a special comment
## svg: js library = mycode.js
on the document level.
Document level comments must be inserted between line
8 (transparent color) and 9 (resolution, coord-system),
i.e.
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 1200 2
is changed to
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 ## svg: js library = mycode.js 1200 2
When fig2vect writes SVG output, the contents of the file mycode.js is transferred into the <script> section.
how do I attach event handlers and IDs to objects?
Comments (and special comments) related to an object must be placed immediately before the line starting the object. Event handlers can be defined in special comments, i.e. by changing
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 ## svg: js library = mycode.js 1200 2 1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 990 900 450 180 990 900 1440 720
to
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 ## svg: js library = mycode.js 1200 2 ## svg: onmouseover = fill_yellow(evt) ## svg: onmouseout = fill_white(evt) ## svg: id = e1 1 1 0 1 0 7 50 0 -1 0.000 1 0.0000 990 900 450 180 990 900 1440 720
This changes
<ellipse transform="translate(49.2 22.1)" rx="27" ry="10.8" fill="none" stroke="#000000" stroke-width="0.9" />
to
<ellipse transform="translate(49.2 22.1)" rx="27" ry="10.8" fill="none" stroke="#000000" stroke-width="0.9" id="e1" onmouseover="fill_yellow(evt)" onmouseout="fill_white(evt)" />
How do I attach event handlers to the entire drawing?
Event handlers for the entire drawing can be specified in special comments in the document level, i.e. change
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 ## svg: js library = mycode.js 1200 2
to
#FIG 3.2 Portrait Center Metric A6 100.00 Single -2 ## svg: js library = mycode.js ## svg: onload = handler_onload(evt) 1200 2
This changes
<svg width="255px" height="298px" viewBox="0 0 255 298" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" >
to
<svg width="255px" height="298px" viewBox="0 0 255 298" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" onload="handler_onload(evt)" >
How can I improve the quality of text rendering?
Obtain the Ghostscript fonts. Convert them to SVG fonts using the FontForge software (see below). Use the
gs svg-font directory = ...url...
configuration setting to tell fig2vect which location to reference in SVG output.
How do I convert the GhostScript fonts to SVG?
Obtain the Ghostscript fonts and the sources for these fonts.
Unpack both archives into one temporary directory. You should have
35 *.pfb files and 33 *.sfd files there.
Open each of the *.pfb files in FontForge. Save the font using the
same name but suffix ".svg".
Optionally: Open each of the *.sfd files in FontForge. Save the fonts as
*.svg:
NimbusRomanNo9L-Regu.sfd n021003l.svg NimbusRomNo9L-ReguItal.sfd n021023l.svg NimbusRomNo9L-Medi.sfd n021004l.svg NimbusRomNo9L-MediItal.sfd n021024l.svg URWGothicL-Book.sfd a010013l.svg URWGothicL-BookObli.sfd a010033l.svg URWGothicL-Demi.sfd a010015l.svg URWGothicL-DemiObli.sfd a010035l.svg URWBookmanL-Ligh.sfd b018012l.svg URWBookmanL-LighItal.sfd b018032l.svg URWBookmanL-DemiBold.sfd b018015l.svg URWBookmanL-DemiBoldItal.sfd b018035l.svg NimbusMonL-Regu.sfd n022003l.svg NimbusMonL-ReguObli.sfd n022023l.svg NimbusMonL-Bold.sfd n022004l.svg NimbusMonL-BoldObli.sfd n022024l.svg NimbusSansL-Regu.sfd n019003l.svg NimbusSanL-ReguItal.sfd n019023l.svg NimbusSansL-Bold.sfd n019004l.svg NimbusSanL-BoldItal.sfd n019024l.svg NimbusSanL-ReguCond.sfd n019043l.svg NimbusSanL-ReguCondItal.sfd n019063l.svg NimbusSanL-BoldCond.sfd n019044l.svg NimbusSanL-BoldCondItal.sfd n019064l.svg CenturySchL-Roma.sfd c059013l.svg CenturySchL-Ital.sfd c059033l.svg CenturySchL-Bold.sfd c059016l.svg CenturySchL-BoldItal.sfd c059036l.svg URWPalladioL-Roma.sfd p052003l.svg URWPalladioL-Ital.sfd p052023l.svg URWPalladioL-Bold.sfd p052004l.svg URWPalladioL-BoldItal.sfd p052024l.svg s050000l.pfb s050000l.svg URWChanceryL-MediItal.sfd z003034l.svg d050000l.pfb d050000l.svg
Experienced users might use scripting.
Place the *.svg files in a separated directory, i.e.
/usr/local/share/gs-fonts/svg.
In a separated configuration section use the configuration setting
[svg.gs] gs svg-font directory = file:///usr/local/share/gs-fonts/svg
to point to that directory. When preparing SVG files for use on web sites create an additional configuration section, i.e.
[svg.gs-web] gs svg-font directory = http://www.my-org.com/gs-fonts/svg
So you can use the svg.gs configuration as long as you are still editing the Fig files to produce SVG files for local (and offline) viewing. Before uploading the SVG files to the web server produce the final versions using the svg.gs-web configuration.
Note: The Ghostscript fonts are licensed under the terms
of the GNU General Public License.
Please read the file COPYING from the Ghostscript fonts
distribution for details.
If you make GPL-licensed software (i.e. the *.svg font files)
accessable to other users - i.e. by placing them in a shared
directory in a LAN or on a multi-user computer system or
on web/ftp servers - you are responsible
for making all the sources for that software available too.
Access to the sources
should not be more complicated than access to the software.
To fullfill the requirements of the GPL I suggest to place
the archives containing
Ghostscript fonts and the Ghostscript fonts sources used
to build the *.svg font files in the same directories as
the *.svg font files.
What's the purpose of this driver?
Using the Java driver you can gather information in a Java
program using a GUI and print the data on paper in a form.
You can design the printed version using XFig, jFig or WinFig;
the Java driver converts it into a java.awt.Printable which can
be used to print from the Java program.
After creating an instance of the Printable you can call
replaceText() to replace the dummy texts used in the Fig file
by data entered in the GUI.
Are there restrictions when using the Java driver?
The Java driver can not handle fill patterns nor special text.
How do I configure font usage for the Printable?
In general you can use the following mechanisms to create/use fonts in the Printable:
The ``font configuration file'' entry in the fig2vect.cfg file chooses a font configuration file (i.e. combfont.cfg or webfont.cfg).
How do I configure the Printable to search for a font in the *.jar file?
Specify a file name (without leading directory) in a ``pfb file''
line. Do not add a ``pfb base'' line.
In the example you see a section from combfont.cfg:
[Times-Roman] name = Times New Roman source type = system features = roman family = Times New Roman driver = * name = Bodoni MT source type = system features = roman family = Bodoni MT driver = * name = NimbusRomanNo9L-Regu source type = download directory = ./urw-svg file name = n021003l.svg features = roman family = Nimbus Roman No9 L driver = svg font type = svg pfb file = n021003l.pfb
The last line of the last entry in the example tells the Printable to use a font file named ``n021003l.pfb''. No base is given for the file name so the Printable searches in the root directory of the *.jar archive for the file. When creating the *.jar archive you have to make sure the archive contains the n021003l.pfb file!
How do I configure the Printable to search for fonts using URLs?
Specify a file name in a ``pfb file'' line and the URL of the
directory in a ``pfb base'' line.
In the example you see a section from webfont.cfg:
[Times-Roman] name = NimbusRomanNo9L-Regu source type = download directory = ./urw-svg file name = n021003l.svg features = roman family = Nimbus Roman No9 L driver = svg font type = svg pfb file = n021003l.pfb pfb base = http://my-server.my-domain.com/gs-fonts
The last two lines configure the Printable to search for the font in http://my-server.my-domain.com/gs-fonts/n021003l.pfb. You must upload the *.pfb file(s) into the appropriate directory on your web server!
How do I configure the Printable to search for fonts by names?
In the example (excerpt from combfont.cfg)
[Times-Roman] name = Times New Roman source type = system features = roman family = Times New Roman driver = * name = Bodoni MT source type = system features = roman family = Bodoni MT driver = * name = NimbusRomanNo9L-Regu source type = download directory = ./urw-svg file name = n021003l.svg features = roman family = Nimbus Roman No9 L driver = svg font type = svg pfb file = n021003l.pfb
The printable first searches for the pfb file n021003l.pfb
for texts written in Times-Roman in the Fig file.
If this file is not found (i.e. you did not add it to the *.jar archive),
the logical font names
``Times New Roman", ``Bodoni MT'' and
``NimbusRomanNo9L-Regu'' are searched.
Where can I obtain font files (i.e. GhostScript fonts)?
Fig drawings use PostScript fonts to show text. If you want your
printed form to look exactly like the Fig drawing you need fonts
looking like the PostScript fonts.
A collection of such fonts is shipped with GhostScript. Download
the GhostScript sources and take a look into the Resource/Font
directory of the distribution.
Run x.sh
: cp NimbusRomNo9L-Regu n021003l.pfb cp NimbusRomNo9L-ReguItal n021023l.pfb cp NimbusRomNo9L-Medi n021004l.pfb cp NimbusRomNo9L-MediItal n021024l.pfb cp URWGothicL-Book a010013l.pfb cp URWGothicL-BookObli a010033l.pfb cp URWGothicL-Demi a010015l.pfb cp URWGothicL-DemiObli a010035l.pfb cp URWBookmanL-Ligh b018012l.pfb cp URWBookmanL-LighItal b018032l.pfb cp URWBookmanL-DemiBold b018015l.pfb cp URWBookmanL-DemiBoldItal b018035l.pfb cp NimbusMonL-Regu n022003l.pfb cp NimbusMonL-ReguObli n022023l.pfb cp NimbusMonL-Bold n022004l.pfb cp NimbusMonL-BoldObli n022024l.pfb cp NimbusSanL-Regu n019003l.pfb cp NimbusSanL-ReguItal n019023l.pfb cp NimbusSanL-Bold n019004l.pfb cp NimbusSanL-BoldItal n019024l.pfb cp NimbusSanL-ReguCond n019043l.pfb cp NimbusSanL-ReguCondItal n019063l.pfb cp NimbusSanL-BoldCond n019044l.pfb cp NimbusSanL-BoldCondItal n019064l.pfb cp CenturySchL-Roma c059013l.pfb cp CenturySchL-Ital c059033l.pfb cp CenturySchL-Bold c059016l.pfb cp CenturySchL-BoldItal c059036l.pfb cp URWPalladioL-Roma p052003l.pfb cp URWPalladioL-Ital p052023l.pfb cp URWPalladioL-Bold p052004l.pfb cp URWPalladioL-BoldItal p052024l.pfb cp StandardSymL s050000l.pfb cp URWChanceryL-MediItal z003034l.pfb cp Dingbats d050000l.pfb
to create copies of the font files.
Move the *.pfb files into a separate directory, i.e. /usr/local/gs-fonts.
Should I use the GhostScript *.pfb fonts?
It depends.
GhostScript -- and the GhostScript fonts which are a part of GhostScript -- are
released under the terms of the GNU General Public License
(GNU GPL)
with only one exception: Documents including/referring to the fonts are not
required to use the GNU GPL.
All works based on a GNU GPL licensed work are required to be distributed
under the GNU GPL too if the program is published/distributed.
If your *.jar archive contains any of the files
from the GhostScript distribution it is based on GhostScript and must be
distributed under the terms of the GNU GPL.
If this is not acceptable to you to publish your Java application under the
terms of the GNU GPL you must not use the GhostScript fonts.
UNICODE is a character set using 32 bits. Documents using
this character set can use characters/glyphs from different
languages.
UTF-8 is an encoding for UNICODE characters using 1 byte for
the glyphs used most often and up to 6 bytes (48 bits)
for the not-so-popular glyphs.
What problems can occur when using UTF-8 encoding?
The same glyph is encoded differently when using UTF-8 and traditional encodings. An application showing text must know whether or not the text is UTF-8 encoded or not.
What's the problem with Fig files and UTF-8?
The Fig file format does not allow to provide information whether
or not UTF-8 is used.
So there are two ways to tell applications processing Fig files which
encoding is used:
[Unix/Linux] How will I know whether or not UTF-8 is used?
Check the LANG environment variable. If it ends on ``.UTF-8''
(not case-sensitive) -- like ``de_DE.UTF-8'' your system uses
UTF-8 encoding.
If it does not end on ``.UTF-8'' -- i.e. ``de_DE'' -- your system
does not use UTF-8 encoding.
How does my graphical desktop handle native characters?
Handling of native characters (i.e. german umlauts) depends on the systems LANG setting.
Can I simply change the LANG environment variable for one program?
No, don't do that! All desktop applications must use the same UTF-8 setting.
You may change LANG from ``de_DE'' to ``en_US'' or from ``de_DE.UTF-8'' to
``en_US.UTF-8'', but not from ``de_DE'' to ``de_DE.UTF-8''.
If you want to change the UTF-8 usage, log in as root (or Administrator),
change the setting globally -- i.e. in /etc/sysconfig/i18n -- and reboot
the system.
If the desktop delivers not-UTF-8 encoded data and an application expects
UTF-8 encoded data (or vice versa) there is a wide variety of results:
unknown keyboard bindings, application crashes...
How do Fig drawing applications handle UTF-8 encoding?
How do fig2vect, text2lat and echo2lat handle UTF-8 encoding?
Fig2vect cares about UTF-8 encoded text in non-special text only.
In special text you can use LaTeX code directly to produce the glyphs you need.
Handling UTF-8 encoded strings depends on the driver:
In text2lat and echo2lat input text is UTF-8 decoded if necessary, the programs replace each character by the corresponding LaTeX encoding. Text2lat allows to specify whether or not newlines are replaced by ``\\<newline>'' and whether or not spaces are replaced by ``~''.
How are LaTeX encodings found, how do I create my own tables?
The dklibs library set uses a preference to
find a shared directory (shared between all dklibs-based applications).
This directory is /usr/local/share on Unix/Linux and
c:\programme\krause\share on Windows by default. The
``c:\programme'' part can differ, it depends on your Windows
version and language.
This directory contains a sub-directory ``uc2lat-t'' providing
tables for translation from UNICODE to LaTeX. There is a nested
directory structure containing multiple files. Files are loaded
on demand.
The encoding for UNICODE 0x01234567 is found by searching the
file 01/23/45.dat file for an 0x67 entry.
There are three types of entries in the
file:
Example (from 00/00/00.dat):
# Raute
* 0x23 \#
# Asterisk
t 0x2A \textasteriskcentered{}
m 0x2A *
# Smaller-than
t 0x3C \textless{}
m 0x3C <
If you have created or modified tables, please share them! If you are willing to publish them under BSD-style license conditions (the license used by dklibs), please use the bug-tracking or feature-request mechanisms or forums on SourceForge (http://sourceforge.net/projects/dklibs/) to submit the tables.
Should I apply changes to the *.c or *.ctr files?
Apply changes to the *.ctr files only.
The *.c files are generated from the *.ctr files automatically
by running the tracecc preprocessor. See
http://dklibs.sourceforge.net
for details, there is a manual tracecc.pdf available.