Skip to content

Label Maker

Nick Poole edited this page Apr 12, 2018 · 13 revisions

Getting Started

The Buzzard Label Maker is designed for speed: It should allow you to quickly create as many silkscreen flags as you need, export them into a library file and get back into EAGLE. When you open the Label Maker, your interface should look like this:

Label Maker Interface showing a preview canvas on the left and some form fields on the right

There are a lot of knobs and switches for tuning your labels to look the way to like them, but if all you want is rounded labels all the same size in readable typeface, you really just need to type a few things and click a button...

Basic Operation

Using the default settings, Buzzard will produce capsule-shaped silkscreen flags with a height of 1.64 millimeters. This size makes the text itself roughly equivalent to EAGLE's vector font at size 0.04, a common label size. In fact, you should find that EAGLE's vector font size is roughly equivalent to Buzzard's Scale Factor.

Comparison of Label Maker defaults and EAGLE default silkscreen sizes

Customizing your labels is as simple as typing into the "Label Text" field. You should notice that the preview changes to represent whatever you type. Label Maker supports any input that the type-face will support including many useful Unicode characters! Whatever shows up in the preview window is exactly what will show up on your silk layer.

Heads Up! All typefaces used by Label Maker are imported from Google Fonts which are free and open source. We've imported a limited subsection of those fonts with heavier line weights which are likely to perform well when printed.

To generate more than one label at once, simply follow your text with a comma (,) and a new label will be started. The label preceding the comma will be added to the list of "Pop Labels" below the label text field. If you'd like to edit a label, simply click on the Pop Label and it will pop out into the text field (whatever is in the text field, consequently, will be popped into a Pop Label) To remove a Pop Label from your library, simply hover over the Pop Label until you see the circular minus bubble and click on the bubble. You can enter as many labels as you want and they will be combined into a single library file!

Careful! All of the rasterized EAGLE library XML is stored as a data attribute of the Pop Label when it is created. This means that if you press comma (,) BEFORE the label has loaded in the preview canvas, the label will not be rendered correctly in your library file. This is easy to correct by simply clicking on your Pop Label and giving it a moment to render before popping it back into the list.

A list of pink Pop Labels are shown underneath the text entry field

To generate the library file, click the "Download EAGLE Library" button and a file called "buzzard_labels.lbr" will begin downloading. Simply "use" this library file in your EAGLE project and you will be able to add each label as a device. As part of the library generation process, each label is given a schematic symbol which consists of the label's text minus special characters and spaces.

close up of the library download button and EAGLE Scale Factor adjustment

Advanced Properties

Each Pop Label maintains its own properties, so your library can contain labels with different shapes, sizes and font-faces. A number of property controls on the right side of the interface allow you to customize the look and feel of your labels.

close up of the property controls including font, font-size, vertical offset, left and right cap style and sharpness controls

Font

The available fonts are a selection of Google Fonts which are bold enough to be resolved in printing at small sizes. Depending on the speed of your internet connection, you may need to select a font more than once before it is properly rendered.

Font Size

This property controls the size of the label text in proportion to the label itself. If this size is set too small, it may affect the legibility and abrasion resistance of the printed silkscreen. If it is too large, it may overrun the label.

Vertical Offset

This property controls the vertical position of the label text which is useful for centering the text after the font or size has been changed.

Left and Right Cap Style

These "caps" change the shape of the label. They are both set to "rounded" by default, giving the label a capsule shape. There are five styles of end cap: square, rounded, pointer, backslash and forwardslash. Combining these end caps allows you to make a large variety of flag styles.

Sharpness

This control adjusts the threshold cutoff for the function which reduces the softened edges to 1-bit color (as required for silk screening) It may sound abstract but if you play with it a little, the utility becomes clear. Use it to improve the legibility of your label text.

Text Only

This checkbox allows you to turn off the flag portion of the label and generate rasterized text strings only. This attribute "sticks" to the pop-label to which it is applied so you can mix and match flag labels with text only labels in the same library.

Underneath these property controls, you'll find the EAGLE Scale Factor which controls what size your labels will be in real life. The EAGLE Scale Factor is technically given in "millimeters per canvas pixel" but it's much easier to think of it as an abstract scalar and adjust it while watching the "real size" readout. It's also helpful to keep in mind that all labels with the same Scale Factor will share the same real-world height.

Close up view of the "Invert Preview" and "Show XML" checkbox controls

Finally there are a pair of checkbox controls which I found useful in debugging so I left them in. The "Invert Preview" control simply inverts the color of the canvas object which may be useful if your silkscreen is a lighter color than your solder mask. The state of this checkbox will not affect the EAGLE rendered output. The "Show XML" checkbox will produce a text field containing the EAGLE XML output of the currently previewed label. This output can be copy/pasted into an EAGLE board file (but will lack the grouping afforded by a library, making the rendered object difficult to move and rotate)

Technical Details

Labels are rendered into EAGLE XML using a rastering technique similar to EAGLE's BMP importer. When you enter text in the "label text" field, it's rendered onto an HTML5 canvas object along with a rectangle of equal length and fixed height. The end caps are stored in the tool's source as base64 encoded PNG images which are rendered onto the canvas after the text. The entire canvas object is then reduced to 1-bit color using a very simple threshold function. After the canvas is ready for export to EAGLE, it is cropped to the size of the label and rasterized.

The rastering function iterates through each pixel of the cropped canvas object and determines whether each pixel is the start or end of a rectangle. Each rectangle object represents a string of consecutive same-color pixels. The rectangles are sized according to the Scale Factor and when they're rendered by EAGLE, they produce a pixel perfect reproduction of the canvas object. This approach is bloated, but it avoids the difficult problem of slicing nested polygons before importing them into EAGLE, as EAGLE's XML vector format does not support nested polygons.

The properties of a label, as well as the EAGLE XML output, are stored as data attributes of the ".popLabel" class objects at creation. For this reason, and because web fonts take time to load in, it is possible to "beat" the canvas rendering function and press comma (,) thus storing a malformed XML output with the Pop Label. Fortunately, the properties are also stored and Pop Labels are always re-rendered when they're "popped" out of the list.

Unicode characters are at least partially supported as a natural consequence of HTML5 and typeface support. EAGLE, of course, is unaware of the Unicode once it's been rasterized. All Label, Device and Symbol names are sanitized of spaces (replaced with underscores) and other non-alphanumerics (replaced with pound signs) so that EAGLE doesn't throw a fit. De Facto Unicode character support was left in because some Unicode characters have natural utility as silkscreen labels (Ω, ㏀, ㏁, µ, etc)