pub struct ComponentFlags(pub u16);
Expand description

Component flags.

Tuple Fields§

§0: u16

Implementations§

Examples found in repository?
src/glyph_data.rs (line 305)
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
    fn read<T: Tape>(tape: &mut T, flags: ComponentFlags) -> Result<Self> {
        match (flags.are_arguments_words(), flags.are_arguments_xy()) {
            (true, true) => {
                let x = tape.take::<i16>()?;
                let y = tape.take::<i16>()?;
                Ok(Arguments::Offsets(x, y))
            }
            (false, true) => {
                let x = tape.take::<i8>()? as i16;
                let y = tape.take::<i8>()? as i16;
                Ok(Arguments::Offsets(x, y))
            }
            (true, false) => {
                let i = tape.take::<u16>()?;
                let j = tape.take::<u16>()?;
                Ok(Arguments::Indices(i, j))
            }
            (false, false) => {
                let i = tape.take::<u8>()? as u16;
                let j = tape.take::<u8>()? as u16;
                Ok(Arguments::Indices(i, j))
            }
        }
    }
Examples found in repository?
src/glyph_data.rs (line 305)
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
    fn read<T: Tape>(tape: &mut T, flags: ComponentFlags) -> Result<Self> {
        match (flags.are_arguments_words(), flags.are_arguments_xy()) {
            (true, true) => {
                let x = tape.take::<i16>()?;
                let y = tape.take::<i16>()?;
                Ok(Arguments::Offsets(x, y))
            }
            (false, true) => {
                let x = tape.take::<i8>()? as i16;
                let y = tape.take::<i8>()? as i16;
                Ok(Arguments::Offsets(x, y))
            }
            (true, false) => {
                let i = tape.take::<u16>()?;
                let j = tape.take::<u16>()?;
                Ok(Arguments::Indices(i, j))
            }
            (false, false) => {
                let i = tape.take::<u8>()? as u16;
                let j = tape.take::<u8>()? as u16;
                Ok(Arguments::Indices(i, j))
            }
        }
    }
Examples found in repository?
src/glyph_data.rs (line 341)
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    fn read<T: Tape>(tape: &mut T, flags: ComponentFlags) -> Result<Self> {
        if flags.has_scalar_scale() {
            Ok(Options::Scalar(tape.take()?))
        } else if flags.has_vector_scale() {
            Ok(Options::Vector(tape.take()?, tape.take()?))
        } else if flags.has_matrix_scale() {
            Ok(Options::Matrix(
                tape.take()?,
                tape.take()?,
                tape.take()?,
                tape.take()?,
            ))
        } else {
            Ok(Options::None)
        }
    }
Examples found in repository?
src/glyph_data.rs (line 210)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
    fn read<T: Tape>(tape: &mut T, contour_count: i16) -> Result<Self> {
        if contour_count < -1 {
            raise!("found a malformed glyph");
        }
        if contour_count >= 0 {
            return Ok(Description::Simple(
                tape.take_given(contour_count as usize)?,
            ));
        }
        let mut components = vec![];
        let mut component_count = 0;
        let mut has_more_components = true;
        let mut has_instructions = false;
        while has_more_components {
            components.push(tape.take::<Component>()?);
            has_instructions |= components[component_count].flags.has_instructions();
            has_more_components = components[component_count].flags.has_more_components();
            component_count += 1;
        }
        let instruction_size = if has_instructions {
            tape.take::<u16>()?
        } else {
            0
        };
        let instructions = tape.take_bytes(instruction_size as usize)?;
        Ok(Description::Composite(CompositeDescription {
            components: components,
            instruction_size: instruction_size,
            instructions: instructions,
        }))
    }
Examples found in repository?
src/glyph_data.rs (line 343)
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    fn read<T: Tape>(tape: &mut T, flags: ComponentFlags) -> Result<Self> {
        if flags.has_scalar_scale() {
            Ok(Options::Scalar(tape.take()?))
        } else if flags.has_vector_scale() {
            Ok(Options::Vector(tape.take()?, tape.take()?))
        } else if flags.has_matrix_scale() {
            Ok(Options::Matrix(
                tape.take()?,
                tape.take()?,
                tape.take()?,
                tape.take()?,
            ))
        } else {
            Ok(Options::None)
        }
    }
Examples found in repository?
src/glyph_data.rs (line 345)
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
    fn read<T: Tape>(tape: &mut T, flags: ComponentFlags) -> Result<Self> {
        if flags.has_scalar_scale() {
            Ok(Options::Scalar(tape.take()?))
        } else if flags.has_vector_scale() {
            Ok(Options::Vector(tape.take()?, tape.take()?))
        } else if flags.has_matrix_scale() {
            Ok(Options::Matrix(
                tape.take()?,
                tape.take()?,
                tape.take()?,
                tape.take()?,
            ))
        } else {
            Ok(Options::None)
        }
    }
Examples found in repository?
src/glyph_data.rs (line 209)
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
    fn read<T: Tape>(tape: &mut T, contour_count: i16) -> Result<Self> {
        if contour_count < -1 {
            raise!("found a malformed glyph");
        }
        if contour_count >= 0 {
            return Ok(Description::Simple(
                tape.take_given(contour_count as usize)?,
            ));
        }
        let mut components = vec![];
        let mut component_count = 0;
        let mut has_more_components = true;
        let mut has_instructions = false;
        while has_more_components {
            components.push(tape.take::<Component>()?);
            has_instructions |= components[component_count].flags.has_instructions();
            has_more_components = components[component_count].flags.has_more_components();
            component_count += 1;
        }
        let instruction_size = if has_instructions {
            tape.take::<u16>()?
        } else {
            0
        };
        let instructions = tape.take_bytes(instruction_size as usize)?;
        Ok(Description::Composite(CompositeDescription {
            components: components,
            instruction_size: instruction_size,
            instructions: instructions,
        }))
    }

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
Formats the value using the given formatter. Read more
Converts to this type from the input type.
This method tests for self and other values to be equal, and is used by ==.
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Read a value.

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
Converts the given value to a String. 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.