Gtk2::S...positor(3)

πŸ“¦
version 0.12 Β· 2 versions
, in fedora 43

πŸ’– NAME πŸ’–

Gtk2::SourceView2::PrintCompositor β€” bestie, this is the little icon that takes your GtkSourceBuffer and turns it into actual printed pages. Fr fr, it's your glow-up machine for paper. πŸ–¨οΈβœ¨

(It lives in the User Contributed Perl Documentation, which is giving very much "the cool older sibling of the docs folder." 🫢)


🌸 HIERARCHY 🌸

Okay so family tree time, and the lineage is giving main character:

Glib::Object
+----Gtk2::SourceView2::PrintCompositor

Your compositor is a Glib::Object at heart. Periodt. πŸ’…


✨ METHODS ✨

πŸŽ€ Constructors (how you make one)

  • printcompositor = Gtk2::SourceView2::PrintCompositor->new ($buffer) β€” spin up a brand new compositor straight from a buffer. Yes, you gotta hand it a buffer, no buffer no compositor, that's the vibe check.
    • $buffer (Gtk2::SourceView2::Buffer)
  • printcompositor = Gtk2::SourceView2::PrintCompositor->new_from_view ($view) β€” same energy, but you're building it from a view instead. Pick your fighter. πŸ¦‹
    • $view (Gtk2::SourceView2::View)

πŸ–‹οΈ Body font (the actual text, the moment)

  • string = $compositor->get_body_font_name β€” tells you what font the body text is currently serving.
  • $compositor->set_body_font_name ($font_name) β€” sets it. Slay.
    • $font_name (string)

πŸ“ Bottom margin

  • double = $compositor->get_bottom_margin ($unit) β€” how much space is chillin' at the bottom, measured in whatever unit you ask for.
    • $unit (Gtk2::Unit)
  • $compositor->set_bottom_margin ($margin, $unit) β€” set the bottom breathing room. Two args, no drama.
    • $margin (double)
    • $unit (Gtk2::Unit)

🧺 Buffer

  • buffer = $compositor->get_buffer β€” hands you back the buffer this compositor is printing. No args, just vibes. πŸ“

πŸ–¨οΈ Drawing pages

  • $compositor->draw_page ($context, $page_nr) β€” literally draws one page. Give it the print context and which page number you want.
    • $context (Gtk2::PrintContext)
    • $page_nr (integer)

  • string = $compositor->get_footer_font_name β€” what font is the page footer rocking?
  • $compositor->set_footer_font_name ($font_name) β€” set the footer font. Heads up: this one takes a string or undef, so undef is a valid mood here.
    • $font_name (string or undef)

  • $compositor->set_footer_format ($separator, $left, $center, $right) β€” lays out your footer into left / center / right slots. Very "three-part harmony."
    • $separator (boolean)
    • $left (string or undef)
    • $center (string or undef)
    • $right (string or undef)

πŸ‘‘ Header font

  • string = $compositor->get_header_font_name β€” the header's font situation, revealed.
  • $compositor->set_header_font_name ($font_name) β€” set it. Again: string or undef, undef is allowed, she's flexible.
    • $font_name (string or undef)

πŸ’… Header format

  • $compositor->set_header_format ($separator, $left, $center, $right) β€” same three-slot layout energy, but for the header up top.
    • $separator (boolean)
    • $left (string or undef)
    • $center (string or undef)
    • $right (string or undef)

🌈 Syntax highlighting

  • boolean = $compositor->get_highlight_syntax β€” is the syntax highlighting turned on? yes/no bestie.
  • $compositor->set_highlight_syntax ($highlight) β€” flip it on or off.
    • $highlight (boolean)

πŸ“ Left margin

  • double = $compositor->get_left_margin ($unit) β€” the left-side gap, in your chosen unit.
    • $unit (Gtk2::Unit)
  • $compositor->set_left_margin ($margin, $unit) β€” set that left gap.
    • $margin (double)
    • $unit (Gtk2::Unit)

πŸ”’ Line numbers font

  • string = $compositor->get_line_numbers_font_name β€” what font are the line numbers using?
  • $compositor->set_line_numbers_font_name ($font_name) β€” set it. Yep, string or undef again.
    • $font_name (string or undef)

