Pinguin is invoked from the command line. It’s an esoteric tool that won’t see widespread use, so please forgive that error handling is minimal. If you encounter trouble that can’t be puzzled out from Python’s traceback messages, ask for help in the Adafruit Forums, or open an issue on GitHub if it’s clearly a bug.
At its simplest, Pinguin accepts an EAGLE .brd file for input:
python pinguin.py /path/to/file/board.brd
(You might need “python3
” on a few systems that keep Python 2.X around for vintage compatibility.)
The output will be a new .brd file (the original remains untouched) with “_out” inserted in the name; e.g. if board.brd
is the input file, the output will be board_out.brd
.
HERE’S WHAT HAPPENS:
- The script looks for any text objects in layers 21 (tPlace) and 22 (bPlace) — these are normally the top and bottom silkscreen layers.
- A TrueType font is chosen based on the object’s font property: vector, proportional or fixed. EAGLE allows selecting “proportional” even though it can’t handle this on output.
- A high-resolution raster equivalent is generated and placed at roughly the same position, either in layer 170 (for top elements) or 171 (bottom).
- The original text object is moved to layer 172 (top) or 173 (bottom) for safekeeping.
Layers 170–173 were chosen as they’re not normally dedicated to anything in EAGLE. If you do use any of those layers for something in your own workflow, you’ll want to modify the script (there are global settings near the top).
The new layers 170 & 171 should be included as silk when generating EAGLE’s CAM output. The backup layers 172 & 173 should be hidden.
Here’s what a board might look like before, using the “vector” font, and the output file after processing:
Because the text elements have been rasterized, they’re no longer directly editable in EAGLE. You can move and rotate these rasters, but to change the text you’ll need to find the original item in backup layers 172 or 173, change properties to move it back to layer 21 or 22, edit the text and re-run Pinguin.
This is why Pinguin outputs to a new file. The raster text…especially from “vector” font text…isn’t a perfect match, and you may be iterating a few times to find an ideal size and appearance. Then tweak the positions in EAGLE in the output file if needed.
Selecting and Scaling Fonts
A few command line options allow changing TrueType font selections and relative sizes.
-vfont
, -pfont
and -ffont
select different TrueType fonts for the vector, proportional and fixed text elements. They can be set individually, or in combination. Each accepts a TrueType font filename, for example:
python pinguin.py board.brd -vfont fonts/GNU/FreeSans.ttf
The default proportional and fixed fonts match what EAGLE uses for display (but not output), so it’s somewhat WYSIWYG-like in that regard. The default vector font isn’t a close match so you’ll probably want to experiment. The fonts folder contains a few items with permissive licensing, and there’s a ton more at fonts.google.com.
-vscale
, -pscale
and -fscale
adjust the size of the rasterized vector, proportional or fixed text. Each accepts a floating-point value, empirically derived, larger value = larger font. For example:
python pinguin.py board.brd -vscale 1.33
Default scales for vector, proportional and fixed fonts are around 1.33, 1.41 and 1.41, respectively. Combined with the default fonts, these are a near perfect match for proportional and fixed text elements (vector, not so much).
Other Settings, and Limitations
Pinguin’s raster resolution can be configured with the -dpi
setting:
python pinguin.py board.brd -dpi 600
Default is 1200 dots per inch, which is probably excessive, but no harm done. Too much is better than too little, especially with text at an angle. You can try lower values if concerned about output file sizes.
MULTI-LINE TEXT
EAGLE allows entering multi-line text, but Pinguin might not render this with the same line spacing, or might get the vertical position slightly wrong. A workaround for now is to enter each line as a separate text object.
NO INVERSE
Pinguin only generates “positives” — the text is whatever your silk color is. If you need inverse (e.g. black text inside a white box), SparkFun’s Buzzard has you covered!
REALITY LOOKS BETTER THAN EAGLE
Something about the way EAGLE renders these raster objects makes them look grainy on-screen. Pinguin’s (and Buzzard’s) rasters are actually pretty sharp, and you’ll see this in a Gerber viewer app.
Text editor powered by tinymce.