Skip to main content

Scale26Dot6

Struct Scale26Dot6 

Source
pub struct Scale26Dot6 {
    scale: Fixed,
    is_scaled: bool,
}
Expand description

Scales font units to 26.6 fixed point, reproducing FreeType’s arithmetic.

Fields§

§scale: Fixed§is_scaled: bool

Implementations§

Source§

impl Scale26Dot6

Source

pub fn new(ppem: Option<f32>, units_per_em: u16) -> Self

Creates a scale for the given size in pixels per em.

None produces an unscaled outline with coordinates expressed in 26.6.

Source

pub fn to_bits(self) -> i32

The scale factor that converts font units to scaled 26.6, in 16.16.

Source

fn mul(&self, value: i32) -> F26Dot6

Multiplies a raw value, in font units or 26.6, by the scale factor.

The factor converts as it scales, so this serves both cases.

Source

fn mul_point(&self, value: Point<i32>) -> Point<F26Dot6>

Source

fn mul_point_with_delta( &self, font_units: Point<i32>, delta: Point<F26Dot6>, ) -> Point<F26Dot6>

Scales a point in font units that carries a delta, given in 26.6.

The scale factor has an i32 to 26.6 conversion built into it, so the product is shifted back down afterwards.

Trait Implementations§

Source§

impl Clone for Scale26Dot6

Source§

fn clone(&self) -> Scale26Dot6

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 Copy for Scale26Dot6

Source§

impl Debug for Scale26Dot6

Source§

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

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

impl Scale for Scale26Dot6

Source§

const NEEDS_UNSCALED: bool = true

True if the scale keeps a parallel copy of the points in font units, which hinting needs and which sparse delta interpolation uses as its reference coordinates.
Source§

type Coord = F26Dot6

Coordinate type of the loaded outline.
Source§

type Delta = Fixed

Accumulator type for variation deltas.
Source§

fn is_scaled(&self) -> bool

True if a size was supplied. When false the outline comes back in font units, expressed in Self::Coord.
Source§

fn phantom_from_font_units(&self, value: i32) -> F26Dot6

Converts a font unit value into the representation phantom points use before they are scaled.
Source§

fn coord_to_hinting_raw(&self, value: F26Dot6) -> i32

Reinterprets an output coordinate as the integer a hinter’s font unit buffer holds. Read more
Source§

fn scale_phantom(&self, point: Point<F26Dot6>) -> Point<F26Dot6>

Scales a phantom point that still holds font units.
Source§

fn add_phantom_delta( &self, point: Point<F26Dot6>, delta: Point<Fixed>, ) -> Point<F26Dot6>

Adds a composite glyph’s phantom point delta.
Source§

fn round_phantom(&self, point: Point<F26Dot6>) -> Point<F26Dot6>

Rounds a phantom point, which FreeType does before hinting.
Source§

fn load_empty_phantom( &self, phantom: &mut [Point<F26Dot6>; 4], deltas: Option<[Point<Fixed>; 4]>, )

Sets the phantom points of a glyph with no outline. Read more
Source§

fn load_simple_points( &self, pass: SimplePass<'_, '_, Self>, ) -> Result<[Point<F26Dot6>; 4], Error>

Reads a simple glyph’s points, applies variation deltas, appends the phantom points and writes the scaled result. Read more
Source§

fn transform_points(&self, points: &mut [Point<F26Dot6>], transform: &Transform)

Applies a component’s 2x2 transform to points that have already been placed. Read more
Source§

fn component_offset( &self, offset: Point<i32>, transform: &Transform, scale_offset: bool, delta: Option<Point<Fixed>>, rounding: OffsetRounding, ) -> Point<F26Dot6>

Computes the translation for a component given as an offset. 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> ErasedDestructor for T
where T: 'static,

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> 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.