πŸ“„ Pages & pagination

  • integer = $compositor->get_n_pages β€” how many pages we talkin'?
  • boolean = $compositor->paginate ($context) β€” do the whole pagination thing. Give it a print context, get back a boolean.
    • $context (Gtk2::PrintContext)
  • double = $compositor->get_pagination_progress β€” how far along the pagination is. It's giving progress bar. πŸ“Š

  • boolean = $compositor->get_print_footer β€” is the footer even printing?
  • $compositor->set_print_footer ($print) β€” turn the footer printing on or off.
    • $print (boolean)
  • boolean = $compositor->get_print_header β€” is the header printing?
  • $compositor->set_print_header ($print) β€” toggle the header printing.
    • $print (boolean)

  • integer = $compositor->get_print_line_numbers β€” what interval are printed line numbers on?
  • $compositor->set_print_line_numbers ($interval) β€” set that interval. Set it to 0 and you get no numbers at all, iconic minimalism.
    • $interval (integer)

πŸ“ Right margin

  • double = $compositor->get_right_margin ($unit) β€” right-side gap, your unit of choice.
    • $unit (Gtk2::Unit)
  • $compositor->set_right_margin ($margin, $unit) β€” set the right gap.
    • $margin (double)
    • $unit (Gtk2::Unit)

βš™οΈ Tab width

  • integer = $compositor->get_tab_width β€” how wide a tab is.
  • $compositor->set_tab_width ($width) β€” set how wide a tab is.
    • $width (integer)

πŸ“ Top margin

  • double = $compositor->get_top_margin ($unit) β€” top gap, in your unit.
    • $unit (Gtk2::Unit)
  • $compositor->set_top_margin ($margin, $unit) β€” set the top gap.
    • $margin (double)
    • $unit (Gtk2::Unit)

πŸŒ€ Wrap mode

  • wrapmode = $compositor->get_wrap_mode β€” how are lines wrapping right now?
  • $compositor->set_wrap_mode ($wrap_mode) β€” set the wrapping behaviour.
    • $wrap_mode (Gtk2::WrapMode)

πŸ’œ PROPERTIES πŸ’œ

  • 'body-font-name' (string : default undef : readable / writable) β€” Name of the font to use for the text body (e.g. "Monospace 10")
  • 'buffer' (Gtk2::SourceView2::Buffer : default undef : readable / writable / construct-only) β€” The GtkSourceBuffer object to print. Note the construct-only tag, so this one's set at construction time, no take-backsies.
  • 'footer-font-name' (string : default undef : readable / writable) β€” Name of the font to use for the page footer (e.g. "Monospace 10")
  • 'header-font-name' (string : default undef : readable / writable) β€” Name of the font to use for the page header (e.g. "Monospace 10")
  • 'highlight-syntax' (boolean : default true : readable / writable) β€” Whether to print the document with highlighted syntax. Default is true, because obviously. ✨
  • 'line-numbers-font-name' (string : default undef : readable / writable) β€” Name of the font to use for the line numbers (e.g. "Monospace 10")
  • 'n-pages' (integer : default -1 : readable) β€” The number of pages in the document (-1 means the document has not been completely paginated). Read-only, she observes, she does not participate.
  • 'print-footer' (boolean : default false : readable / writable) β€” Whether to print a footer in each page
  • 'print-header' (boolean : default false : readable / writable) β€” Whether to print a header in each page
  • 'print-line-numbers' (Glib::UInt : default 1 : readable / writable) β€” Interval of printed line numbers (0 means no numbers)
  • 'tab-width' (Glib::UInt : default 8 : readable / writable) β€” Width of a tab character expressed in spaces
  • 'wrap-mode' (Gtk2::WrapMode : default "none" : readable / writable) β€” Whether to wrap lines never, at word boundaries, or at character boundaries.

πŸ¦‹ ENUMS AND FLAGS πŸ¦‹

enum Gtk2::Unit

  • 'pixel' / GTK_UNIT_PIXEL
  • 'points' / GTK_UNIT_POINTS
  • 'inch' / GTK_UNIT_INCH
  • 'mm' / GTK_UNIT_MM

enum Gtk2::WrapMode

  • 'none' / GTK_WRAP_NONE
  • 'char' / GTK_WRAP_CHAR
  • 'word' / GTK_WRAP_WORD
  • 'word-char' / GTK_WRAP_WORD_CHAR

πŸ‘€ SEE ALSO πŸ‘€

  • Gtk2::SourceView2
  • Glib::Object

Go read those next bestie, they're literally the rest of the lore. πŸ“š


Copyright (C) 2009 by Emmanuel Rodriguez


and that's the whole page, mwah πŸ’‹ This was documented as part of the User Contributed Perl Documentation, written by the lovely perl v5.42.0, dated 2025-07-25. Go print something gorgeous, you absolute legend. πŸŽ€πŸ’–πŸ¦‹βœ¨

πŸ“¦ where this page comes from