Skip to main content

FakePageConfig

Struct FakePageConfig 

Source
pub struct FakePageConfig {
Show 14 fields pub show_header: bool, pub show_footer: bool, pub header_text: Option<String>, pub footer_text: Option<String>, pub header_page_number: bool, pub footer_page_number: bool, pub header_total_pages: bool, pub footer_total_pages: bool, pub number_format: CounterFormat, pub skip_first_page: bool, pub header_height: f32, pub footer_height: f32, pub font_size: f32, pub text_color: ColorU,
}
Expand description

Temporary configuration for page headers/footers without CSS @page parsing.

Provides programmatic control over page decoration until full CSS @page rule support is implemented.

§Supported Features

  • Page numbers in header and/or footer
  • Custom text in header and/or footer
  • Number format (decimal, roman numerals, alphabetic, greek)
  • Skip first page option

§Example

use azul_layout::solver3::pagination::FakePageConfig;

let config = FakePageConfig::new()
    .with_footer_page_numbers()
    .with_header_text("My Document")
    .skip_first_page(true);

let header_footer = config.to_header_footer_config();

Fields§

§show_header: bool

Show header on pages

§show_footer: bool

Show footer on pages

§header_text: Option<String>

Header text (static text, or None for page numbers only)

§footer_text: Option<String>

Footer text (static text, or None for page numbers only)

§header_page_number: bool

Include page number in header

§footer_page_number: bool

Include page number in footer

§header_total_pages: bool

Include total pages count (“of Y”) in header

§footer_total_pages: bool

Include total pages count (“of Y”) in footer

§number_format: CounterFormat

Number format for page counters

§skip_first_page: bool

Skip header/footer on first page

§header_height: f32

Header height in points

§footer_height: f32

Footer height in points

§font_size: f32

Font size for header/footer text

§text_color: ColorU

Text color for header/footer

Implementations§

Source§

impl FakePageConfig

Source

pub fn new() -> Self

Create a new empty configuration (no headers/footers).

Enable footer with “Page X of Y” format.

Source

pub fn with_header_page_numbers(self) -> Self

Enable header with “Page X” format.

Enable both header and footer with page numbers.

Source

pub fn with_header_text(self, text: impl Into<String>) -> Self

Set custom header text.

Set custom footer text.

Source

pub fn with_number_format(self, format: CounterFormat) -> Self

Set the number format for page counters.

Source

pub fn skip_first_page(self, skip: bool) -> Self

Skip header/footer on the first page.

Source

pub fn with_header_height(self, height: f32) -> Self

Set header height.

Set footer height.

Source

pub fn with_font_size(self, size: f32) -> Self

Set font size for header/footer text.

Source

pub fn with_text_color(self, color: ColorU) -> Self

Set text color for header/footer.

Convert this fake config to the internal HeaderFooterConfig.

This is the bridge between the user-facing API and the internal pagination engine.

Trait Implementations§

Source§

impl Clone for FakePageConfig

Source§

fn clone(&self) -> FakePageConfig

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FakePageConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for FakePageConfig

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.