Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support Japanese Characters #2

Open
gajewsk2 opened this issue Dec 18, 2018 · 6 comments
Open

Feature request: Support Japanese Characters #2

gajewsk2 opened this issue Dec 18, 2018 · 6 comments

Comments

@gajewsk2
Copy link

gajewsk2 commented Dec 18, 2018

Would it be possible to load the data mentioned here: skishore/makemeahanzi#18, https://raw.githubusercontent.com/parsimonhi/animCJK/master/graphicsJa.txt
into the hanzi writer data for use with the hanzi writer library.

@chanind
Copy link
Owner

chanind commented Jun 12, 2019

ack I'm really sorry I somehow missed this comment! Those do look compatible with Hanzi Writer. This looks really cool! I'll see if i can put together a version of the data repo based on the JA graphics from animCJK.

@chanind
Copy link
Owner

chanind commented Aug 12, 2019

Apologies for the extreme delay on this. I put a repo up with Japanese data from animCJK here: https://github.com/chanind/hanzi-writer-data-jp. You can use this in Hanzi Writer via a custom charDataLoader function, like below:

HanziWriter.create('target-div', '私', {
  width: 400,
  height: 400,
  charDataLoader: (char, onLoad, onError) => {
    fetch(`https://cdn.jsdelivr.net/npm/hanzi-writer-data-jp@0/${char}.json`)
      .then(res => res.json())
      .then(onLoad)
      .catch(onError);
  }
})

This Japanese data is limited compared to the Chinese currently due to:

  • The data does not support radicals yet
  • The data does not have capped strokes, so there are sharp edges where strokes intersect

I'll work on tidying this up before making an official release in HanziWriter adding first-class support for this data. I also want to double-check with animCJK that using the data this way is alright.

@Anrai
Copy link

Anrai commented Sep 26, 2019

Hello, author. Thank you very much for your works, It is great! but I have some problems now. Some Chinese characters do not exist in your [email protected], May I ask if it is possible to increase? Thank you!

@JhonnySalles
Copy link

@Anrai

To get around this problem, I do the query on the Japanese IP first, if there is an error to load, the function HanziWriter.create executes a new call on the onLoadCharDataError but on the Chinese IP.

With that I got around the problem of not finding the character, when it doesn't find a small leg at first, but it works normally.

I believe that the correct thing would be to increase the number of characters in Japanese, but as long as it does not happen you can solve the problem.

The following example images.

image

image

@chanind
Copy link
Owner

chanind commented Jun 22, 2020

This is a great idea, thanks for sharing! Hopefully we can get something like this built-in to Hanzi Writer so it's easier to work with Japanese characters without needing to do these workarounds.

@JhonnySalles
Copy link

Yes, it was a good change, there is only the problem of delay between loading when there is no kanji in the Japanese set. Despite this 1 or 2 second delay, everything works correctly.

From what I realized there are very few that do not exist, but studying the JLPT from 1 to 5, I noticed that there are some missing, even containing 2 thousand kanji.

I have a dictionary that works with javascript that presents popup for kanji. The name is "_kanjax_with_koohii", it has 3,000 kanji in it, you could take them into account to import Chinese kanji to Japanese.

image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants
@chanind @Anrai @gajewsk2 @JhonnySalles and others