Discussion:
[geda-user] 16x16 bdf bitmap -> PCB symbol tool
Erich Heinzle
2014-09-21 16:09:01 UTC
Permalink
I have finished off the code I used to generate Chinese/Japanese/Korean
Firefly bitmap glyphs to pcb symbols

http://users.on.net/~esh/geda/pcb/src/fonts/pcbGlyphTool-v1.0.c

This more polished version of the code fixes a boundary condition affecting
2 or 3 glyphs in the Firefly CJK 16x16 font set with pixels along edges.

The utility compiles easily with gcc and one need only feed it with a bdf
symbol definition or a stream of bdf symbol definitions to produce PCB
symbols for insertion into a PCB layout, with suitable re-labeling to
comply with the current limitations imposed by the implementation of
"Symbol" which only copes with ~ 127 symbols.

i.e.

cat mydesiredglyph.bdf | ./pcbGlyphTool > NewSymbolForPCB.pcb

./pcbGlyphTool -h

will list other options, including -d "dot matrix rendition", -o "omitting"
conversion of diagonals into strokes, -v "verbose" mode, and -x generate an
xbm mode.

It should convert any bdf formatted bitmap up to 16x16 pixels into
SymbolLine strokes replacing contiguous pixels in horizontal, vertical or
diagonal directions, and it will render remaining "orphan pixels" as a dot.

This is the same tool I used to generate the Hebrew font from the Unifont
bdf while testing,

http://users.on.net/~esh/geda/pcb/src/fonts/gEDA-PCB-Unifont-Hebrew.pcb
http://users.on.net/~esh/geda/pcb/src/fonts/UnifontDerivedHebrew_Font

Someone may find the utility or its subroutines useful. One thought is
implementing the ability to do on the fly extraction of a unicode bdf
definition from a bdf font file into a PCB layout from a geda PCB menu or a
button analogous to the "insert text" button. The issue of extending
"Symbol" to support more than the ASCII code page would need to be dealt
with.

I make no claims as to the code's elegance or fitness for purpose...

Cheers

Erich
Peter Stuge
2014-09-21 21:19:01 UTC
Permalink
Post by Erich Heinzle
http://users.on.net/~esh/geda/pcb/src/fonts/pcbGlyphTool-v1.0.c
This more polished version of the code fixes a boundary condition affecting
2 or 3 glyphs in the Firefly CJK 16x16 font set with pixels along edges.
Do you have a screenshot?
Post by Erich Heinzle
I make no claims as to the code's elegance or fitness for purpose...
And even if prettier fonts are where we want to go, it's perhaps
useful for someone to have less pretty versions of the characters
meanwhile.


//Peter
Erich Heinzle
2014-09-21 23:38:00 UTC
Permalink
http://gerblook.org/pcb/Wsyir35rMFisgENKgKhwDK

these are the 27 most complicated CJK glyphs amongst the full 16x16 CJK
glyph set I could find, exported in the gerber shown above.

Here's a representative symbol from the one's depicted, as produced by the
utility:

#gEDA PCB compatible symbol with drawn elements depicting uni6570
Symbol['uni6570' 1200]
(
#the horizontal elements
SymbolLine[1000 4200 6600 4200 800]
SymbolLine[8200 4200 12200 4200 800]
SymbolLine[4200 5000 5000 5000 800]
SymbolLine[7400 5000 8200 5000 800]
SymbolLine[1800 8200 6600 8200 800]
SymbolLine[3400 10600 5800 10600 800]
SymbolLine[10600 10600 11400 10600 800]
SymbolLine[11400 11400 12200 11400 800]
SymbolLine[1800 12200 3400 12200 800]
SymbolLine[12200 12200 13000 12200 800]
#the vertical elements
SymbolLine[2600 1800 2600 2600 800]
SymbolLine[2600 4200 2600 5000 800]
SymbolLine[3400 8200 3400 9000 800]
SymbolLine[4200 1000 4200 5800 800]
SymbolLine[4200 7400 4200 8200 800]
SymbolLine[4200 10600 4200 11400 800]
SymbolLine[5000 4200 5000 5000 800]
SymbolLine[5000 9800 5000 10600 800]
SymbolLine[5800 8200 5800 9000 800]
SymbolLine[6600 1000 6600 1800 800]
SymbolLine[8200 1000 8200 8200 800]
SymbolLine[10600 4200 10600 9000 800]
SymbolLine[11400 3400 11400 4200 800]
SymbolLine[11400 10600 11400 11400 800]
SymbolLine[12200 11400 12200 12200 800]
#diagonal elements, strokes going downwards and leftwards
SymbolLine[2600 5000 1000 6600 800]
SymbolLine[6600 1800 5800 2600 800]
SymbolLine[5000 5000 4200 5800 800]
SymbolLine[3400 9000 2600 9800 800]
SymbolLine[6600 8200 5000 9800 800]
SymbolLine[4200 11400 3400 12200 800]
SymbolLine[10600 9000 7400 12200 800]
#diagonal elements, strokes going downwards and rightwards
SymbolLine[2600 9800 4200 11400 800]
SymbolLine[5000 9800 7400 12200 800]
SymbolLine[4200 4200 6600 6600 800]
SymbolLine[8200 8200 12200 12200 800]
SymbolLine[1800 1000 2600 1800 800]
SymbolLine[11400 10600 13000 12200 800]
SymbolLine[6600 4200 7400 5000 800]
SymbolLine[11400 3400 12200 4200 800]
) #end symbol 'uni6570'



The comments get stripped by pcb when the symbol is first used.


Cheers,

Erich
Post by Erich Heinzle
Post by Erich Heinzle
http://users.on.net/~esh/geda/pcb/src/fonts/pcbGlyphTool-v1.0.c
This more polished version of the code fixes a boundary condition
affecting
Post by Erich Heinzle
2 or 3 glyphs in the Firefly CJK 16x16 font set with pixels along edges.
Do you have a screenshot?
Post by Erich Heinzle
I make no claims as to the code's elegance or fitness for purpose...
And even if prettier fonts are where we want to go, it's perhaps
useful for someone to have less pretty versions of the characters
meanwhile.
//Peter
Loading...