Add code to drop single-segment strokes

This commit is contained in:
Shaunak Kishore
2015-09-13 16:41:01 -04:00
parent 95053df1e0
commit 42eaadfd8a

View File

@ -431,8 +431,16 @@ function extract_stroke(paths, endpoint_map, bridge_adjacency, log,
if (self_intersecting) {
log.push(['error', 'Extracted a self-intersecting stroke.']);
}
var num_segments_on_path = 0;
for (var index in visited) {
extracted_indices[index] = true;
num_segments_on_path += 1;
}
// Single-segment strokes may be due to graphical artifacts in the font.
// We drop them to remove these artifacts.
if (num_segments_on_path === 1) {
log.push(['success', 'Dropping single-segment stroke.']);
return undefined;
}
return result;
} else if (extracted_indices[key] || visited[key]) {