From: Greg Menke
Subject: Printing in Lispworks CAPI
Date: 
Message-ID: <m3veqmfoiu.fsf@athena.pienet>
I'm writing a capi app in Lispworks 4.3 on x86 Linux, the program is
about done except for printing.  The desire is to iterate over the text
items in a listbox, printing them with variable size fonts and a page
header.  I have the postscript .ppd stuff set up and test page prints.
A snippet of my code follows;

=================================================================

(defparameter +TIMESTAMP-TEXT-FONT+      (make-font-description :size 10))
(defparameter +CATEGORY-TEXT-FONT+       (make-font-description :size 10))
(defparameter +FOODLIST-TEXT-FONT+       (make-font-description :size 10))


(defun print-grocerylist (intf)
  
  (let ((ptrsel  (print-dialog :owner intf :print-selection-p nil :print-copies-p nil :print-pages-p nil)))

    (when ptrsel

      (let ((glist-vector   (collection-items     (gm-grocerylist-panel intf))) )

        (with-print-job (gport :jobname "GroceryMaster" :printer ptrsel)
      
          (loop with eindex = 0
                with pageheight = (printer-metrics-dpi-y (get-printer-metrics ptrsel))
                with tstamp = (list (multiple-value-bind (sec min hour day month year) (get-decoded-time)
                                      (format nil "Grocery Master - ~D/~2,'0D/~2,'0D ~D:~2,'0D:~2,'0D"
                                              month day year hour min sec )))
                with txt = ""
                with lineno = 1
                with fdesc-timestamp = (find-best-font gport +TIMESTAMP-TEXT-FONT+ )
                with fdesc-category  = (find-best-font gport +CATEGORY-TEXT-FONT+ )
                with fdesc-foodlist  = (find-best-font gport +FOODLIST-TEXT-FONT+ )
              
                for pageno from 1
                for cx = 0
                for cy = 0
                while (< eindex (length glist-vector))
                do

=================================================================

The error arises in the find-best-font call, error text is below sans the
long list of fonts which follows the error itself;

No applicable methods for #<standard-generic-function
graphics-ports::%find-matching-fonts 20CEBB6A> with
args (#S(capi-postscript-library::postscript-printer-description
capi-postscript-library::keywords #<equal Hash Table{45} 215A7524> 
capi-postscript-library::code #<equal Hash Table{65} 215A7644>
capi-postscript-library::order #<equal Hash Table{8} 215A7764> 
capi-postscript-library::ui-elements
(("*Smoothing" :boolean "True" "Resolution Enhancement" # #)  .....


find-best-font works when applied to a regular ouput-pane.  The
Lispworks docs suggest with-print-job generates a pane that the drawing
primitives will work against but it seems as if thats not happening
since find-best-font doesn't have a suitable specialization.  I've
looked at the LW printing examples, they all show drawing but nothing
related to fonts.  Perhaps I'm approaching this the wrong way...  any
hints about how to proceed or what might be wrong are much appreciated,
thanks.

Gregm


  

From: ··········@eudoramail.com
Subject: Re: Printing in Lispworks CAPI
Date: 
Message-ID: <1151456995.648527.193710@j72g2000cwa.googlegroups.com>
Greg Menke wrote:
> I'm writing a capi app in Lispworks 4.3 on x86 Linux, the program is
> about done except for printing.  The desire is to iterate over the text
>

Have you tried running the application with LispWorks 4.4 Linux to make
sure that it isn't a bug?  (Sorry I don't have a solution -- these sort
of problems are the worst).

Rand
(please don't email me, I'm running a spam experiment)
From: ··········@eudoramail.com
Subject: Re: Printing in Lispworks CAPI
Date: 
Message-ID: <1151457523.165787.7470@b68g2000cwa.googlegroups.com>
Greg,

What happens if you use :stock :system-font in the fdesc description?
Have you tried using the :pane keyword in the with-print-job macro?

Rand
(please don't email me, I'm running a spam experiment)
From: Greg Menke
Subject: Re: Printing in Lispworks CAPI
Date: 
Message-ID: <m3bqsehug1.fsf@athena.pienet>
··········@eudoramail.com writes:
> Greg,
> 
> What happens if you use :stock :system-font in the fdesc description?
> Have you tried using the :pane keyword in the with-print-job macro?

:stock parameters don't change the error.  Adding :pane referring to an
:output pane fixes the error but no output is evident.  This is the
:latest test I've been working with so there could be other bugs at
:work.  Printer metrics seem to produce useful values, this bug seems
:fundamentally related to fonts on printer-associated output ports.

Thanks,

Greg
From: ··········@eudoramail.com
Subject: Re: Printing in Lispworks CAPI
Date: 
Message-ID: <1151471364.901467.19780@75g2000cwc.googlegroups.com>
Greg,

Do you think that it's not drawing because :foreground in the font
description is set to :white because of :black?

Have you tried using the (capi:get-page-area ...) and
(capi:with-page-transform ...) combination that is used in the
examples/capi/printing/page-on-demand.lisp directory? (I mention this
as I think the way you calculate page height could be off).

If you're still stuck, you should post to lisp-hug -- ystok may know
what to do.


Rand
(please don't email me, I'm running a spam experiment)