Struct Engine

Source
pub struct Engine<'a> {
    program: ProgramState<'a>,
    graphics: GraphicsState<'a>,
    definitions: DefinitionState<'a>,
    cvt: Cvt<'a>,
    storage: Storage<'a>,
    value_stack: ValueStack<'a>,
    loop_budget: LoopBudget,
    axis_count: u16,
    coords: &'a [F2Dot14],
}
Expand description

TrueType bytecode interpreter.

Fields§

§program: ProgramState<'a>§graphics: GraphicsState<'a>§definitions: DefinitionState<'a>§cvt: Cvt<'a>§storage: Storage<'a>§value_stack: ValueStack<'a>§loop_budget: LoopBudget§axis_count: u16§coords: &'a [F2Dot14]

Implementations§

Source§

impl Engine<'_>

Source

pub(super) fn op_add(&mut self) -> Result<(), HintErrorKind>

ADD[] (0x60)

Pops: n1, n2 (F26Dot6) Pushes: (n2 + n1)

Pops n1 and n2 off the stack and pushes the sum of the two elements onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#add and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2866

Source

pub(super) fn op_sub(&mut self) -> Result<(), HintErrorKind>

SUB[] (0x61)

Pops: n1, n2 (F26Dot6) Pushes: (n2 - n1)

Pops n1 and n2 off the stack and pushes the difference of the two elements onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#subtract and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2879

Source

pub(super) fn op_div(&mut self) -> Result<(), HintErrorKind>

DIV[] (0x62)

Pops: n1, n2 (F26Dot6) Pushes: (n2 / n1)

Pops n1 and n2 off the stack and pushes onto the stack the quotient obtained by dividing n2 by n1. Note that this truncates rather than rounds the value.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#divide and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2892

Source

pub(super) fn op_mul(&mut self) -> Result<(), HintErrorKind>

MUL[] (0x63)

Pops: n1, n2 (F26Dot6) Pushes: (n2 * n1)

Pops n1 and n2 off the stack and pushes onto the stack the product of the two elements.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#multiply and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2909

Source

pub(super) fn op_abs(&mut self) -> Result<(), HintErrorKind>

ABS[] (0x64)

Pops: n Pushes: |n|: absolute value of n (F26Dot6)

Pops n off the stack and pushes onto the stack the absolute value of n.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#absolute-value and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2922

Source

pub(super) fn op_neg(&mut self) -> Result<(), HintErrorKind>

NEG[] (0x65)

Pops: n1 Pushes: -n1: negation of n1 (F26Dot6)

This instruction pops n1 off the stack and pushes onto the stack the negated value of n1.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#negate and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2936

Source

pub(super) fn op_floor(&mut self) -> Result<(), HintErrorKind>

FLOOR[] (0x66)

Pops: n1: number whose floor is desired (F26Dot6) Pushes: n: floor of n1 (F26Dot6)

Pops n1 and returns n, the greatest integer value less than or equal to n1.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#floor and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2949

Source

pub(super) fn op_ceiling(&mut self) -> Result<(), HintErrorKind>

CEILING[] (0x67)

Pops: n1: number whose ceiling is desired (F26Dot6) Pushes: n: ceiling of n1 (F26Dot6)

Pops n1 and returns n, the least integer value greater than or equal to n1.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#ceiling and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2962

Source

pub(super) fn op_max(&mut self) -> Result<(), HintErrorKind>

MAX[] (0x8B)

Pops: e1, e2 Pushes: maximum of e1 and e2

Pops two elements, e1 and e2, from the stack and pushes the larger of these two quantities onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#maximum-of-top-two-stack-elements and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3171

Source

pub(super) fn op_min(&mut self) -> Result<(), HintErrorKind>

MIN[] (0x8C)

Pops: e1, e2 Pushes: minimum of e1 and e2

Pops two elements, e1 and e2, from the stack and pushes the smaller of these two quantities onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#minimum-of-top-two-stack-elements and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3185

Source§

impl Engine<'_>

Source

pub(super) fn op_if(&mut self) -> Result<(), HintErrorKind>

If test.

IF[] (0x58)

Pops: e: stack element

Tests the element popped off the stack: if it is zero (FALSE), the instruction pointer is jumped to the next ELSE or EIF instruction in the instruction stream. If the element at the top of the stack is nonzero (TRUE), the next instruction in the instruction stream is executed. Execution continues until an ELSE instruction is encountered or an EIF instruction ends the IF. If an else statement is found before the EIF, the instruction pointer is moved to the EIF statement.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#if-test and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3334

Source

pub(super) fn op_else(&mut self) -> Result<(), HintErrorKind>

Else.

ELSE[] (0x1B)

Marks the start of the sequence of instructions that are to be executed if an IF instruction encounters a FALSE value on the stack. This sequence of instructions is terminated with an EIF instruction.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#else and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3378

Source

