pub struct TextFlowContext { /* private fields */ }Implementations§
Source§impl TextFlowContext
impl TextFlowContext
pub fn new(page_width: f64, page_height: f64, margins: Margins) -> Self
pub fn set_font(&mut self, font: Font, size: f64) -> &mut Self
pub fn set_line_height(&mut self, multiplier: f64) -> &mut Self
pub fn set_alignment(&mut self, alignment: TextAlign) -> &mut Self
Sourcepub fn set_fill_color(&mut self, color: Color) -> &mut Self
pub fn set_fill_color(&mut self, color: Color) -> &mut Self
Sets the non-stroking (fill) color used for subsequent text emitted
by write_wrapped (issue #216). Mirrors TextContext::set_fill_color.
None keeps the surrounding graphics state untouched (previous
behaviour); Some(color) emits the matching PDF operator inside each
BT … ET block.
Sourcepub fn set_character_spacing(&mut self, spacing: f64) -> &mut Self
pub fn set_character_spacing(&mut self, spacing: f64) -> &mut Self
Setters for the remaining text-state parameters, mirroring
TextContext. Closes the propagation gap reported in issue #222.
All apply on the next BT … ET block emitted by write_wrapped.
pub fn set_word_spacing(&mut self, spacing: f64) -> &mut Self
Sourcepub fn set_horizontal_scaling(&mut self, scale: f64) -> &mut Self
pub fn set_horizontal_scaling(&mut self, scale: f64) -> &mut Self
Set horizontal scaling. The argument is the ratio (e.g. 0.85
for 85 %); it is converted to the PDF Tz percentage at
emission time. Matches the contract documented on
TextContext::set_horizontal_scaling.
pub fn set_leading(&mut self, leading: f64) -> &mut Self
pub fn set_text_rise(&mut self, rise: f64) -> &mut Self
Sourcepub fn set_rendering_mode(&mut self, mode: u8) -> &mut Self
pub fn set_rendering_mode(&mut self, mode: u8) -> &mut Self
Set the text rendering mode (0..=7 per ISO 32000-1 §9.3.6).
The argument is taken as a u8 rather than the typed
TextRenderingMode enum to avoid an extra public dependency
from TextFlowContext on the parent module.
pub fn set_stroke_color(&mut self, color: Color) -> &mut Self
Sourcepub fn current_font(&self) -> &Font
pub fn current_font(&self) -> &Font
Current font this context will use when emitting text.
Sourcepub fn fill_color(&self) -> Option<Color>
pub fn fill_color(&self) -> Option<Color>
Current fill color, if one has been explicitly set (issue #216).
pub fn at(&mut self, x: f64, y: f64) -> &mut Self
pub fn content_width(&self) -> f64
Sourcepub fn available_width(&self) -> f64
pub fn available_width(&self) -> f64
Returns the width available for text starting at the current cursor_x position.
Unlike content_width() which always uses margins.left as the origin,
available_width() accounts for the actual cursor position so that text
placed via .at(x, y) does not overflow the right margin.
pub fn write_wrapped(&mut self, text: &str) -> Result<&mut Self>
pub fn write_paragraph(&mut self, text: &str) -> Result<&mut Self>
pub fn newline(&mut self) -> &mut Self
pub fn cursor_position(&self) -> (f64, f64)
pub fn generate_operations(&self) -> Vec<u8> ⓘ
Sourcepub fn page_dimensions(&self) -> (f64, f64)
pub fn page_dimensions(&self) -> (f64, f64)
Get the page dimensions
Sourcepub fn line_height(&self) -> f64
pub fn line_height(&self) -> f64
Get current line height multiplier
Sourcepub fn operations(&self) -> String
pub fn operations(&self) -> String
Get the operations as a serialised PDF content-stream String.
Pre-2.7.0 this returned &str. The IR migration replaced the
internal String buffer with a typed Vec<Op>, so the legacy
borrow is materialised on demand. Internal callers prefer
generate_operations() which returns the byte buffer directly.
Auto Trait Implementations§
impl Freeze for TextFlowContext
impl RefUnwindSafe for TextFlowContext
impl Send for TextFlowContext
impl Sync for TextFlowContext
impl Unpin for TextFlowContext
impl UnsafeUnpin for TextFlowContext
impl UnwindSafe for TextFlowContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more