bradwbeer / cl-pango Goto Github PK
View Code? Open in Web Editor NEWCFFI Bindings for Common Lisp
Home Page: http://lisp-qix.blogspot.com/
License: MIT License
CFFI Bindings for Common Lisp
Home Page: http://lisp-qix.blogspot.com/
License: MIT License
get-size-for-markup
was exported here:
https://github.com/BradWBeer/cl-pango/blob/master/package.lisp#L15
But there's no evidence showing it's implementation, is it?
Platform: Windows 10 Pro 20H2 64-bit
Library: mingw64/mingw-w64-x86_64-pango 1.50.3-1
installed via MSYS2:
pacman -S mingw-w64-x86_64-pango
Sample code to reproduce:
(ql:quickload 'cl-pango)
;; the code below is for `cl-pango:g_object_unref`
(cffi:define-foreign-library :libgobject
(cffi-features:windows "libgobject-2.0-0.dll"))
(cffi:load-foreign-library :libgobject)
(let* ((cairo-surface (cairo:create-image-surface :argb32 240 80))
(cairo-context (cairo:create-context cairo-surface))
(pango-layout (cl-pango:pango_cairo_create_layout
(slot-value cairo-context 'cairo:pointer))))
;; (cl-pango:pango_layout_set_text pango-layout "Hello, Pango Markup" -1)
(cl-pango:pango_layout_set_markup pango-layout "Hello, Pango Markup" -1)
(cairo:set-source-rgb 0 1 1 cairo-context)
(cairo:move-to 10 50 cairo-context)
(cl-pango:pango_cairo_show_layout (slot-value cairo-context 'cairo:pointer) pango-layout)
(cl-pango:g_object_unref pango-layout)
(cairo:destroy cairo-context)
(cairo:surface-write-to-png cairo-surface "hello-pango.png")
(cairo:destroy cairo-surface))
(quit)
The code above will run successfully under recent macOS and Linux, but on Windows 10, it will generate the following output:
$ sbcl --load hello-pango.lisp
This is SBCL 2.2.0, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
To load "cl-pango":
Load 1 ASDF system:
cl-pango
; Loading "cl-pango"
........
(process:2720): GLib-GObject-WARNING **: 09:15:43.571: cannot register existing type 'PangoLayout'
(process:2720): GLib-CRITICAL **: 09:15:43.571: g_once_init_leave: assertion 'result != 0' failed
(process:2720): Pango-CRITICAL **: 09:15:43.571: pango_layout_set_markup_with_accel: assertion 'PANGO_IS_LAYOUT (layout)' failed
Here is the generated image (seems to be blank):
But in the mean time, the C equivalent code works fine:
/*
* compile:
* gcc -o hello-pango-markup hello-pango-markup.c $(pkg-config --cflags --libs pangocairo)
*/
#include <pango/pangocairo.h>
PangoLayout *layout;
PangoFontDescription *font_description;
int main (int argc, char *argv[])
{
cairo_surface_t *surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, 240, 80);
cairo_t *cr = cairo_create (surface);
layout = pango_cairo_create_layout (cr);
pango_layout_set_markup (layout, "Hello, world", -1);
cairo_set_source_rgb (cr, 0.0, 1.0, 1.0);
cairo_move_to (cr, 10.0, 50.0);
pango_cairo_show_layout (cr, layout);
g_object_unref (layout);
cairo_destroy (cr);
cairo_surface_write_to_png (surface, "hello-pango.png");
cairo_surface_destroy (surface);
return 0;
}
So I suppose there might be something wired between Lisp and Pango C interface, maybe it's GObject related.
--
I know this may not have anything related to the cl-pango
library, but I really can't find any clue to this problem, so I post this here and hope for any suggestions.
Thank you for your creation, cl-pango
is very easy to use.
When I clone your CL-pango git repository, I don't by default
see the master branch. Instead, I get gh-pages.
This may also affect what web surfers see. I don't think the
master branch README files shows up, for instance.
bob
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.