Fig2vect logo

fig2vect

SourceForge.net Logo
Yet another Fig to vector converter

Workshop: Creating a logo (PNG file)

PDF manual "fig2vect.pdf" available
german version "f2vde.pdf" available too
Overview
Before we begin
Preparing the logo basics in jFig
Convert the file to SVG
Manual correction of width and height in the SVG file
Start Squiggle
Manual modifications to the SVG file
Converting the logo to PNG

Overview

In this course we will create a partial transparent PNG file to be used as logo on web pages. The logo will have a width of 210 pixels and a height of 62 pixels (same size as the logos in the upper left and upper right corner of this document).
In the table below the logo is placed in four table cells using different background colors.

Test-Logo
This table cell has a white background.
Test-Logo
This table cell has a lightred background.
Test-Logo
This table cell has a lightgreen background.
Test-Logo
This table cell has a lightblue background.

First we prepare the logo basics in jFig, later we convert the testlogo.fig file to testlogo.svg using fig2vect. After applying manual modifications to the SVG file we convert it to PNG using the Batik rasterizer.
To follow the course you need:

Before we begin

Before we begin we have to calculate the dimensions of our Fig file. Two conversions are run on the Fig file, it is converted to SVG using fig2vect first, the SVG file is converted to PNG using the Batik rasterizer. Both conversions should not result in distorsions, so the Fig file, the SVG file and the final PNG file should have the same width/height ratio.
The width/height ratio is given by the number of pixels, it is 210/62 which can be reduced to 105/31. So we will use 105 times the smallest usable length unit (sulu) for the image width and 31 sulu for the image height. Now we need to find the length of 1 sulu.
The fig2vect program calculates the image dimensions from the graphics elements (except texts) and uses PS points (72 per inch) for all output drivers. If this calculation does not result in integer numbers, the image is enlarged a little bit to have integer values for the bounding box. We want to avoid this rounding operation, so we need to choose image dimensions resulting directly in integer numbers after the conversion to PS points. This means one sulu must correspond to an integer number when expressed in PS points.
In jFig we want to use the magnetic grid which depends on the unit settings, the zoom factor and the magnetic grid settings. As the fig2vect output resolution is based on inches it is a good idea to set the units to inches in jFig too. The magnetic grid steps are fractions of one inch in this case, typically powers of 1/2. So the magnetic grid steps are candidates to become a sulu, we have to check which candidates can be expressed in integer numbers in all coordinate spaces involved:

sulu candidate length in
jFig internal units
(2400 per inch)
length in
Fig units
(1200 per inch)
length in
PS points
(72 per inch)
1 inch2400120072
1/2 inch120060036
1/4 inch60030018
1/8 inch3001509
1/16 inch150754.5
As seen in the table the smallest candidate fullfilling our demands is 1/8 inch.
So we use 1 sulu = 1/8 inch. Our image width is 105/8 inch = 13+1/8 inch. The image height is 3+7/8 inch.

Preparing the logo basics in jFig

Convert the file to SVG

To convert the testlogo.fig file to testlogo.svg we use
 
fig2vect options testlogo.fig testlogo.svg
 
The following options are needed:

If you create a configuration
[svg.logo]
gs svg-font directory		=	/windows/p/urw-svg
font scale factor		=	0.92
wh specification		=	pixels
verbose output			=	yes
remove background rectangle	=	yes
background rectangle color	=	white
in section 2 or 3 of the fig2vect.cfg configuration file it is sufficient to run the fig2vect program using
 
fig2vect -lsvg.logo testlogo.fig testlogo.svg
 

Manual correction of width and height in the SVG file

Open testlogo.svg in your favourite text editor and replace

<svg width="945px" height="279px" viewBox="0 0 945 279"
by
<svg width="210px" height="62px" viewBox="0 0 945 279"

Start Squiggle

Run

java -jar /opt/batik-1.6/batik-squiggle.jar &
to start the Batik SVG viewer.
Use the "File / Open File..." menu item to open testlogo.svg. After applying modifications (see next section) to testlogo.svg we can refresh the view using the "File / Reload Document" menu item or the toolbar button.
SVG file in Squiggle

Manual modifications to the SVG file

To add some transparency gradients we need to edit the SVG file in a text editor.
We need four transparency masks, a horizontal and a vertical one for both the yellow and the red rectangle. Each of the masks needs one gradient to specify transparency values.
We use the following names for the gradients and masks:
NameUsage
HG1horizontal gradient for the yellow rectangle
HM1horizontal mask for the yellow rectangle
VG1vertical gradient for the yellow rectangle
VM1vertical mask for the yellow rectangle
HG2horizontal gradient for the red rectangle
HM2horizontal mask for the red rectangle
VG2vertical gradient for the red rectangle
VM2vertical mask for the red rectangle

Converting the logo to PNG

Run

java -jar /opt/batik-1.6/batik-rasterizer.jar testlogo.svg
to convert the logo to PNG.