pub(super) fn op_eif(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_jrot(&mut self) -> Result<(), HintErrorKind>

Jump relative on true.

JROT[] (0x78)

Pops: e: stack element offset: number of bytes to move the instruction pointer

Pops and tests the element value, and then pops the offset. If the element value is non-zero (TRUE), the signed offset will be added to the instruction pointer and execution will be resumed at the address obtained. Otherwise, the jump is not taken and the next instruction in the instruction stream is executed. The jump is relative to the position of the instruction itself. That is, the instruction pointer is still pointing at the JROT[ ] instruction when offset is added to obtain the new address.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#jump-relative-on-true and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3459

Source

pub(super) fn op_jmpr(&mut self) -> Result<(), HintErrorKind>

Jump.

JMPR[] (0x1C)

Pops: offset: number of bytes to move the instruction pointer

The signed offset is added to the instruction pointer and execution is resumed at the new location in the instruction steam. The jump is relative to the position of the instruction itself. That is, the instruction pointer is still pointing at the JROT[] instruction when offset is added to obtain the new address.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#jump and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3424

Source

pub(super) fn op_jrof(&mut self) -> Result<(), HintErrorKind>

Jump relative on false.

JROF[] (0x78)

Pops: e: stack element offset: number of bytes to move the instruction pointer

Pops and tests the element value, and then pops the offset. If the element value is non-zero (TRUE), the signed offset will be added to the instruction pointer and execution will be resumed at the address obtained. Otherwise, the jump is not taken and the next instruction in the instruction stream is executed. The jump is relative to the position of the instruction itself. That is, the instruction pointer is still pointing at the JROT[ ] instruction when offset is added to obtain the new address.

Pops and tests the element value, and then pops the offset. If the element value is zero (FALSE), the signed offset will be added to the nstruction pointer and execution will be resumed at the address obtainted. Otherwise, the jump is not taken and the next instruction in the instruction stream is executed. The jump is relative to the position of the instruction itself. That is, the instruction pointer is still pointing at the JROT[ ] instruction when the offset is added to obtain the new address.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#jump-relative-on-false and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3474

Source

fn do_jump(&mut self, test: bool) -> Result<(), HintErrorKind>

Source

fn decode_next_opcode(&mut self) -> Result<Opcode, HintErrorKind>

Source§

impl Engine<'_>

Source

pub(super) fn op_wcvtp(&mut self) -> Result<(), HintErrorKind>

Write control value table in pixel units.

WCVTP[] (0x44)

Pops: value: number in pixels (F26Dot6 fixed point number), location: Control Value Table location (uint32)

Pops a location and a value from the stack and puts that value in the specified location in the Control Value Table. This instruction assumes the value is in pixels and not in FUnits.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#write-control-value-table-in-pixel-units and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3044

Source

pub(super) fn op_wcvtf(&mut self) -> Result<(), HintErrorKind>

Write control value table in font units.

WCVTF[] (0x70)

Pops: value: number in pixels (F26Dot6 fixed point number), location: Control Value Table location (uint32)

Pops a location and a value from the stack and puts the specified value in the specified address in the Control Value Table. This instruction assumes the value is expressed in FUnits and not pixels. The value is scaled before being written to the table.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#write-control-value-table-in-funits and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3067

Source

pub(super) fn op_rcvt(&mut self) -> Result<(), HintErrorKind>

Read control value table.

RCVT[] (0x45)

Pops: location: CVT entry number Pushes: value: CVT value (F26Dot6)

Pops a location from the stack and pushes the value in the location specified in the Control Value Table onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#read-control-value-table and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3090

Source§

impl Engine<'_>

Source

pub(super) fn op_gc(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Get coordinate project in to the projection vector.

GC[a] (0x46 - 0x47)

a: 0: use current position of point p 1: use the position of point p in the original outline

Pops: p: point number Pushes: value: coordinate location (F26Dot6)

Measures the coordinate value of point p on the current projection_vector and pushes the value onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#get-coordinate-projected-onto-the-projection_vector and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4512

Source

pub(super) fn op_scfs(&mut self) -> Result<(), HintErrorKind>

Set coordinate from the stack using projection vector and freedom vector.

SCFS[] (0x48)

Pops: value: distance from origin to move point (F26Dot6) p: point number

Moves point p from its current position along the freedom_vector so that its component along the projection_vector becomes the value popped off the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#sets-coordinate-from-the-stack-using-projection_vector-and-freedom_vector and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4550

Source

pub(super) fn op_md(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Measure distance.

MD[a] (0x46 - 0x47)

a: 0: measure distance in grid-fitted outline 1: measure distance in original outline

Pops: p1: point number p2: point number Pushes: distance (F26Dot6)

Measures the distance between outline point p1 and outline point p2. The value returned is in pixels (F26Dot6) If distance is negative, it was measured against the projection vector. Reversing the order in which the points are listed will change the sign of the result.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#measure-distance and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4593

Source

pub(super) fn op_mppem(&mut self) -> Result<(), HintErrorKind>

Measure pixels per em.

MPPEM[] (0x4B)

Pushes: ppem: pixels per em (uint32)

This instruction pushes the number of pixels per em onto the stack. Pixels per em is a function of the resolution of the rendering device and the current point size and the current transformation matrix.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#measure-pixels-per-em and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2609

Source

pub(super) fn op_mps(&mut self) -> Result<(), HintErrorKind>

Measure point size.

MPS[] (0x4C)

Pushes: pointSize: the size in points of the current glyph (F26Dot6)

Measure point size can be used to obtain a value which serves as the basis for choosing whether to branch to an alternative path through the instruction stream. It makes it possible to treat point sizes below or above a certain threshold differently.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#measure-point-size and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2623

Source§

impl Engine<'_>

Source

pub(super) fn op_fdef(&mut self) -> Result<(), HintErrorKind>

Function definition.

FDEF[] (0x2C)

Pops: f: function identifier number

Marks the start of a function definition. The argument f is a number that uniquely identifies this function. A function definition can appear only in the Font Program or the CVT program; attempts to invoke the FDEF instruction within a glyph program will result in an error. Functions may not exceed 64K in size.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#function-definition and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3496

Source

pub(super) fn op_endf(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_call(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_loopcall(&mut self) -> Result<(), HintErrorKind>

Loop and call function.

LOOPCALL[] (0x2a)

Pops: f: function identifier number count: number of times to call the function

Calls the function f, count number of times.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#loop-and-call-function and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3704

Source

pub(super) fn op_idef(&mut self) -> Result<(), HintErrorKind>

Instruction definition.

IDEF[] (0x89)

Pops: opcode

Begins the definition of an instruction. The instruction definition terminates when at ENDF, which is encountered in the instruction stream. Subsequent executions of the opcode popped will be directed to the contents of this instruction definition (IDEF). IDEFs must be defined in the Font Program or the CVT Program; attempts to invoke the IDEF instruction within a glyph program will result in an error. An IDEF affects only undefined opcodes. If the opcode in question is already defined, the interpreter will ignore the IDEF. This is to be used as a patching mechanism for future instructions. Instructions may not exceed 64K in size.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#instruction-definition and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3788

Source

pub(super) fn op_unknown(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Catch all for unhandled opcodes which will attempt to dispatch to a user defined instruction.

Source

fn do_def(&mut self, kind: DefKind, key: i32) -> Result<(), HintErrorKind>

Common code for FDEF and IDEF.

Source

fn do_call( &mut self, kind: DefKind, count: u32, key: i32, ) -> Result<(), HintErrorKind>

Common code for CALL, LOOPCALL and unknown opcode handling.

Source§

impl Engine<'_>

Source

pub(super) fn op_deltap(&mut self, opcode: Opcode) -> Result<(), HintErrorKind>

Delta exception P1, P2 and P3.

DELTAP1[] (0x5D) DELTAP2[] (0x71) DELTAP3[] (0x72)

Pops: n: number of pairs of exception specifications and points (uint32) p1, arg1, p2, arg2, …, pnn argn: n pairs of exception specifications and points (pairs of uint32s)

DELTAP moves the specified points at the size and by the amount specified in the paired argument. An arbitrary number of points and arguments can be specified.

The only difference between the instructions is the bias added to the point adjustment.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#delta-exception-p1 and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6509

Source

pub(super) fn op_deltac(&mut self, opcode: Opcode) -> Result<(), HintErrorKind>

Delta exception C1, C2 and C3.

DELTAC1[] (0x73) DELTAC2[] (0x74) DELTAC3[] (0x75)

Pops: n: number of pairs of exception specifications and CVT entry numbers (uint32) c1, arg1, c2, arg2,…, cn, argn: (pairs of uint32s)

DELTAC changes the value in each CVT entry specified at the size and by the amount specified in its paired argument.

The only difference between the instructions is the bias added to the adjustment.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#delta-exception-c1 and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6604

Source§

impl<'a> Engine<'a>

Source

pub fn run_program( &mut self, program: Program, is_pedantic: bool, ) -> Result<(), HintError>

Resets state for the specified program and executes all instructions.

Source

pub fn reset(&mut self, program: Program, is_pedantic: bool)

Set internal state for running the specified program.

Source

pub fn run(&mut self) -> Result<(), HintError>

Decodes and dispatches all instructions until completion or error.

Source

pub fn decode(&mut self) -> Option<Result<Instruction<'a>, HintError>>

Decodes the next instruction from the current program.

Source

pub fn dispatch(&mut self, ins: &Instruction<'_>) -> Result<(), HintError>

Executes the appropriate code for the given instruction.

Source

fn dispatch_inner(&mut self, ins: &Instruction<'_>) -> Result<(), HintErrorKind>

Source§

impl Engine<'_>

Source

pub(super) fn op_svtca(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Set vectors to coordinate axis.

SVTCA[a] (0x00 - 0x01)

Sets both the projection_vector and freedom_vector to the same one of the coordinate axes.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-freedom-and-projection-vectors-to-coordinate-axis

SPVTCA[a] (0x02 - 0x03)

Sets the projection_vector to one of the coordinate axes depending on the value of the flag a.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-projection_vector-to-coordinate-axis

SFVTCA[a] (0x04 - 0x05)

Sets the freedom_vector to one of the coordinate axes depending on the value of the flag a.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-freedom_vector-to-coordinate-axis

FreeType combines these into a single function using some bit magic on the opcode to determine which axes and vectors to set.

See https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4051

Source

pub(super) fn op_svtl(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Set vectors to line.

SPVTL[a] (0x06 - 0x07)

Sets the projection_vector to a unit vector parallel or perpendicular to the line segment from point p1 to point p2.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-projection_vector-to-line

SFVTL[a] (0x08 - 0x09)

Sets the freedom_vector to a unit vector parallel or perpendicular to the line segment from point p1 to point p2.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-freedom_vector-to-line

Pops: p1, p2 (point number)

See https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3986

Source

pub(super) fn op_sfvtpv(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_sdpvtl(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Set dual projection vector to line.

SDPVTL[a] (0x86 - 0x87)

Pops: p1, p2 (point number)

Pops two point numbers from the stack and uses them to specify a line that defines a second, dual_projection_vector.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-dual-projection_vector-to-line and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4663

Source

pub(super) fn op_spvfs(&mut self) -> Result<(), HintErrorKind>

Set projection vector from stack.

SPVFS[] (0x0A)

Pops: y, x (2.14 fixed point numbers padded with zeroes)

Sets the direction of the projection_vector, using values x and y taken from the stack, so that its projections onto the x and y-axes are x and y, which are specified as signed (two’s complement) fixed-point (2.14) numbers. The square root of (x2 + y2) must be equal to 0x4000 (hex)

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-projection_vector-from-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4142

Source

pub(super) fn op_sfvfs(&mut self) -> Result<(), HintErrorKind>

Set freedom vector from stack.

SFVFS[] (0x0B)

Pops: y, x (2.14 fixed point numbers padded with zeroes)

Sets the direction of the freedom_vector, using values x and y taken from the stack, so that its projections onto the x and y-axes are x and y, which are specified as signed (two’s complement) fixed-point (2.14) numbers. The square root of (x2 + y2) must be equal to 0x4000 (hex)

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-freedom_vector-from-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4169

Source

pub(super) fn op_gpv(&mut self) -> Result<(), HintErrorKind>

Get projection vector.

GPV[] (0x0C)

Pushes: x, y (2.14 fixed point numbers padded with zeroes)

Pushes the x and y components of the projection_vector onto the stack as two 2.14 numbers.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#get-projection_vector and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4194

Source

pub(super) fn op_gfv(&mut self) -> Result<(), HintErrorKind>

Get freedom vector.

GFV[] (0x0D)

Pushes: x, y (2.14 fixed point numbers padded with zeroes)

Pushes the x and y components of the freedom_vector onto the stack as two 2.14 numbers.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#get-freedom_vector and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4209

Source

pub(super) fn op_srp0(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_srp1(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_srp2(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_szp0(&mut self) -> Result<(), HintErrorKind>

Set zone pointer 0.

SZP0[] (0x13)

Pops: n (zone number)

Pops a zone number, n, from the stack and sets zp0 to the zone with that number. If n is 0, zp0 points to zone 0. If n is 1, zp0 points to zone 1. Any other value for n is an error.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-zone-pointer-0 and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4746

Source

pub(super) fn op_szp1(&mut self) -> Result<(), HintErrorKind>

Set zone pointer 1.

SZP1[] (0x14)

Pops: n (zone number)

Pops a zone number, n, from the stack and sets zp0 to the zone with that number. If n is 0, zp1 points to zone 0. If n is 1, zp0 points to zone 1. Any other value for n is an error.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-zone-pointer-1 and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4776

Source

pub(super) fn op_szp2(&mut self) -> Result<(), HintErrorKind>

Set zone pointer 2.

SZP2[] (0x15)

Pops: n (zone number)

Pops a zone number, n, from the stack and sets zp0 to the zone with that number. If n is 0, zp2 points to zone 0. If n is 1, zp0 points to zone 1. Any other value for n is an error.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-zone-pointer-2 and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4806

Source

pub(super) fn op_szps(&mut self) -> Result<(), HintErrorKind>

Set zone pointers.

SZPS[] (0x16)

Pops: n (zone number)

Pops a zone number from the stack and sets all of the zone pointers to point to the zone with that number. If n is 0, all three zone pointers will point to zone 0. If n is 1, all three zone pointers will point to zone 1. Any other value for n is an error.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-zone-pointers and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4836

Source

pub(super) fn op_rthg(&mut self) -> Result<(), HintErrorKind>

Round to half grid.

RTHG[] (0x19)

Sets the round_state variable to state 0 (hg). In this state, the coordinates of a point are rounded to the nearest half grid line.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-to-half-grid and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4393

Source

pub(super) fn op_rtg(&mut self) -> Result<(), HintErrorKind>

Round to grid.

RTG[] (0x18)

Sets the round_state variable to state 1 (g). In this state, distances are rounded to the closest grid line.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-to-grid and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4407

Source

pub(super) fn op_rtdg(&mut self) -> Result<(), HintErrorKind>

Round to double grid.

RTDG[] (0x3D)

Sets the round_state variable to state 2 (dg). In this state, distances are rounded to the closest half or integer pixel.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-to-double-grid and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4420

Source

pub(super) fn op_rdtg(&mut self) -> Result<(), HintErrorKind>

Round down to grid.

RDTG[] (0x7D)

Sets the round_state variable to state 3 (dtg). In this state, distances are rounded down to the closest integer grid line.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-down-to-grid and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4447

Source

pub(super) fn op_rutg(&mut self) -> Result<(), HintErrorKind>

Round up to grid.

RUTG[] (0x7C)

Sets the round_state variable to state 4 (utg). In this state distances are rounded up to the closest integer pixel boundary.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-up-to-grid and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4433

Source

pub(super) fn op_roff(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_sround(&mut self) -> Result<(), HintErrorKind>

Super round.

SROUND[] (0x76)

Pops: n (number decomposed to obtain period, phase threshold)

SROUND allows you fine control over the effects of the round_state variable by allowing you to set the values of three components of the round_state: period, phase, and threshold.

More formally, SROUND maps the domain of 26.6 fixed point numbers into a set of discrete values that are separated by equal distances.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#super-round and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4475

Source

pub(super) fn op_s45round(&mut self) -> Result<(), HintErrorKind>

Super round 45 degrees.

S45ROUND[] (0x77)

Pops: n (number decomposed to obtain period, phase threshold)

S45ROUND is analogous to SROUND. The gridPeriod is SQRT(2)/2 pixels rather than 1 pixel. It is useful for measuring at a 45 degree angle with the coordinate axes.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#super-round-45-degrees and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4492

Source

fn super_round(&mut self, grid_period: i32, selector: i32)

Helper function for decomposing period, phase and threshold for the SROUND[] and SROUND45[] instructions.

See https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2299

Source

pub(super) fn op_sloop(&mut self) -> Result<(), HintErrorKind>

Set loop variable.

SLOOP[] (0x17)

Pops: n (value for loop Graphics State variable (integer))

Pops a value, n, from the stack and sets the loop variable count to that value. The loop variable works with the SHP[a], SHPIX[], IP[], FLIPPT[], and ALIGNRP[]. The value n indicates the number of times the instruction is to be repeated. After the instruction executes, the loop variable is reset to 1.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-loop-variable and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3287

Source

pub(super) fn op_smd(&mut self) -> Result<(), HintErrorKind>

Set minimum distance.

SMD[] (0x1A)

Pops: distance: value for minimum_distance (F26Dot6)

Pops a value from the stack and sets the minimum_distance variable to that value. The distance is assumed to be expressed in sixty-fourths of a pixel.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-minimum_distance and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4266

Source

pub(super) fn op_instctrl(&mut self) -> Result<(), HintErrorKind>

Instruction execution control.

INSTCTRL[] (0x8E)

Pops: s: selector flag (int32) value: used to set value of instruction_control (uint16 padded)

Sets the instruction control state variable making it possible to turn on or off the execution of instructions and to regulate use of parameters set in the CVT program. INSTCTRL[ ] can only be executed in the CVT program.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#instruction-execution-control and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4871

Source

pub(super) fn op_scanctrl(&mut self) -> Result<(), HintErrorKind>

Scan conversion control.

SCANCTRL[] (0x85)

Pops: n: flags indicating when to turn on dropout control mode

SCANCTRL is used to set the value of the Graphics State variable scan_control which in turn determines whether the scan converter will activate dropout control for this glyph.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#scan-conversion-control and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4933

Source

pub(super) fn op_scantype(&mut self) -> Result<(), HintErrorKind>

Scan type.

SCANTYPE[] (0x8D)

Pops: n: 16 bit integer

Pops a 16-bit integer whose value is used to determine which rules the scan converter will use.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#scantype and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4980

Source

pub(super) fn op_scvtci(&mut self) -> Result<(), HintErrorKind>

Set control value table cut in.

SCVTCI[] (0x1D)

Pops: n: value for cut_in (F26Dot6)

Sets the control_value_cut_in in the Graphics State. The value n is expressed in sixty-fourths of a pixel.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-control-value-table-cut-in and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4280

Source

pub(super) fn op_sswci(&mut self) -> Result<(), HintErrorKind>

Set single width cut in.

SSWCI[] (0x1E)

Pops: n: value for single_width_cut_in (F26Dot6)

Sets the single_width_cut_in in the Graphics State. The value n is expressed in sixty-fourths of a pixel.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-single_width_cut_in and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4294

Source

pub(super) fn op_ssw(&mut self) -> Result<(), HintErrorKind>

Set single width.

SSW[] (0x1F)

Pops: n: value for single_width_value (FUnits)

Sets the single_width_value in the Graphics State. The single_width_value is expressed in FUnits, which the interpreter converts to pixels (F26Dot6).

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-single-width and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4308

Source

pub(super) fn op_flipon(&mut self) -> Result<(), HintErrorKind>

Set auto flip on.

FLIPON[] (0x4D)

Sets the auto_flip Boolean in the Graphics State to TRUE causing the MIRP instructions to ignore the sign of Control Value Table entries. The default auto_flip Boolean value is TRUE.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-the-auto_flip-boolean-to-on and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4323

Source

pub(super) fn op_flipoff(&mut self) -> Result<(), HintErrorKind>

Set auto flip off.

FLIPOFF[] (0x4E)

Set the auto_flip Boolean in the Graphics State to FALSE causing the MIRP instructions to use the sign of Control Value Table entries. The default auto_flip Boolean value is TRUE.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-the-auto_flip-boolean-to-off and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4336

Source

pub(super) fn op_sangw(&mut self) -> Result<(), HintErrorKind>

Set angle weight.

SANGW[] (0x7E)

Pops: weight: value for angle_weight

SANGW is no longer needed because of dropped support to the AA (Adjust Angle) instruction. AA was the only instruction that used angle_weight in the global graphics state.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-angle_weight and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4349

Source

pub(super) fn op_sdb(&mut self) -> Result<(), HintErrorKind>

Set delta base in graphics state.

SDB[] (0x5E)

Pops: n: value for delta_base

Pops a number, n, and sets delta_base to the value n. The default for delta_base is 9.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#set-delta_base-in-the-graphics-state and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L4362

Source

pub(super) fn op_sds(&mut self) -> Result<(), HintErrorKind>

Source§

impl Engine<'_>

Source

pub(super) fn op_lt(&mut self) -> Result<(), HintErrorKind>

Less than.

LT[] (0x50)

Pops: e1, e2 Pushes: Boolean value

First pops e2, then pops e1 off the stack and compares them: if e1 is less than e2, 1, signifying TRUE, is pushed onto the stack. If e1 is not less than e2, 0, signifying FALSE, is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#less-than and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2721

Source

pub(super) fn op_lteq(&mut self) -> Result<(), HintErrorKind>

Less than or equal.

LTEQ[] (0x51)

Pops: e1, e2 Pushes: Boolean value

Pops e2 and e1 off the stack and compares them. If e1 is less than or equal to e2, 1, signifying TRUE, is pushed onto the stack. If e1 is not less than or equal to e2, 0, signifying FALSE, is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#less-than-or-equal and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2734

Source

pub(super) fn op_gt(&mut self) -> Result<(), HintErrorKind>

Greater than.

GT[] (0x52)

Pops: e1, e2 Pushes: Boolean value

First pops e2 then pops e1 off the stack and compares them. If e1 is greater than e2, 1, signifying TRUE, is pushed onto the stack. If e1 is not greater than e2, 0, signifying FALSE, is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#greater-than and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2747

Source

pub(super) fn op_gteq(&mut self) -> Result<(), HintErrorKind>

Greater than or equal.

GTEQ[] (0x53)

Pops: e1, e2 Pushes: Boolean value

Pops e1 and e2 off the stack and compares them. If e1 is greater than or equal to e2, 1, signifying TRUE, is pushed onto the stack. If e1 is not greater than or equal to e2, 0, signifying FALSE, is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#greater-than-or-equal and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2760

Source

pub(super) fn op_eq(&mut self) -> Result<(), HintErrorKind>

Equal.

EQ[] (0x54)

Pops: e1, e2 Pushes: Boolean value

Pops e1 and e2 off the stack and compares them. If they are equal, 1, signifying TRUE is pushed onto the stack. If they are not equal, 0, signifying FALSE is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#equal and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2773

Source

pub(super) fn op_neq(&mut self) -> Result<(), HintErrorKind>

Not equal.

NEQ[] (0x55)

Pops: e1, e2 Pushes: Boolean value

Pops e1 and e2 from the stack and compares them. If they are not equal, 1, signifying TRUE, is pushed onto the stack. If they are equal, 0, signifying FALSE, is placed on the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#not-equal and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2786

Source

pub(super) fn op_odd(&mut self) -> Result<(), HintErrorKind>

Odd.

ODD[] (0x56)

Pops: e1 Pushes: Boolean value

Tests whether the number at the top of the stack is odd. Pops e1 from the stack and rounds it as specified by the round_state before testing it. After the value is rounded, it is shifted from a fixed point value to an integer value (any fractional values are ignored). If the integer value is odd, one, signifying TRUE, is pushed onto the stack. If it is even, zero, signifying FALSE is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#odd and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2799

Source

pub(super) fn op_even(&mut self) -> Result<(), HintErrorKind>

Even.

EVEN[] (0x57)

Pops: e1 Pushes: Boolean value

Tests whether the number at the top of the stack is even. Pops e1 off the stack and rounds it as specified by the round_state before testing it. If the rounded number is even, one, signifying TRUE, is pushed onto the stack if it is odd, zero, signifying FALSE, is placed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#even and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2813

Source

pub(super) fn op_and(&mut self) -> Result<(), HintErrorKind>

Logical and.

AND[] (0x5A)

Pops: e1, e2 Pushes: Boolean value

Pops e1 and e2 off the stack and pushes onto the stack the result of a logical and of the two elements. Zero is returned if either or both of the elements are FALSE (have the value zero). One is returned if both elements are TRUE (have a non zero value).

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#logical-and and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2827

Source

pub(super) fn op_or(&mut self) -> Result<(), HintErrorKind>

Logical or.

OR[] (0x5B)

Pops: e1, e2 Pushes: Boolean value

Pops e1 and e2 off the stack and pushes onto the stack the result of a logical or operation between the two elements. Zero is returned if both of the elements are FALSE. One is returned if either one or both of the elements are TRUE (has a nonzero value).

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#logical-or and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2840

Source

pub(super) fn op_not(&mut self) -> Result<(), HintErrorKind>

Logical not.

NOT[] (0x5C)

Pops: e Pushes: (not e): logical negation of e

Pops e off the stack and returns the result of a logical NOT operation performed on e. If originally zero, one is pushed onto the stack if originally nonzero, zero is pushed onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#logical-not and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2853

Source§

impl Engine<'_>

Source

pub(super) fn op_getinfo(&mut self) -> Result<(), HintErrorKind>

Get information.

GETINFO[] (0x88)

Pops: selector: integer Pushes: result: integer

GETINFO is used to obtain data about the font scaler version and the characteristics of the current glyph. The instruction pops a selector used to determine the type of information desired and pushes a result onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#get-information and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6689

Source

pub(super) fn op_getvariation(&mut self) -> Result<(), HintErrorKind>

Get variation.

GETVARIATION[] (0x91)

Pushes: Normalized axes coordinates, one for each axis in the font.

GETVARIATION is used to obtain the current normalized variation coordinates for each axis. The coordinate for the first axis, as defined in the ‘fvar’ table, is pushed first on the stack, followed by each consecutive axis until the coordinate for the last axis is on the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#get-variation and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6813

Source

pub(super) fn op_getdata(&mut self) -> Result<(), HintErrorKind>

Get data.

GETDATA[] (0x92)

Pushes: 17

Undocumented and nobody knows what this does. FreeType just returns 17 for variable fonts and falls back to IDEF lookup otherwise.

See https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6851

Source§

impl Engine<'_>

Source

pub(super) fn op_flippt(&mut self) -> Result<(), HintErrorKind>

Flip point.

FLIPPT[] (0x80)

Pops: p: point number (uint32)

Uses the loop counter.

Flips points that are off the curve so that they are on the curve and points that are on the curve so that they are off the curve. The point is not marked as touched. The result of a FLIPPT instruction is that the contour describing part of a glyph outline is redefined.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#flip-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5002

Source

pub(super) fn op_fliprgon(&mut self) -> Result<(), HintErrorKind>

Flip range on.

FLIPRGON[] (0x81)

Pops: highpoint: highest point number in range of points to be flipped (uint32) lowpoint: lowest point number in range of points to be flipped (uint32)

Flips a range of points beginning with lowpoint and ending with highpoint so that any off the curve points become on the curve points. The points are not marked as touched.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#flip-range-on and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5056

Source

pub(super) fn op_fliprgoff(&mut self) -> Result<(), HintErrorKind>

Flip range off.

FLIPRGOFF[] (0x82)

Pops: highpoint: highest point number in range of points to be flipped (uint32) lowpoint: lowest point number in range of points to be flipped (uint32)

Flips a range of points beginning with lowpoint and ending with highpoint so that any on the curve points become off the curve points. The points are not marked as touched.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#flip-range-off and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5094

Source

pub(super) fn op_shp(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Shift point by the last point.

SHP[a] (0x32 - 0x33)

a: 0: uses rp2 in the zone pointed to by zp1 1: uses rp1 in the zone pointed to by zp0

Pops: p: point to be shifted

Uses the loop counter.

Shift point p by the same amount that the reference point has been shifted. Point p is shifted along the freedom_vector so that the distance between the new position of point p and the current position of point p is the same as the distance between the current position of the reference point and the original position of the reference point.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#shift-point-by-the-last-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5211

Source

pub(super) fn op_shc(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Shift contour by the last point.

SHC[a] (0x34 - 0x35)

a: 0: uses rp2 in the zone pointed to by zp1 1: uses rp1 in the zone pointed to by zp0

Pops: c: contour to be shifted

Shifts every point on contour c by the same amount that the reference point has been shifted. Each point is shifted along the freedom_vector so that the distance between the new position of the point and the old position of that point is the same as the distance between the current position of the reference point and the original position of the reference point. The distance is measured along the projection_vector. If the reference point is one of the points defining the contour, the reference point is not moved by this instruction.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#shift-contour-by-the-last-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5266

Source

pub(super) fn op_shz(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Shift zone by the last point.

SHZ[a] (0x36 - 0x37)

a: 0: uses rp2 in the zone pointed to by zp1 1: uses rp1 in the zone pointed to by zp0

Pops: e: zone to be shifted

Shift the points in the specified zone (Z1 or Z0) by the same amount that the reference point has been shifted. The points in the zone are shifted along the freedom_vector so that the distance between the new position of the shifted points and their old position is the same as the distance between the current position of the reference point and the original position of the reference point.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#shift-zone-by-the-last-pt and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5318

Source

pub(super) fn op_shpix(&mut self) -> Result<(), HintErrorKind>

Shift point by a pixel amount.

SHPIX (0x38)

Pops: amount: magnitude of the shift (F26Dot6) p1, p2,.. pn: points to be shifted

Uses the loop counter.

Shifts the points specified by the amount stated. When the loop variable is used, the amount to be shifted is put onto the stack only once. That is, if loop = 3, then the contents of the top of the stack should be point p1, point p2, point p3, amount. The value amount is expressed in sixty-fourths of a pixel.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#shift-point-by-a-pixel-amount and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5366

Source

pub(super) fn op_msirp(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Move stack indirect relative point.

MSIRP[a] (0x3A - 0x3B)

a: 0: do not set rp0 to p 1: set rp0 to p

Pops: d: distance (F26Dot6) p: point number

Makes the distance between a point p and rp0 equal to the value specified on the stack. The distance on the stack is in fractional pixels (F26Dot6). An MSIRP has the same effect as a MIRP instruction except that it takes its value from the stack rather than the Control Value Table. As a result, the cut_in does not affect the results of a MSIRP. Additionally, MSIRP is unaffected by the round_state.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-stack-indirect-relative-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5439

Source

pub(super) fn op_mdap(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Move direct absolute point.

MDAP[a] (0x2E - 0x2F)

a: 0: do not round the value 1: round the value

Pops: p: point number

Sets the reference points rp0 and rp1 equal to point p. If a=1, this instruction rounds point p to the grid point specified by the state variable round_state. If a=0, it simply marks the point as touched in the direction(s) specified by the current freedom_vector. This command is often used to set points in the twilight zone.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-direct-absolute-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5487

Source

pub(super) fn op_miap(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Move indirect absolute point.

MIAP[a] (0x3E - 0x3F)

a: 0: do not round the distance and don’t use control value cutin 1: round the distance and use control value cutin

Pops: n: CVT entry number p: point number

Moves point p to the absolute coordinate position specified by the nth Control Value Table entry. The coordinate is measured along the current projection_vector. If a=1, the position will be rounded as specified by round_state. If a=1, and if the device space difference between the CVT value and the original position is greater than the control_value_cut_in, then the original position will be rounded (instead of the CVT value.)

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-indirect-absolute-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5526

Source

pub(super) fn op_mdrp(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Move direct relative point.

MDRP[abcde] (0xC0 - 0xDF)

a: 0: do not set rp0 to point p after move 1: do set rp0 to point p after move b: 0: do not keep distance greater than or equal to minimum_distance 1: keep distance greater than or equal to minimum_distance c: 0: do not round distance 1: round the distance de: distance type for engine characteristic compensation

Pops: p: point number

MDRP moves point p along the freedom_vector so that the distance from its new position to the current position of rp0 is the same as the distance between the two points in the original uninstructed outline, and then adjusts it to be consistent with the Boolean settings. Note that it is only the original positions of rp0 and point p and the current position of rp0 that determine the new position of point p along the freedom_vector.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-direct-relative-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5610

Source

pub(super) fn op_mirp(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Move indirect relative point.

MIRP[abcde] (0xE0 - 0xFF)

a: 0: do not set rp0 to point p after move 1: do set rp0 to point p after move b: 0: do not keep distance greater than or equal to minimum_distance 1: keep distance greater than or equal to minimum_distance c: 0: do not round distance and do not look at control_value_cutin 1: round the distance and look at control_value_cutin de: distance type for engine characteristic compensation

Pops: n: CVT entry number p: point number

A MIRP instruction makes it possible to preserve the distance between two points subject to a number of qualifications. Depending upon the setting of Boolean flag b, the distance can be kept greater than or equal to the value established by the minimum_distance state variable. Similarly, the instruction can be set to round the distance according to the round_state graphics state variable. The value of the minimum distance variable is the smallest possible value the distance between two points can be rounded to. Additionally, if the c Boolean is set, the MIRP instruction acts subject to the control_value_cut_in. If the difference between the actual measurement and the value in the CVT is sufficiently small (less than the cut_in_value), the CVT value will be used and not the actual value. If the device space difference between this distance from the CVT and the single_width_value is smaller than the single_width_cut_in, then use the single_width_value rather than the outline or Control Value Table distance.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-indirect-relative-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5731

Source

pub(super) fn op_alignrp(&mut self) -> Result<(), HintErrorKind>

Align relative point.

ALIGNRP[] (0x3C)

Pops: p: point number (uint32)

Uses the loop counter.

Reduces the distance between rp0 and point p to zero. Since distance is measured along the projection_vector and movement is along the freedom_vector, the effect of the instruction is to align points.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#align-relative-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5882

Source

pub(super) fn op_isect(&mut self) -> Result<(), HintErrorKind>

Move point to intersection of two lines.

ISECT[] (0x0F)

Pops: b1: end point of line 2 b0: start point of line 2 a1: end point of line 1 a0: start point of line 1 p: point to move.

Puts point p at the intersection of the lines A and B. The points a0 and a1 define line A. Similarly, b0 and b1 define line B. ISECT ignores the freedom_vector in moving point p.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#moves-point-p-to-the-intersection-of-two-lines and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L5934

Source

pub(super) fn op_alignpts(&mut self) -> Result<(), HintErrorKind>

Align points.

ALIGNPTS[] (0x27)

Pops: p1: point number p2: point number

Makes the distance between point 1 and point 2 zero by moving both along the freedom_vector to the average of both their projections along the projection_vector.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#align-points and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6030

Source

pub(super) fn op_ip(&mut self) -> Result<(), HintErrorKind>

Interpolate point by last relative stretch.

IP[] (0x39)

Pops: p: point number

Uses the loop counter.

Moves point p so that its relationship to rp1 and rp2 is the same as it was in the original uninstructed outline. Measurements are made along the projection_vector, and movement to satisfy the interpolation relationship is constrained to be along the freedom_vector. This instruction is not valid if rp1 and rp2 have the same position on the projection_vector.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#interpolate-point-by-the-last-relative-stretch and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6065

Source

pub(super) fn op_iup(&mut self, opcode: u8) -> Result<(), HintErrorKind>

Interpolate untouched points through the outline.

IUP[a] (0x30 - 0x31)

a: 0: interpolate in the y-direction 1: interpolate in the x-direction

Considers a glyph contour by contour, moving any untouched points in each contour that are between a pair of touched points. If the coordinates of an untouched point were originally between those of the touched pair, it is linearly interpolated between the new coordinates, otherwise the untouched point is shifted by the amount the nearest touched point is shifted.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#interpolate-untouched-points-through-the-outline and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6391

Source

pub(super) fn op_utp(&mut self) -> Result<(), HintErrorKind>

Untouch point.

UTP[] (0x29)

Pops: p: point number (uint32)

Marks point p as untouched. A point may be touched in the x direction, the y direction, both, or neither. This instruction uses the current freedom_vector to determine whether to untouch the point in the x-direction, the y direction, or both. Points that are marked as untouched will be moved by an IUP (interpolate untouched points) instruction. Using UTP you can ensure that a point will be affected by IUP even if it was previously touched.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#untouch-point and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L6222

Source

fn set_on_curve_for_range(&mut self, on: bool) -> Result<(), HintErrorKind>

Helper for FLIPRGON and FLIPRGOFF.

Source§

impl Engine<'_>

Source

pub(super) fn op_round(&mut self) -> Result<(), HintErrorKind>

Round value.

ROUND[ab] (0x68 - 0x6B)

Pops: n1 Pushes: n2

Rounds a value according to the state variable round_state while compensating for the engine. n1 is popped off the stack and, depending on the engine characteristics, is increased or decreased by a set amount. The number obtained is then rounded and pushed back onto the stack as n2.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#round-value and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3143

Source§

impl Engine<'_>

Source

pub(super) fn op_dup(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_pop(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_clear(&mut self) -> Result<(), HintErrorKind>

Source

pub(super) fn op_swap(&mut self) -> Result<(), HintErrorKind>

Swap the top two elements on the stack.

SWAP[] (0x23)

Pops: e2, e1 Pushes: e1, e2

Swaps the top two elements of the stack making the old top element the second from the top and the old second element the top element.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#swap-the-top-two-elements-on-the-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2689

Source

pub(super) fn op_depth(&mut self) -> Result<(), HintErrorKind>

Returns the depth of the stack.

DEPTH[] (0x24)

Pushes: n; number of elements

Pushes n, the number of elements currently in the stack onto the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#returns-the-depth-of-the-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2707

Source

pub(super) fn op_cindex(&mut self) -> Result<(), HintErrorKind>

Copy the indexed element to the top of the stack.

CINDEX[] (0x25)

Pops: k: stack element number Pushes: ek: indexed element

Puts a copy of the kth stack element on the top of the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#copy-the-indexed-element-to-the-top-of-the-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3232

Source

pub(super) fn op_mindex(&mut self) -> Result<(), HintErrorKind>

Move the indexed element to the top of the stack.

MINDEX[] (0x26)

Pops: k: stack element number Pushes: ek: indexed element

Moves the indexed element to the top of the stack.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#move-the-indexed-element-to-the-top-of-the-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3199

Source

pub(super) fn op_roll(&mut self) -> Result<(), HintErrorKind>

Roll the top three stack elements.

ROLL[] (0x8a)

Pops: a, b, c (top three stack elements) Pushes: b, a, c (elements reordered)

Performs a circular shift of the top three objects on the stack with the effect being to move the third element to the top of the stack and to move the first two elements down one position. ROLL is equivalent to MINDEX[] 3.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#roll-the-top-three-stack-elements and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3258

Source

pub(super) fn op_push( &mut self, operands: &InlineOperands<'_>, ) -> Result<(), HintErrorKind>

Push data onto the interpreter stack.

NPUSHB[] (0x8a)

Takes n unsigned bytes from the instruction stream, where n is an unsigned integer in the range (0..255), and pushes them onto the stack. n itself is not pushed onto the stack.

NPUSHW[] (0x41)

Takes n 16-bit signed words from the instruction stream, where n is an unsigned integer in the range (0..255), and pushes them onto the stack. n itself is not pushed onto the stack.

PUSHB[abc] (0xB0 - 0xB7)

Takes the specified number of bytes from the instruction stream and pushes them onto the interpreter stack. The variables a, b, and c are binary digits representing numbers from 000 to 111 (0-7 in binary). Because the actual number of bytes (n) is from 1 to 8, 1 is automatically added to the ABC figure to obtain the actual number of bytes pushed.

PUSHW[abc] (0xB8 - 0xBF)

Takes the specified number of words from the instruction stream and pushes them onto the interpreter stack. The variables a, b, and c are binary digits representing numbers from 000 to 111 (0-7 binary). Because the actual number of bytes (n) is from 1 to 8, 1 is automatically added to the abc figure to obtain the actual number of bytes pushed.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#pushing-data-onto-the-interpreter-stack and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3858

Source§

impl Engine<'_>

Source

pub(super) fn op_rs(&mut self) -> Result<(), HintErrorKind>

Read store.

RS[] (0x43)

Pops: location: Storage Area location Pushes: value: Storage Area value

This instruction reads a 32 bit value from the Storage Area location popped from the stack and pushes the value read onto the stack. It pops an address from the stack and pushes the value found in that Storage Area location to the top of the stack. The number of available storage locations is specified in the maxProfile table in the font file.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#read-store and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L2975

Source

pub(super) fn op_ws(&mut self) -> Result<(), HintErrorKind>

Write store.

WS[] (0x42)

Pops: value: Storage Area value, location: Storage Area location

This instruction writes a 32 bit value into the storage location indexed by locations. It works by popping a value and then a location from the stack. The value is placed in the Storage Area location specified by that address. The number of storage locations is specified in the maxProfile table in the font file.

See https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#write-store and https://gitlab.freedesktop.org/freetype/freetype/-/blob/57617782464411201ce7bbc93b086c1b4d7d84a5/src/truetype/ttinterp.c#L3000

Source§

impl<'a> Engine<'a>

Source

pub fn new( outlines: &Outlines<'_>, program: ProgramState<'a>, graphics: RetainedGraphicsState, definitions: DefinitionState<'a>, cvt: impl Into<Cvt<'a>>, storage: impl Into<Storage<'a>>, value_stack: ValueStack<'a>, twilight: Zone<'a>, glyph: Zone<'a>, axis_count: u16, coords: &'a [F2Dot14], is_composite: bool, ) -> Self

Source

pub fn backward_compatibility(&self) -> bool

Source

pub fn retained_graphics_state(&self) -> &RetainedGraphicsState

Auto Trait Implementations§

§

impl<'a> Freeze for Engine<'a>

§

impl<'a> RefUnwindSafe for Engine<'a>

§

impl<'a> Send for Engine<'a>

§

impl<'a> Sync for Engine<'a>

§

impl<'a> Unpin for Engine<'a>

§

impl<'a> !UnwindSafe for Engine<'a>

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