Update of /project/mcclim/cvsroot/mcclim/Doc In directory clnet:/tmp/cvs-serv16855/Doc
Modified Files: mcclim.texi Log Message: Enable support for extended text styles using strings for family and face, as already implemented in CLIM-CLX. Teach Gtkairo do the same.
Add an API for font listing (implemented in CLX and Gtkairo, plus a trivial fallback implementation for other backends) and a font selection dialog as an example.
* Doc/mcclim.texi: New chapter "Fonts and Extended Text Styles" * Examples/font-selector.lisp: New file. * Examples/demodemo.lisp: Added a button for the font selector. * mcclim.asd (CLIM-EXAMPLES): Added font-selector.lisp. * package.lisp (CLIM-EXTENSIONS): Export new symbols font-family font-face port-all-font-families font-family-name font-family-port font-family-all-faces font-face-name font-face-family font-face-all-sizes font-face-scalable-p font-face-text-style.
* medium.lisp (MAKE-TEXT-STYLE, TEXT-STYLE-EQUALP): Allow strings for family and face. (MAKE-TEXT-STYLE-1): New helper function.
* ports.lisp (FONT-FAMILY, FONT-FACE): New classes. (port-all-font-families font-family-name font-family-port font-family-all-faces font-face-name font-face-family font-face-all-sizes font-face-scalable-p font-face-text-style): New generic functions and default methods.
* Backends/CLX/port.lisp (FONT-FAMILIES): New slot in the port. (CLX-FONT-FAMILY, CLX-FONT-FACE): New classes. (port-all-font-families font-family-name font-family-port font-family-all-faces font-face-name font-face-family font-face-all-sizes font-face-scalable-p font-face-text-style): New methods. (SPLIT-FONT-NAME, RELOAD-FONT-TABLE, MAKE-UNFRIEDLY-NAME): New helper functions.
* Backends/gtkairo/pango.lisp (MAKE-FONT-DESCRIPTION): Support strings for family and face. (PANGO-FONT-FAMILY, PANGO-FONT-FACE): New classes. (port-all-font-families font-family-name font-family-port font-family-all-faces font-face-name font-face-family font-face-all-sizes font-face-scalable-p font-face-text-style): New methods. (INVOKE-LISTER, pango-font-family-list-faces, pango-font-face-list-sizes): New helper functions.
* Backends/gtkairo/port.lisp (GLOBAL-PANGO-CONTEXT): New slot in the port. ((INITIALIZE-INSTANCE GTKAIRO-PORT)): Set the pango context.
* Backends/gtkairo/ffi.lisp: regenerated.
--- /project/mcclim/cvsroot/mcclim/Doc/mcclim.texi 2006/12/21 12:22:02 1.3 +++ /project/mcclim/cvsroot/mcclim/Doc/mcclim.texi 2006/12/24 14:27:48 1.4 @@ -96,6 +96,7 @@ * File Selector Gadget:: * PostScript Backend:: * Drei:: +* Fonts and Extended Text Styles::
Utility Programs * Listener:: @@ -1556,12 +1557,12 @@ @chapter PostScript Backend
@menu -* Fonts:: +* Postscript Fonts:: * Additional functions:: @end menu
-@node Fonts -@section Fonts +@node Postscript Fonts +@section Postscript Fonts
Font mapping is a cons, the car of which is the name of the font (FontName field in the AFM file), and the cdr is the size in points. @@ -1580,6 +1581,86 @@
@include drei.texi
+@node Fonts and Extended Text Styles +@chapter Fonts and Extended Text Styles + +@menu +* Extended Text Styles:: +* Listing Fonts:: +@end menu + +@node Extended Text Styles +@section Extended Text Styles + +McCLIM extends the legal values for the @cl{family} and @cl{face} +arguments to @cl{make-text-style} to include strings (in additional to +the portable keyword symbols), as permitted by the CLIM spec, section +11.1. + +Each backend defines its own specific syntax for these family and face +names. + +The CLX backend maps the text style family to the X font's +@emph{foundry} and @emph{family} values, separated by a dash. The +face is mapped to @emph{weight} and @emph{slant} in the same way. For +example, the following form creates a text style for +@emph{-misc-fixed-bold-r-*-*-18-*-*-*-*-*-*-*}: + +@lisp +(make-text-style "misc-fixed" "bold-r" 18) +@end lisp + +In the GTK backend, the text style family and face are used directly +as the Pango font family and face name. Please refer to Pango +documentation for details on the syntax of face names. Example: + +@lisp +(make-text-style "Bitstream Vera Sans" "Bold Oblique" 54) +@end lisp + +@node Listing Fonts +@section Listing Fonts + +McCLIM's font listing functions allow applications to list all +available fonts available on a @class{port} and create text style +instances for them. + +Example: + +@lisp +* (find "Bitstream Vera Sans Mono" + (clim-extensions:port-all-font-families (clim:find-port)) + :key #'clim-extensions:font-family-name + :test #'equal) +#<CLIM-GTKAIRO::PANGO-FONT-FAMILY Bitstream Vera Sans Mono> + +* (clim-extensions:font-family-all-faces *) +(#<CLIM-GTKAIRO::PANGO-FONT-FACE Bitstream Vera Sans Mono, Bold> + #<CLIM-GTKAIRO::PANGO-FONT-FACE Bitstream Vera Sans Mono, Bold Oblique> + #<CLIM-GTKAIRO::PANGO-FONT-FACE Bitstream Vera Sans Mono, Oblique> + #<CLIM-GTKAIRO::PANGO-FONT-FACE Bitstream Vera Sans Mono, Roman>) + +* (clim-extensions:font-face-scalable-p (car *)) +T + +* (clim-extensions:font-face-text-style (car **) 50) +#<CLIM:STANDARD-TEXT-STYLE "Bitstream Vera Sans Mono" "Bold" 50> +@end lisp + +@include class-clim-extensions-font-family.texi +@include class-clim-extensions-font-face.texi + +@include fun-clim-extensions-port-all-font-families.texi + +@include fun-clim-extensions-font-family-name.texi +@include fun-clim-extensions-font-family-port.texi +@include fun-clim-extensions-font-family-all-faces.texi + +@include fun-clim-extensions-font-face-name.texi +@include fun-clim-extensions-font-face-family.texi +@include fun-clim-extensions-font-face-all-sizes.texi +@include fun-clim-extensions-font-face-text-style.texi + @c @node Utility Programs @c @part Utility Programs