Logo Search packages:      
Sourcecode: paps version File versions

gchar* paps_layout_to_postscript_strdup ( paps_t *  paps,
double  pos_x,
double  pos_y,
PangoLayout *  layout 
)

Create postscript related to a PangoLayout at position pos_x, pos_y (postscript coordinates). The related font definitions are stored internally and will be returned when doing paps_get_postscript_header_strdup.

Parameters:
paps Paps object
pos_x x-position
pos_y y-position
layout Layout to render
Returns:

Definition at line 187 of file libpaps.c.

{
  paps_private_t *paps = (paps_private_t*)paps_;
  GString *layout_str = g_string_new("");
  gchar *ret_str;
  int para_num_lines, line_idx;
  double scale = 72.0 / PANGO_SCALE  / PAPS_DPI;

  para_num_lines = pango_layout_get_line_count(layout);

  for (line_idx=0; line_idx<para_num_lines; line_idx++)
    {
      PangoRectangle logical_rect, ink_rect;
      PangoLayoutLine *pango_line = pango_layout_get_line(layout, line_idx);

      pango_layout_line_get_extents(pango_line,
                            &ink_rect, &logical_rect);

      
      add_line_to_postscript(paps,
                       layout_str,
                       pos_x,
                       pos_y,
                       pango_line);

      pos_y -= logical_rect.height * scale;
    }

  ret_str = layout_str->str;
  g_string_free(layout_str, FALSE);

  return ret_str;
}


Generated by  Doxygen 1.6.0   Back to index