| 1 |
Autotracing bitmaps in FontForge |
| 2 |
================================ |
| 3 |
|
| 4 |
FontForge does not have a native autotrace, but it will happily use the output |
| 5 |
of two freely available programs which do autotracing. These are: |
| 6 |
|
| 7 |
* Peter Selinger's `potrace <http://potrace.sf.net/>`_ |
| 8 |
* Martin Weber's `autotrace program <http://sourceforge.net/projects/autotrace/>`_ |
| 9 |
|
| 10 |
.. note:: |
| 11 |
|
| 12 |
Autotrace 2.8 changed its argument conventions (around Dec 2001). New |
| 13 |
versions (after 15 Dec) of fontforge will not work with autotrace2.7, old |
| 14 |
versions of fontforge will not work with autotrace2.8. I see no way to make |
| 15 |
fontforge work with both or to detect the current version... |
| 16 |
|
| 17 |
.. note:: |
| 18 |
|
| 19 |
I may not be loading the results of autotrace properly in all cases (I do in |
| 20 |
my test cases, of course). AutoTrace traces out both foreground and |
| 21 |
background regions, so I may sometimes leave behind a lump which represents a |
| 22 |
background area. Just delete it if it happens (and send me the image so I can |
| 23 |
fix things up). |
| 24 |
|
| 25 |
You must download at least one of these, (and possibly build it), and install it |
| 26 |
somewhere along your PATH. |
| 27 |
|
| 28 |
Having done that you must get an image into the background of the glyph(s) you |
| 29 |
want to autotrace. There are several ways of doing this: |
| 30 |
|
| 31 |
.. object:: From a bitmap font |
| 32 |
|
| 33 |
If you want to autotrace a bitmap font then (from the FontView) |
| 34 |
|
| 35 |
* (You will probably want to start out with a new font, but you might not) |
| 36 |
* :menuselection:`File --> Import` |
| 37 |
* select the bitmap font type (bdf, FON, embedded in a ttf file, TeX bitmap |
| 38 |
(GF, PK), etc.) |
| 39 |
* turn on the ``[*] As Background`` flag |
| 40 |
* Select your font file |
| 41 |
* This should place the bitmaps into the background of the glyphs in the font. |
| 42 |
Nothing will be visible in the font view, but if you open up an outline glyph |
| 43 |
view, you should see the bitmap version of the glyph as a grey background. |
| 44 |
|
| 45 |
.. object:: From the clipboard |
| 46 |
|
| 47 |
If you have an application that supports sending image selections by mime |
| 48 |
type (kde does this), then you should be able to copy the image in that |
| 49 |
application and paste it into the appropriate glyph window in FontForge |
| 50 |
|
| 51 |
.. object:: From an image file |
| 52 |
|
| 53 |
If you have a bitmap in an image (it works best if it IS a black and white |
| 54 |
bitmap image, rather than a color image) |
| 55 |
|
| 56 |
* Open up an outline glyph view for the appropriate glyph |
| 57 |
* Make the Background layer active (this is usually not necessary) |
| 58 |
* :menuselection:`File --> Import` |
| 59 |
* select Format=Image (this will show you any image format that fontforge |
| 60 |
supports) |
| 61 |
* Select your file |
| 62 |
* The image should now be visible in the background of this glyph |
| 63 |
|
| 64 |
.. object:: From multiple image files |
| 65 |
|
| 66 |
If you have many images, you can load them with one command, but you must |
| 67 |
name them appropriately. For example if your font contains unicode characters |
| 68 |
U+0041 (LATIN CAPITAL LETTER A) through U+0049 (LATIN CAPITAL LETTER J) then |
| 69 |
create files called "uni0041.png", "uni0042.png", ... "uni0049.png" |
| 70 |
containing the images for the appropriate characters, then (from the Font |
| 71 |
View) |
| 72 |
|
| 73 |
* Select the requisite glyphs |
| 74 |
* :menuselection:`File --> Import` |
| 75 |
* select Format=Image template |
| 76 |
* select the first of your images, "uni0041.png" |
| 77 |
* This should load all images that match that template ("uni*.png") into the |
| 78 |
appropriate glyph slot |
| 79 |
|
| 80 |
Once you have background images in your font (and have installed an autotrace |
| 81 |
program) |
| 82 |
|
| 83 |
* Select all the glyphs you wish to autotrace |
| 84 |
* :menuselection:`Element --> Autotrace` |
| 85 |
|
| 86 |
This can take a while, so be patient. |
| 87 |
|
| 88 |
.. note:: |
| 89 |
|
| 90 |
Unless you are working with a TeX bitmap font, you will most likely have an |
| 91 |
extremely low resolution image. Autotrace programs work better the more |
| 92 |
resolution you give them. |
| 93 |
|
| 94 |
If you hold down the shift key when you invoke AutoTrace from the menu then you |
| 95 |
will be prompted for arguments to pass to it, if you do not hold down the shift |
| 96 |
key FontForge will use the same arguments it used last time. AutoTrace's |
| 97 |
arguments are described in "$ autotrace -help" or in the README file that came |
| 98 |
with the program. Please do not specify input/output files or formats. FontForge |
| 99 |
fills these in. |