fn decode_font_op(chr: char, font_id: DecodeFontId) -> Result<(DecoderState, Option<Draw>), DecoderError> {
        use PartialResult::*;

        // Decode the font ID first
        let font_id = match font_id {
            MatchMore(font_id) => { 
                let font_id = Self::decode_font_id(chr, font_id)?;
                return Ok((DecoderState::FontOp(font_id), None));
            }

            FullMatch(font_id) => font_id
        };

        // The character following the font ID determines what state we move on to
        match chr {
            'd' => Ok((DecoderState::FontOpData(font_id), None)),
            'S' => Ok((DecoderState::FontOpSize(font_id, String::new()), None)),
            'L' => Ok((DecoderState::FontOpLayoutText(font_id, DecodeString::new()), None)),
            'G' => Ok((DecoderState::FontOpDrawGlyphs(font_id, DecodeGlyphPositions::new()), None)),

            _   => Err(DecoderError::InvalidCharacter(chr))
        }
    }
///
/// Decodes a FontOp command
///
/// These all start with a font ID, followed by an operation identifier which determines how the
/// rest of the decoding should go
///
Decodes a FontOp command
These all start with a font ID, followed by an operation identifier which determines how the
rest of the decoding should go
Decodes a FontOp command These all start with a font ID followed by an operation identifier which determines how the rest of the decoding should go
fn decode_font_op(chr: char, font_id: DecodeFontId) -> Result<(DecoderState, Option<Draw>), DecoderError> {
        use PartialResult::*;
        // Decode the font ID first
        let font_id = match font_id {
            MatchMore(font_id) => { 
                let font_id = Self::decode_font_id(chr, font_id)?;
                return Ok((DecoderState::FontOp(font_id), None));
            }
            FullMatch(font_id) => font_id
        };
        // The character following the font ID determines what state we move on to
        match chr {
            'd' => Ok((DecoderState::FontOpData(font_id), None)),
            'S' => Ok((DecoderState::FontOpSize(font_id, String::new()), None)),
            'L' => Ok((DecoderState::FontOpLayoutText(font_id, DecodeString::new()), None)),
            'G' => Ok((DecoderState::FontOpDrawGlyphs(font_id, DecodeGlyphPositions::new()), None)),
            _   => Err(DecoderError::InvalidCharacter(chr))
        }
    }
fn decode_font_op ( chr : char , font_id : DecodeFontId ) -> Result < ( DecoderState , Option < Draw > ) , DecoderError > { use PartialResult :: * ; // Decode the font ID first let font_id = match font_id { MatchMore ( font_id ) => { let font_id = Self :: decode_font_id ( chr , font_id ) ? ; return Ok ( ( DecoderState :: FontOp ( font_id ) , None ) ) ; } FullMatch ( font_id ) => font_id } ; // The character following the font ID determines what state we move on to match chr { 'd' => Ok ( ( DecoderState :: FontOpData ( font_id ) , None ) ) , 'S' => Ok ( ( DecoderState :: FontOpSize ( font_id , String :: new ( ) ) , None ) ) , 'L' => Ok ( ( DecoderState :: FontOpLayoutText ( font_id , DecodeString :: new ( ) ) , None ) ) , 'G' => Ok ( ( DecoderState :: FontOpDrawGlyphs ( font_id , DecodeGlyphPositions :: new ( ) ) , None ) ) , _ => Err ( DecoderError :: InvalidCharacter ( chr ) ) } }
Decodes a FontOp command
These all start with a font ID, followed by an operation identifier which determines how the
rest of the decoding should go
Decodes a FontOp command These all start with a font ID followed by an operation identifier which determines how the rest of the decoding should go
chr
char
font_id
DecodeFontId