Custom Fonts in Kicad?

Hi, I sometimes use Kicad to design pcbs which I use as faceplates. Using the built in text tool to do labels is convenient, but the font is pretty uninspiring. Meanwhile, making a custom bitmap footprint for each label would take forever. Is there a way to use a custom font with the text tool?

Short answer, KiCad can only use it’s builtin font.

In theory, one can write some Python code to get system fonts, render onto in-memory bitmap, then convert the bitmap to polylines which could be inserted into the PCB. There are scripts to insert bar codes for example. For curiosity, I did some experimenting with system fonts along those lines. It’s a somewhat convoluted route, and the results may not be that great. I think if I had a real need for it, I would look at converting SVG or something directly to Gerber, or as direct as the Gerber format allows.

1 Like

The fundamental problem is that gerber files (i.e. designed for photoplotters) are ideally suited to rendering stroked (a.k.a. centreline defined or engraving) fonts.

The main freely available source of such fonts is the set of Hershey fonts from NIST.

These can be installed in Inkscape:

https://www.evilmadscientist.com/2011/hershey-text-an-inkscape-extension-for-engraving-fonts/

The text can be rendered in Inkscape with a given Hershey font

at which point it can be exported as a gEDA PCB format footprint (.fp), with appropriate scaling, using the inkscape2pcb inkscape extension,

which pcbnew’s module editor can import, allowing placement of the footprint on the layout

the inkscape2pcb extension uses Inkscape’s internal svg engine to convert paths to line segments. You may need to ungroup more complex objects and convert them to paths before export. You can get inkscape2pcb from:

Rendering outline defined fonts (i.e. postscript, truetype) in FOSS EDA tools is not as easy, but the Hershey fonts provide a reasonable selection that is easy to use.

3 Likes

Or one can go directly from inkscape to KiCad by use of svg2mod.

1 Like

The inkscape2pcb extension becomes part of the inkscape installation, so there is no intermediate step between exporting and then importing into Kicad’s pcbnew.

svg2mod has it’s own svg parser and can cope with polygons, which the inkscape2pcb extension does not export from inkscape, so svg2mod may be the better option for those seeking to export more complex features.

1 Like

Or save from inskape (or other) as a bitmap and then use the kicad built-in bitmap to component converter.

It’s amazing after only 6 posts we’re exactly back where we started…

Yeah, I was thinking of what we do: instead of a bitmap footprint for each label, we make a custom bitmap footprint of the whole board imported on the silkscreen layer.

I guess that’s what it probably takes, it’s too bad there isn’t an easier way to do this. It would be nice if I could do the design all in one program.

Well this has been discussed it seems. In pcb new the main holdeback is the gerber format. In eeschema it is manpower.
Example bug i found: https://bugs.launchpad.net/kicad/+bug/668145

I recently did this for a PCB-as-Front Panel, and as @Pedro says: laid out the whole of the Front Panel in Inkscape, exactly to scale, using whatever Custom fonts I chose, flowed text round objects etc (to produce numbered scales around dials), then exported the whole front panel as a single high-resolution bitmap (I used 700dpi)

Then, using Bitmap2Component I created one single footprint for the whole of the front panel. By matching the dpi settings, of course this comes into KiCad correctly scaled.

I actually wanted my images to be on the copper layer (rather than the Front Silk Screen), so I edited the resulting .kicad_mod file and did a search and Replace to change all occurrences of F.SilkS to F.Cu

Then, when the footprint is placed in PCBNEW, you only have one alignment to make and all the custom text etc is then immediately and correctly placed on the front panel around the various dials, sockets etc.

It would have been nice to be able to do it all in KiCad, and my libraries are now bloated with Front panel ‘Footprints’ that are only ever applicable to a single project, but the process was pretty straightforward and Inkscape is great for handling the fine control over layout, positioning, flowing & rotating text etc.

Morph

You could use svg2mod to directly get your artwork onto the copper layer.

If a footprint is only applicable to one project you can add a footprint lib to the project directory and also add a project local lib table.

1 Like

Good point - I will try that next time, as it saves a step in the process.

Thank you.

This is more or less what I do, but I have set up a subfolder in each project directory for project specific footprints like this. I found exporting at the max DPI that Bitmap2Component can take (it was over 1000DPI) gave the best sharpness to the conversion, and is visually different in the production silk especially with small text. I output the layout into PDF and then import them into Adobe Illustrator (Inkscape would work) and then work on a separate layer for the silk text. For some layouts, I have kept the references and just annotated the board, and for others, I copied or replaced the references and really did a fully custom silk layout.

1 Like

It will be native only in version 6
http://docs.kicad.org/doxygen/v6_road_map.html
But report your interest in the https://bugs.launchpad.net/kicad (developments / issues / feature requests)

That roadmap calls for system fonts only in eeschema. There is no plan to add system fonts to pcbnew, which is what is being discussed here.

Yes, but I think, even in Pcbnew (a native development) will depend of changes in the format file (dependences listed).
There is a issue (feature request) for this in the launchpad platform. I more people sign the same request, more quick this become native.

It doesn’t work like that, but certainly there is no harm in adding your name to the list.

Getting non-vector fonts to work nicely in Gerber files is far from an easy task, and in KiCad it also means implementing the same functionality for all the other plotters, DXF, PDF, HPGL etc. Generally the silkscreen is only viewed by engineers, so there is a very low priority for improving it.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.