pub struct Printer {Show 17 fields
pub selector: Selector,
pub term_offset: usize,
pub term_just_wrapped: bool,
pub file_offset: usize,
pub max_print_line: usize,
pub log_slack: usize,
pub term_quiet: bool,
pub quiet_line: Vec<u8>,
pub capture: Option<Vec<u8>>,
pub error_line: usize,
pub half_error_line: usize,
pub tally: usize,
pub trick_buf: Vec<Vec<u8>>,
pub trick_count: usize,
pub first_count: usize,
pub cur_string: Vec<u8>,
pub new_line_char: i32,
/* private fields */
}Expand description
The printer state.
Fields§
§selector: SelectorCurrent destination.
term_offset: usizeCharacters on the current terminal line.
term_just_wrapped: boolWhether the last terminal output was an automatic line break at
max_print_line.
file_offset: usizeCharacters on the current log line.
max_print_line: usizeMaximum line length for terminal and log.
log_slack: usizeExtra characters allowed on a log line. LuaTeX lets text printed
from Lua (texio) and its own warnings run one character past
max_print_line in the log, but not on the terminal.
term_quiet: boolDefault output mode: nothing is written to the terminal, but line positions are tracked as if it were, so the log is unchanged.
quiet_line: Vec<u8>While the terminal is quiet: the text of its current line (a
prompt such as Enter file name: ), shown when the terminal is read.
capture: Option<Vec<u8>>While Some, the text printed to the terminal or log is also
collected here (used to turn error messages into diagnostics).
error_line: usizeWidth of error context lines.
half_error_line: usizeWidth of the first half of an error context line.
tally: usizeCharacters printed so far in the current pseudo-print or other
counted operation (TeX’s tally).
trick_buf: Vec<Vec<u8>>Buffer for pseudo printing: one entry per counted position, a byte or the bytes of an invalid input byte shown with its successors.
trick_count: usizeLimit of pseudo-printed characters to keep.
first_count: usizeThe tally at the start of the second line of pseudo printing.
cur_string: Vec<u8>The string under construction (NewString).
new_line_char: i32The current \newlinechar (−1 for none).
Implementations§
Source§impl Printer
impl Printer
Sourcepub fn log_opened(&self) -> bool
pub fn log_opened(&self) -> bool
Whether a log file is open.
Sourcepub fn log_raw(&mut self, bytes: &[u8])
pub fn log_raw(&mut self, bytes: &[u8])
Writes raw bytes to the log without bookkeeping (for banners).
Sourcepub fn term_raw(&mut self, bytes: &[u8])
pub fn term_raw(&mut self, bytes: &[u8])
Writes raw bytes to the terminal without bookkeeping (nothing while the terminal is quiet).
Sourcepub fn update_terminal(&mut self)
pub fn update_terminal(&mut self)
Flushes the terminal (TeX’s update_terminal).
Sourcepub fn open_write(&mut self, n: u32, w: Box<dyn Write>)
pub fn open_write(&mut self, n: u32, w: Box<dyn Write>)
Opens \write stream n on w.
Sourcepub fn open_write_streams(&self) -> Vec<u32>
pub fn open_write_streams(&self) -> Vec<u32>
The \write streams that are open.
Sourcepub fn close_write(&mut self, n: u32)
pub fn close_write(&mut self, n: u32)
Closes \write stream n.
Sourcepub fn write_open(&self, n: u32) -> bool
pub fn write_open(&self, n: u32) -> bool
Whether \write stream n is open.
Sourcepub fn print_char(&mut self, c: u32)
pub fn print_char(&mut self, c: u32)
Prints character c, handling the new-line character and the
printable representation for terminal and log.
Sourcepub fn print_raw_byte(&mut self, b: u8)
pub fn print_raw_byte(&mut self, b: u8)
Prints byte b as it is (a byte of invalid UTF-8 input).
Sourcepub fn pseudo_unit(&mut self, bytes: &[u8])
pub fn pseudo_unit(&mut self, bytes: &[u8])
Pseudo-prints bytes (possibly none) as they are, counted as one
position: how LuaTeX shows an invalid byte of an input line.
Sourcepub fn print_callback_bytes(&mut self, s: &[u8])
pub fn print_callback_bytes(&mut self, s: &[u8])
Prints a string returned by a Lua callback (glyph_info): the log
gets the bytes as they are, the terminal shows control characters
in ^^ notation.
Sourcepub fn print_plain(&mut self, s: &str)
pub fn print_plain(&mut self, s: &str)
Prints digits and other characters TeX prints one by one with
print_char (no log slack).
Sourcepub fn print_bytes(&mut self, s: &[u8])
pub fn print_bytes(&mut self, s: &[u8])
Prints a byte string in extended UTF-8 (e.g. a control-sequence name or file name).
Sourcepub fn print_lua_bytes(&mut self, s: &[u8])
pub fn print_lua_bytes(&mut self, s: &[u8])
Prints a byte string as text coming from Lua, with LuaTeX’s log line
length for it (see log_slack).
Sourcepub fn luatex_warning(&mut self, category: &str, msg: &str)
pub fn luatex_warning(&mut self, category: &str, msg: &str)
A LuaTeX warning, warning (category): message, on a line of its
own.
Sourcepub fn print_nl(&mut self, s: &str)
pub fn print_nl(&mut self, s: &str)
Starts a new line unless at the beginning of one (TeX’s print_nl).
Sourcepub fn begin_line(&mut self)
pub fn begin_line(&mut self)
The test-and-newline part of print_nl: ends the current terminal or
log line if it is not empty.
Sourcepub fn print_scaled(&mut self, s: i32)
pub fn print_scaled(&mut self, s: i32)
Prints a scaled value (TeX’s print_scaled).
Sourcepub fn print_hex(&mut self, n: i64)
pub fn print_hex(&mut self, n: i64)
Prints " followed by the uppercase hexadecimal value (TeX’s
print_hex).
Sourcepub fn print_roman_int(&mut self, n: i64)
pub fn print_roman_int(&mut self, n: i64)
Prints a positive integer in lowercase roman numerals (TeX’s
print_roman_int).
Sourcepub fn take_string(&mut self) -> Vec<u8> ⓘ
pub fn take_string(&mut self) -> Vec<u8> ⓘ
Takes the string built by NewString printing.