← Back to team overview

kicad-developers team mailing list archive

Searchable PDF and native PS fonts

 

OK, persuaded the PDF engine to show stuff using a builtin font. Even
got the font metrics of the Helvetica family in kicad.

Results are exactly as I imagined...

- In attachment pdf-hidden-font.pdf you can see text drawn as usual
  (using paths) with the same text drawn in render mode 3 (i.e.
  invisible) with the Helvetica fonts.

  You have wysiwyg with eeschema *and* you can search for text (because
  the hidden text is present); even the highlight box is more or less
  good (plausible and identifiable, at less, compared with the 1-dot
  text hack in the postscript engine)

- In attachment pdf-native-font.pdf you can see under the hood what's is
  happening... I excluded path text and used rendermode 1 (i.e. the
  postscript show operator). As you can see the text is aligned
  correctly but since metrics are different (Helvetica is bigger than
  the iso font) it goes out of the box (BTW I fixed the dashing
  operation). I don't remember the metrics of the stock kicad font but
  probably you can fudge the scaling to better match Helvetica to it...

  This could also double as a 'plot using postscript fonts' example. So
  the downsides are that: text is different (both in face and in size)
  and repertoire is limited (more or less to Latin-1)

I'd keep only the 'hidden text' for search... is someone interested in
native postscript fonts? As I could see the only upside is that the pdf
is a lot smaller and probably render faster (since it's using Type1
fonts instead of path stroking).

Let's discuss about how to proceed...

Multipage PDF is next in the pipeline... Postscript would be doable too, but what
about changing paper size? there is the PageBoundingBox comment but then
the main BoundingBox would be set to the union of all the pages (and
anyway I don't know of *anything* that would handle properly this
situation). PDF page size is simpler to do (each Page object has its own
MediaBox) but you need to handle multiple streams and the page catalog.

I'd say to keep the ps engine single page (like the HPGL), so it could
be used for eps embedding and other stuff (like my pcb composition
script); PDF would handle multipage instead without problem... given
that many people use ps only for distilling the ps engine would be
'downgraded' to an export format like HPGL. Does it sound good as
a plan?

-- 
Lorenzo Marcantonio
Logos Srl

Attachment: pdf-native-font.pdf
Description: Adobe PDF document

Attachment: pdf-hidden-font.pdf
Description: Adobe PDF document


Follow ups