[mcclim-devel] device font text styles
Christophe Rhodes
csr21 at cam.ac.uk
Wed Mar 8 18:05:39 UTC 2006
Hi,
I attach a patch for discussion and review, reworking the support for
device fonts; in particular, one can do things like
(with-text-style (s (make-device-font-text-style port
(make-postscript-device-font-name
:font-file "Dingbats.pfb"
:metrics-file "Dingbats.afm"
:size 14)))
(write-line "Hello, World!" s))
We use this patch to draw lute tablature, using home-designed fonts
for the tab glyphs, in both TrueType and Postscript formats (TrueType
for display, Postscript for printing).
I don't know whether this patch breaks the ordinary CLX backend's
support for device fonts; is anyone in a position to test this? I
also suspect that there are bits and pieces of the postscript code
which are not entirely right, though I can say that
Examples/postscript-test.lisp seems to be about right.
This bit of CLIM is almost completely unspecified; all that we know
about MAKE-DEVICE-FONT-TEXT-STYLE is that it takes a port and a "font
name" and returns some kind of TEXT-STYLE object. The reasoning I've
applied in this implementation is that since device-font-text-styles
are defined not to merge (in the MERGE-TEXT-STYLE sense) with any
other text style, a device-font-text-style-name needs to have all the
information required to identify uniquely a font that we can use in
the backend. Under X, calling this a "name" makes a certain amount of
sense, because X fonts are in fact uniquely identified by their X
name: something like "-adobe-courier-medium-r-normal-and-so-on-". I
don't think this is true for any other backend :-) so I think it's
reasonable to define names as structures, rather than attempting to
parse some ad-hoc string representation.
I also don't want to present this patch as a final interface; it is
fairly ugly to have to specify the port type when making a name.
Ultimately, we may want to move back to string names: something like
(define-font "Varietie3"
:freetype (:font-file "fonts/Varietie3.ttf" :size 14)
:postscript (:font-file "fonts/Varietie3.pfa"
:metrics-file "fonts/Varietie3.afm"
:size 12))
but I certainly think that designing something like that is out of
scope in the next three weeks...
Anyway, with all that, the patch (which is by far the majority of my
diff with HEAD) attached.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: device-font-text-style.diff
URL: <https://mailman.common-lisp.net/pipermail/mcclim-devel/attachments/20060308/8d95766d/attachment.ksh>
-------------- next part --------------
Cheers,
Christophe
More information about the mcclim-devel
mailing list