Comments (6)
It seems that you've already separated your character into strokes - at least, that path you linked looks like a single stroke. Is that right? If so, please take a look at:
https://github.com/skishore/makemeahanzi/blob/tool/lib/median_util.js
In that file, findStrokeMedian takes an SVG path and returns an approximate median (with many points on it), and normalizeForMatch uses the simplify library to reduce that median to an a further approximation with fewer points. I hope that helps!
The tool code isn't licensed yet, mainly because I don't think it's in a great state to be used by other people, but at least those libraries are decent. If you find that that code works for your case then I'll add an MIT license.
from makemeahanzi.
Thanks very much for your reply. I extracted the findStrokeMedian code and it perfectly with the data above. However, I was hoping to use some hirigana stroke data so I could use it with hanzi-writer but the path data for hirigana strokes has c commands in the path data which isn't accepted.
Is there any way I could get hirigana stroke data in the makemeahanzi format?
https://github.com/TomClarkson/makemeahanzidata/blob/master/src/index.js#L26
from makemeahanzi.
I've written some hacks that are partially working for rendering the cubic elements. They're not at a level at which I'd want to commit them to the branch itself, but they may be usable for your case. Be warned that most methods in svg.js still don't handle cubics well; I just got convertSVGPathToPaths and computePolygonApproximation sort of working:
https://github.com/skishore/makemeahanzi/commits/cubic
However, that path that you linked doesn't seem to be a proper stroke. It doesn't loop back on itself, for starters: https://codepen.io/anon/pen/eRBKoN Where did you get that data from?
from makemeahanzi.
Hi I got the stroke data from kanjivg I thought if I could get the stroke from the one character to work then I could use hirigana and katakana data from KanjiVG. Here is the data for the one character https://github.com/KanjiVG/kanjivg/blob/master/kanji/04e00.svg. I guess the data is too different to be used because KanjiVG data is just straight lines. (Sorry I don't know much about SVG).
Could the hirigana data be extracted from the Arphic font? I'm not sure how to do this. If not or it is difficult please close this issue. Thanks again.
from makemeahanzi.
Gotcha. The Arphic font only contains hanzi/kanji, so no hiragana there. However, the KanjiVG data is basically already in the "median" form - the strokes that the provide are lines, not outlines.
Basically, for the KanjiVG data, if you take those changes I made, comment out the "Path has open contour" assertion (which only applies to outlined strokes), and then call "GetPolygonApproximation", you'll have a median already.
from makemeahanzi.
I'm not sure to call them GetPolygonApproximation from sorry, it is over my head.
https://github.com/TomClarkson/makemeahanzidata/blob/master/src/makemeahanzi/svg.js#L91
from makemeahanzi.
Related Issues (20)
- 试用了一下,小程序报eval安全策略的错误
- 如何创建不存在的汉字,让我们一起做贡献吧 HOT 10
- adopt for Dart and Flutter HOT 3
- The radical of "平" is wrong
- All this data is for simplified or traiditional Characters?
- Could you update this branch tool meteor version
- 翰 The stroke sequence is wrong
- Wrong stroke order for 隨
- 葉 stroke order
- How do other sites draw so many characters that aren't in these dictionaries? HOT 2
- Fill the stroke with a color gradient based on the stroke animation direction HOT 1
- What's the logic behind the ordering of the two files? HOT 1
- Missing strokes for 齁 嘡 藠 嗞 馃 瘆 拃 揳 齉 抔
- The number of strokes in Chinese character classification
- Any method to draw strokes with python instead of web page?
- 如何添加英文字母,或者数字的数据呢?~~~用工具貌似无法进行下一步 HOT 3
- 大佬们,这个项目如何启动啊,想修改部分汉字的笔画顺序,有没有办法啊
- How should I cite this work? HOT 2
- 如何判断是否支持某个汉字? HOT 1
- Can't run makemeahanzi-tool, told me certificate has expired HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from makemeahanzi.