mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-01 12:07:15 +08:00
Add code to drop single-segment strokes
This commit is contained in:
@ -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]) {
|
||||
|
||||
Reference in New Issue
Block a user