Gtk2::S...positor(3)
π 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)
π¦Ά Footer font
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)
π Footer format
$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. π
π§Ύ Print footer / header toggles
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)
π’ Print line numbers
integer = $compositor->get_print_line_numbersβ what interval are printed line numbers on?$compositor->set_print_line_numbers ($interval)β set that interval. Set it to0and 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 (-1means 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 (0means 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 Β©οΈ
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
- fedora 43: perl-Gtk2-SourceView2 0.12-18.fc43 Β· GPL-2.0-or-later OR Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms