Permalink
Browse files

added new functions to package

  • Loading branch information...
1 parent fffd3f7 commit a06c6f116ff829598ab1663d81962a060221a31c @warweasle warweasle committed Aug 12, 2010
Showing with 29 additions and 1 deletion.
  1. +3 −0 package.lisp
  2. +26 −1 pango.lisp
View
3 package.lisp
@@ -404,4 +404,7 @@
#:LAYOUT-LINE-INDEX-TO-X
#:LAYOUT-LINE-X-TO-INDEX
#:GET-CURSOR-POS
+ #:LIST-FONT-FAMILIES
+ #:LIST-FONT-FAMILY-NAMES
+ #:LIST-FONT-FACES
))
View
27 pango.lisp
@@ -1918,4 +1918,29 @@
(/ (cffi:foreign-slot-value weak 'PangoRectangle 'y) PANGO_SCALE)
(/ (cffi:foreign-slot-value weak 'PangoRectangle 'width) PANGO_SCALE)
(/ (cffi:foreign-slot-value weak 'PangoRectangle 'height) PANGO_SCALE))))))
-
+
+
+(defun list-font-families (&optional (font-map (pango_cairo_font_map_get_default)))
+ (cffi:with-foreign-objects ((c :int)
+ (l :pointer))
+ (pango_font_map_list_families font-map l c)
+ (let ((len (cffi:mem-aref c :int)))
+ (prog1 (loop for i from 0 to (1- len)
+ collect (cffi:mem-aref (cffi:mem-aref l :pointer ) :pointer i))
+ (g_object_unref l)))))
+
+(defun list-font-family-names (&optional (font-map (pango_cairo_font_map_get_default)))
+ (cffi:with-foreign-objects ((c :int)
+ (l :pointer))
+ (pango_font_map_list_families font-map l c)
+ (let ((len (cffi:mem-aref c :int)))
+ (prog1 (loop for i from 0 to (1- len)
+ collect (pango_font_family_get_name (cffi:mem-aref (cffi:mem-aref l :pointer ) :pointer i)))
+ (g_object_unref l)))))
+
+(defun list-font-faces (font-family)
+ (cffi:with-foreign-objects ((l :pointer)
+ (c :int))
+ (pango_font_family_list_faces font-family l c)
+ (loop for i from 0 to (1- (cffi:mem-aref c :int))
+ collect (cffi:mem-aref (cffi:mem-aref l :pointer) :pointer i))))

0 comments on commit a06c6f1

Please sign in to comment.