← Back to team overview

kicad-developers team mailing list archive

Re: [Bug 668145] Re: Font preferences not available anymore, internal font changed

 

On Fri, 29 Oct 2010, Brian Bidulock wrote:

You have a shp to kicad converter?  Is it posted anywhere?

Done it for converting the ISO font. It's not posted because 1) it
somewhat hackish (and not every SHP opcode is handled) and 2) scaling is
hardcoded; I have no issues on publishing it, anyway. It's less than 500
C lines:P

You could modify it to generate CXF, it shouldn't be difficult.

I don't really care about it.  The ttf2cxf makes a CXF outline file from
the TTF font.  If kicad is made to load CXF, TTF outlines come for free.
ttx2cxf uses Freetype and is simple.  Making the program generate
reasonable center-lines instead of outline might not be impossible.

Really hard, I think...

Simply because the program currently imposes a subjective limit.

There *is* a limit? or are you talking about the stroke limit?

This will be the default for EESCHEMA.  (3) The NewStroke font.  This is
simply for those that became attached to it during its brief debut.  (4)
The QCad "iso" font.  This is for Lorenzo.

I already have mine, thanks:D I also have a full Technical Set
1 repertoir done (containing such useful symbols like the AC/DC markings
and so on).

Is there something stopping you from contributing this to KiCad?

Only that its metric and aspect ratio are mismatched for kicad hersheys
fonts... I've done it as a companion for the ISO (actually technical
greek is from ISO with some hand tweeking).

I also requisitioned the \ key as an escape code for it (it has an
unicode mapping but it's *really* awkward). It's all handled in the
drawtxt source.

If the images are laid out with the "standard" font, then the results
should be fine.

Then just emit a text dxf primitive, it's easy (but *no* unicode, if you
want to be portable).

I think that off-line conversion is better.  There is no need to add
another library dependency for performing a function that is better
performed off-line.  ttf2cxf used the Freetype libary to perform its
functions.

OK, my proposal: get kicad loading CXFs so you could load qcad and ttf
converted fonts (if you like them:P). Hersheys are trivial to convert to
CXF and we could modify/enhance the SHP converter to create CXF, too. So
with a single loader/renderer you'd use CXF, SHP, TTF and Hershey fonts.
I'd call it a win/win/win/win situation XD

Plotting to copper and silk (PCBNEW) is one thing.  That is where the
old modified Hershey's font and the NewStroke font (and maybe your ISO
font if you will contribute it) come in.

No problem to contribute it but I'm not sure about the licensing of the
ISO *shapes*...

But then there is plotting schematics.  EESCHEMA plots can use all kinds
of wild and fancy fonts.  There is no restriction on size here (just
zoom in).  Using actual TTF fonts in PS output would be just fine.

Even if you junk HPGL (I'd have nothing against but it's still uses for
inclusion by a lot of people), uploading, CID reencoding and using
a type42 (the PS format for truetypes) is anything but easy... of
course if you do it I'd be very happy to see it.

I found that the metrics needed for such a job are:
- Vertical height
- Ascend/baseline
- Average width (the en-spacing)
- Maximum stroke size for standard and bold text.

All of these in the 'font' coordinate set. For example the maximum
stroke width for the ISO font is 1/14 and 1/10, while for the newstroke
is 1/4, IIRC. From my notes in the iso sources:

/* Hershey metrics: hor: -6...6, advance: -10..10
    Ceiling: -16
    X-height: -12
    x-height: -5
    Baseline: 9
    Descender: 16
    */
/* ISO metrics:
    Ceiling: -44
    X-height: -28
    x-height: -16
    Baseline: 10
    Descender: 20
    */

The ISO font is bigger to better exploit the available range (hershey coding is
restricted to integers point between -49 and 49); if you reimplement the font
machinery with CXF this limitation would disappear (because CXF is floating
point), but at least some of these metrics should be handled (I have to check
the diff on my branch but IIRC there was something about label plotting that
needed to be adjusted). How do CXF handle metrics?

--
Lorenzo Marcantonio
Logos Srl