Skip to content

Close Path not recognized if there is no space #216

@JoachimM7

Description

@JoachimM7

I have the following Path: "...ZM...". NSScanner interprets this as a "ZM" command. The output is weird ;)

My workaround for SVGParser.swift at lines 1053:

        repeat {
            scanner.scanCharacters(from: set, into: &pathCommandName)
			if pathCommandName?.length == 2 {	// two commands without space, for example "ZM"
				let command1 = pathCommandName!.substring(to: 1)
				pathCommands.append(
					PathCommand(
						type: getCommandType(command1 as String),
						expression: "",
						absolute: isAbsolute(command1 as String)
					)
				)
				pathCommandName = pathCommandName!.substring(from: 1) as NSString
			}
            scanner.scanUpToCharacters(from: set, into: &pathCommandValues)

Maybe there is a nicer possibility? I don't really know NSScanner

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions