mirror of
https://github.com/skishore/makemeahanzi.git
synced 2025-11-02 13:01:40 +08:00
Integrate stroke_caps with strokes stage
This commit is contained in:
@ -2,6 +2,7 @@ import {getAnimationData} from '/lib/animation';
|
||||
import {assert, getPWD, Point} from '/lib/base';
|
||||
import {cjklib} from '/lib/cjklib';
|
||||
import {Glyphs} from '/lib/glyphs';
|
||||
import {fixStrokes} from '/lib/stroke_caps/fixStrokes';
|
||||
import {stroke_extractor} from '/lib/stroke_extractor';
|
||||
import {svg} from '/lib/svg';
|
||||
|
||||
@ -18,6 +19,13 @@ const addSimplifiedAndTraditionalFields = (glyph) => {
|
||||
Glyphs.save(glyph);
|
||||
}
|
||||
|
||||
const addStrokeCaps = (glyph) => {
|
||||
const raw = glyph.stages.strokes;
|
||||
if (raw.raw || raw.corrected) return;
|
||||
glyph.stages.strokes = {corrected: fixStrokes(raw), raw};
|
||||
Glyphs.save(glyph);
|
||||
}
|
||||
|
||||
const checkStrokeExtractorStability = (glyph) => {
|
||||
const strokes = stroke_extractor.getStrokes(
|
||||
glyph.stages.path, glyph.stages.bridges);
|
||||
@ -52,7 +60,7 @@ const dumpGlyph = (dictionary, graphics) => (glyph) => {
|
||||
const data = cjklib.getCharacterData(glyph.character);
|
||||
const pinyin = (glyph.metadata.pinyin || data.pinyin || '')
|
||||
.split(',').map((x) => x.trim()).filter((x) => x);
|
||||
const strokes = order.map((x) => glyph.stages.strokes[x.stroke]);
|
||||
const strokes = order.map((x) => glyph.stages.strokes.corrected[x.stroke]);
|
||||
const medians = order.map((x) => x.median);
|
||||
strokes.map((x) => assert(x));
|
||||
medians.map((x) => assert(x));
|
||||
|
||||
Reference in New Issue
Block a user