Struct rckive_genpdf::style::Style

source ·
pub struct Style { /* private fields */ }
Expand description

A style annotation for a string.

The annotation consists of:

  • a font family, see FontFamily (defaults to the FontCache default)
  • a font size in points (defaults to 12)
  • a line spacing factor, with 1 meaning single line spacing (defaults to 1)
  • an outline color, see Color (defaults to black)
  • a combination of text effects, see Effect (defaults to none)

All properties are optional. If they are not set, they can be inferred from parent styles or from the defaults.

Implementations§

Creates a new style without settings.

Merges the given style into this style.

Combines this style and the given style and returns the result.

Creates a new style by combining the given styles.

Returns the outline color for this style, if set.

Returns whether the bold text effect is set.

Returns whether the italic text effect is set.

Returns the font size for this style in points, or 12 if no font size is set.

Returns the line spacing factor for this style, or 1 if no line spacing factor is set.

Sets the bold effect for this style.

Sets the bold effect for this style and returns it.

Sets the italic effect for this style.

Sets the italic effect for this style and returns it.

Sets the font family for this style.

Sets the font family for this style and returns it.

Sets the line spacing factor for this style.

Sets the line spacing factor for this style and returns it.

Sets the font size in points for this style.

Sets the font size in points for this style and returns it.

Sets the outline color for this style.

Sets the outline color for this style and returns it.

Calculates the width of the given character with this style using the data in the given font cache.

If the font family is set, it must have been created by the given FontCache.

Returns the width of the empty space between the origin of the glyph bounding box and the leftmost edge of the character, for this style using the given font cache.

If the font family is set, it must have been created by the given FontCache.

Calculates the width of the given string with this style using the data in the given font cache.

If the font family is set, it must have been created by the given FontCache.

Returns the font family for this style or the default font family using the given font cache.

If the font family is set, it must have been created by the given FontCache.

Returns the font for this style using the given font cache.

If the font family is set, it must have been created by the given FontCache.

Calculates the line height for strings with this style using the data in the given font cache.

If the font family is set, it must have been created by the given FontCache.

Calculate the metrics of the font for this style using the data in the given font cache.

If the font family is set, it must have been created by the given FontCache.

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates a value from an iterator. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.