Note that there are some explanatory texts on larger screens.

plurals
  1. POC++ pango text orientation
    primarykey
    data
    text
    <p>I'm trying to label the y-axis in a plot built using pango.</p> <p>I'm unable to orient the text to run vertically up along the y-axis.</p> <p>Relevant portion of code is:</p> <pre><code> #include &lt;gtkmm.h&gt; Pango::FontDescription font; cr-&gt;save(); // where cr is Glib::RefPtr&lt;Cairo::Context&gt; const &amp; cr-&gt;set_source_rgba(1.0,1.0,1.0,0.5); font.set_family("Monospace"); font.set_style(Pango::STYLE_ITALIC); font.set_weight(Pango::WEIGHT_BOLD); font.set_absolute_size(20); Glib::RefPtr&lt;Pango::Layout&gt; x_axis_label = this-&gt;create_pango_layout("x-axis label"); x_axis_label-&gt;set_font_description(font); cr-&gt;move_to(0.38,0.465); x_axis_label-&gt;show_in_cairo_context(cr); // so far so good, renders as expected // now trying to render the y-axis label Glib::RefPtr&lt;Pango::Context&gt; t_y_axis_label_ctxt = x_axis_label-&gt;get_context(); Pango::Matrix p_matrix; // apply some transformation p_matrix.xx = 0.0; p_matrix.xy = 1.0; p_matrix.yx = 1.0; p_matrix.yy = 0.0; p_matrix.x0 = 0.0; p_matrix.y0 = 0.0; t_y_axis_label_ctxt-&gt;set_matrix(p_matrix); Glib::RefPtr&lt;Pango::Layout&gt; y_axis_label = Pango::Layout::create(t_y_axis_label_ctxt); y_axis_label-&gt;set_text("y-axis label"); // if this line of code is omitted I would expect, at least the text "x-axis label" to be rendered. But this does not happen. y_axis_label-&gt;set_font_description(font); cr-&gt;move_to(0.0,0.0); y_axis_label-&gt;show_in_cairo_context(cr); // renders no output cr-&gt;restore(); </code></pre> <p>I suspect the problem has something to do with context that i retrieve from x-axis label, and the expected copy behaviour is not manifesting.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload