(cond ((color? spec) spec)
((eq? spec 'WHITE) white)
((eq? spec 'BLACK) black)
- ((symbol? spec) (pango-color-parse (symbol-name spec)))
+ ((symbol? spec) (pango-color-parse (symbol->string spec)))
((string? spec) (pango-color-parse spec))
(else
(error:wrong-type-argument spec "a color spec" operator))))
(define (pango-color-parse spec)
- (guarantee-string spec 'pango-color-parse)
+ (guarantee string? spec 'pango-color-parse)
(let ((rgb (malloc (C-sizeof "PangoColor") '|PangoColor|)))
- (if (zero? (C-call "pango_color_parse" rgb spec))
+ (if (zero? (C-call "pango_color_parse" rgb (string->utf8 spec)))
(error:wrong-type-argument spec "a color spec" 'pango-color-parse)
(let ((color (make-color)))
(define (pango-layout-set-text layout text)
(guarantee-pango-layout layout 'pango-layout-set-text)
- (guarantee-string text 'pango-layout-set-text)
- (C-call "pango_layout_set_text" (gobject-alien layout)
- text (string-length text)))
+ (guarantee string? text 'pango-layout-set-text)
+ (let ((text-bv (string->utf8 text)))
+ (C-call "pango_layout_set_text" (gobject-alien layout)
+ text-bv (bytevector-length text-bv))))
(define (pango-layout-set-markup layout markup)
(guarantee-pango-layout layout 'pango-layout-set-markup)
- (guarantee-string markup 'pango-layout-set-markup)
- (C-call "pango_layout_set_markup" (gobject-alien layout)
- markup (string-length markup)))
+ (guarantee string? markup 'pango-layout-set-markup)
+ (let ((markup-bv (string->utf8 markup)))
+ (C-call "pango_layout_set_markup" (gobject-alien layout)
+ markup-bv (bytevector-length markup-bv))))
(define (pango-layout-get-pixel-extents layout receiver)
(guarantee-pango-layout layout 'pango-layout-set-text)
(define (pango-font-description-from-string string)
;; The returned PangoFontDescription is owned by Scheme.
- (guarantee-string string 'pango-font-description-from-string)
+ (guarantee string? string 'pango-font-description-from-string)
(let ((font (make-alien '|PangoFontDescription|))
- (copy (make-alien '|PangoFontDescription|)))
+ (copy (make-alien '|PangoFontDescription|))
+ (string-bv (string->utf8 string)))
(add-glib-cleanup font (make-pango-font-description-cleanup copy))
- (C-call "pango_font_description_from_string" copy string)
+ (C-call "pango_font_description_from_string" copy string-bv)
(copy-alien-address! font copy)
(error-if-null font "Could not create:" font)
font))
(lambda ()
(let ((cstr (make-alien '|char|)))
(C-call "pango_font_description_to_string" cstr font)
- (let ((str (c-peek-cstring cstr)))
+ (let ((str-bv (c-peek-cstring cstr)))
(C-call "g_free" cstr)
- str))))))
+ (utf8->string str-bv)))))))
(define (pango-font-description-copy font)
+ (guarantee-pango-font-description font 'pango-font-description-copy)
(let ((new (make-alien '|PangoFontDescription|))
(copy (make-alien '|PangoFontDescription|)))
(add-glib-cleanup new (make-pango-font-description-cleanup copy))
(define (pango-font-family-get-name PangoFontFamily)
(let ((name (make-alien '(const char))))
(C-call "pango_font_family_get_name" name PangoFontFamily)
- (c-peek-cstring name)))
+ (utf8->string (c-peek-cstring name))))
(define (pango-font-family-is-monospace? PangoFontFamily)
(not (fix:zero? (C-call "pango_font_family_is_monospace" PangoFontFamily))))
(define (pango-font-face-get-name PangoFontFace)
(let ((name (make-alien '(const char))))
(C-call "pango_font_face_get_face_name" name PangoFontFace)
- (c-peek-cstring name)))
\ No newline at end of file
+ (utf8->string (c-peek-cstring name))))
\ No newline at end of file