Pcbnew Silkscreen Font

In Pcbnew
Is it possible to change the silkscreen font?
(for example: Courier New)

It would be great to be able to change the font that Pcbnew generates rather than export bitmaps of text and import them as footprints. A client would like to use this font on all of their designs.

This is some of the history of the PCB font


The bottom line is that Gerber is limited in handling anything except stroke fonts
HPGL is even more restricted

I saw that… I got about half way into it.
Now that you show it - I only read the very last post this time.

To explain in my own words…
A custom FONT-to-GERBER converter would need to be written (in C++?) for each and every font that you wanted to import.

Since last episode… nothing exciting happened.
I’ve tried creating bitmaps with the Courier font using GIMP.
The problem is… when I import the bitmap, Bitmap2Component smooths out all those nice square blocks that Courier uses.

Here’s a screenshot!
https://drive.google.com/file/d/0B76q56HPSUrjSUxiQTZYUjJUYzQ/view
In Pcbnew, you can see the imported bitmap above the regular KeeCad font.

Why!?

Here are my bitmap and .xcf (GIMP) files.
BMP: https://drive.google.com/open?id=0B76q56HPSUrjWUNFS19aYmN1UFU
XCF: https://drive.google.com/open?id=0B76q56HPSUrjV3dHRWtGbUExWlU
Try it yourself!

Someone out there knows exactly why this is happening.
Is it an inherent problem with the Bitmap2Component tool?
Is it a problem with the way I exported my bitmap? (In GIMP, I am working with a canvas size that is 20x10 pixels. This fits a size “10 pt” Courier font exactly. It’s about 7x3.5mm. You would think that since I’m working down to the pixel level, I am at a high enough resolution?)

Bitmap2Comp is desgined for general graphics, and is designed to smooth out pixels because it is assumed you don’t want blockiness.

The graphics primitives don’t give you much to work with, there is polyline which is unfilled and has rounded end caps. With a high enough resolution the rounded ends are hardly noticeable, but if you have too many lines performance can suffer.

I did a test using polylines, is this the sort of thing you are looking for ?

The character height is 5 mm. The rounded line ends are not really visible ( I used 0.1mm lines). In principle a script could be written to convert any text to bitmap and then to a module.

I’d forgotten that you can have a filled polygon in a module, even though it can not be entered through the GUI (I wonder why?). I also remember something about bitmap2component was changed to reduce the number of lines generated.

So that makes the script a bit simpler, I created a bitmap converter in C#. I guess that it could also be done with the Python API, I am still trying to get to grips with that. The proof of principle is there anyway.

The character height here is about 2.5mm.

3 Likes

May I use this great C# script that you’ve created?

I also will need to dive into the Python API in the next month.
If I re-create your script using the Python API, I’ll post it here.

Very impressive.
Can you post a test output file, so users can easily check over time that KiCad does not break this feature.

1 Like

Especially the Gerber plotting function

@bobc, any chance we can get a look at your C# script?

For now…
A manual workaround for custom text is to use the svg2mod Python script.

This works as I just used it.

I know this post is quite old.
Still this an issue on KiCAD 6.0.1 but I think the real issue is on the Gerber format and HPGL so far I read.

Also the picture to footprint converter, is useful but at the same time horrible.
I thought to transform the fonts in SVG image, thennmport on KiCAD.
It’s not accepted.

Then PNG: it works.But the final result is meeeeehhhh …I had to retouch any corner any side of the picture (LOGOs)

Old threads will be closed to save the unsuspecting readers from thinking they are reading up to date discussion from top to down.

KiCad v7 will have support for any system font.

3 Likes