Giter VIP home page Giter VIP logo

pangocairo's Introduction

pangocairo's People

Contributors

dns2utf8 avatar dvhaeren avatar epashkin avatar guillaumegomez avatar sdroege avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

pangocairo's Issues

show_layout produces a pango error: "pango_font_description_set_size: assertion 'size >= 0' failed"

Pangocairo show_layout function gives the following error during runtime:
Pango-CRITICAL **: 18:11:02.823: pango_font_description_set_size: assertion 'size >= 0' failed

Code used:

...
let (width, height) = (1000, 1000);
let surface = ImageSurface::create(Format::ARgb32, width, height).expect("Can't create surface");
let cr = Context::new(&surface);

let mut fontdescription = pango::FontDescription::from_string("Sans");
fontdescription.set_size(16 * pango::SCALE);
let pangolayout = pangocairo::functions::create_layout(&cr).unwrap();
pangolayout.set_font_description(Some(&fontdescription));
pangolayout.set_text("the quick brown fox jumps over the lazy dog");

pangocairo::functions::show_layout(&cr, &pangolayout);

The exact C equivalent that does not produce the error:

...
PangoLayout *layout;
PangoFontDescription *desc;
layout = pango_cairo_create_layout (cr);
desc = pango_font_description_from_string ("Sans");
pango_font_description_set_size(desc, 16 * PANGO_SCALE);
pango_layout_set_font_description (layout, desc);
pango_layout_set_text(layout, "the quick brown fox jumps over the lazy dog", -1);
pango_font_description_free(desc);

pango_cairo_show_layout(cr, layout);

Allow clearing default font_map

I might just be doing this wrong, but I would like to clear the default font_map so that it can be reimported next time it is needed and pick up any new fonts that have been added. I see that I can set a new font_map with set_default, but it expects a font_map reference as input. See here:

https://github.com/gtk-rs/pangocairo/blob/master/src/auto/font_map.rs#L42

I'm new to rust, so I might be missing some way of getting it to work with the current code by casting ptr.null_mut() to a font_map. Seems very un-rusty. Would it be possible to allow this? Either by modifying set_default, or, maybe better, by adding a clear_default() method.

Global functions not thread-safe

I didn't check what exactly the problem is but calling pangocairo::FontMap::get_default() from multiple threads at once seems to sometimes cause interesting crashes, probably due to initialization (maybe even one-time initialization) inside pangocairo not being thread-safe.

I don't know if the same applies to functions of pango itself too.

Just filing this now so I don't forget, it's a known problem with pango/pangocairo but I don't have the time to collect the details now.

Breaking changes in 0.2.1

error[E0432]: unresolved import `pangocairo::CairoContextExt`
error[E0432]: unresolved import `pangocairo::PangoContextExt`
error[E0599]: no method named `create_pango_context` found for type `&cairo::Context` in the current scope
error[E0599]: no method named `update_pango_context` found for type `&cairo::Context` in the current scope
error[E0599]: no method named `update_pango_layout` found for type `&cairo::Context` in the current scope
error[E0599]: no method named `show_pango_layout` found for type `&cairo::Context` in the current scope
error[E0599]: no method named `pango_layout_path` found for type `&cairo::Context` in the current scope

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.