Jitai (字体): The font randomizer that fits

Jitai actually has a measure in place to check that all characters in the word exist within the font – it’s lines 106 through 131 in the script. This has worked perfectly fine until just recently, but judging by your reports, it’s somehow broken! I suspect this might be down to recent browser updates that broke the approach used: especially Google Chrome breaks compatibility all the time. It may even work just fine in, say, Firefox.

I unfortunately won’t have time to debug and fix this anytime soon, but if anyone would like to fork and fix it on GitHub, I’d be happy to merge the fix in!

(cc @btlindsay, @Thud, @saibaneko, @Hubbit200)

2 Likes

Hi obskyr,

First of all, thanks a lot for making this plugin, it’s really amazing.

I think the glyph support detection broke because blank canvases are no longer generating the same data url.

Please take a look at https://gist.github.com/yannickboesmans/bfdcfb82ca3ee6ae854d279ddf9fcceb/revisions for a potential fix.
It uses an alternative method to check whether the canvas is blank.

It seems like I can’t open a pull request on github gists, so you may have to just copy the code into the main repo.

Thanks again for making this great plugin!

9 Likes

Btw, this still works in 2022. Just installed Tampermonkey and the Jitai script, added fonts and just works. No configuration needed. Just magic.

2 Likes

Is this PC only or could it work on mobile? I’m super unfamiliar with scripts and coding so I have no idea haha…

It’s not PC only, but it requires a browser with userscript support, so on mobile you’d need Firefox (I heard it supports extensions, apparently including Tampermonkey) or something like Kiwi (which supports Chrome extensions). It won’t work with non-browser apps like Flying Durtles or Tsurukame.

1 Like

Okay great! thank you so much!! I’ve been using chrome, so I’ll check kiwi out. I’ll definitely look into getting the script too, it seems like a really good addon to have!

1 Like

Is there a way I can diagnose what current font is displayed for something? It seems I’m having issues on a font suddenly with the 々 not coming up for some reason

Not sure how familiar you are with HTML, but there’s a relatively easy way to do that. If you right-click the word and click “Inspect” in Chrome or Firefox (I guess other browsers also have something similar these days), you’ll get a window with some HTML code, and one line of it will be highlighted. The line should look something like this:
<span lang="ja" style="font-family: nagayama_kai;">花火</span>
The part after “font-family:” is the font used for the current review.

1 Like

I think I found out how to do it. I’ve commented out the offending fonts but if it keeps happening, it may not be font specific. It’s strange because I’ve had zero issues with my font sets for like 2 months.

Update, it doesn’t seem to be specific to fonts. That is unfortunate. Since it didn’t occur before, ever, with all of these fonts I’ve been using.

1 Like

Jitai is acting up for me…
Got one of my reviews wrong because the second kanji didn’t show up. Left is no mouse hover, right is while I’m hovering my mouse.
Capture1 Capture

3 Likes

You could try the fork @yackeroeni did: Jitai (字体): A fairly full-featured font randomizer for WaniKani. · GitHub (when I click on the “raw” on the jitai.user.js file, Chrome redirects me to the tampermonkey install prompt directly. I don’t know if it works the same on FF)

I currently don’t have this script installed, so I don’t know if the fix works :person_shrugging:

4 Likes

So far so good, thanks!

2 Likes

Jitai hasn’t been working for me for a while… the font style changes slightly (from bold to unbold it seems), but basically looks the same. I have tried to reinstall the script from Github using tamper monkey but the issue hasn’t been resolved. It shows up on the Tamper Monkey dashboard as being installed but it is still faulty in my reviews. I have Script Compatibility mode turned on because without it the Wanikani Reorder Ultimate 2 doesn’t work. Does anyone know how to fix this?

hover font
default font

This fix seems to work perfectly.

お疲れさまでした!

1 Like

Just wanted to let you know that your fix also worked for me :+1:

Very cool script. Works fine so far on my Ubuntu machine.
This exposure to random fonts helps make WaniKani a little more realistic and useful.

1 Like

The fix worked for me too I think. Glad I wasn’t the only one with a one off random issue

If people are looking for a good variety of different fonts, I put together this list for myself. It consists of default Windows fonts, freely available fonts, or, in a couple cases, formerly freely available fonts. I’m going to avoid uploading the fonts themselves just in case, but most of these should be out there. Worth noting that of WaniKani’s characters, most fonts don’t include these symbols: 罒灬乁. A few of the fonts listed will be missing significantly more, but as long as the script you’re using can handle that, it doesn’t really matter. I’m including screenshots with a nonsense mix of kanji so you can see what things look like.

Free / Formerly Free Fonts (in order of readability)

  • 02UtsukushiMincho - Very standard mincho (serif-style), but free font so hey. You may not need this since WaniKani’s default is a similar mincho.
    image

  • Epson Kyoukashotai (EPSON 教科書体M) - Formerly free kyoukasho (textbook) font. Very pleasant and easy to read. Textbook fonts are nice if you want to see which type of strokes are used where, as they’re used for JP school where kids are learning this. If you don’t write, or don’t care about writing absolutely correctly, you may not care.
    image

  • Epson Seikaishotai (EPSON 正楷書体M) - Also very nice. Like a kyoukasho font but thicker lines.
    image

  • YOzFontM90 - maybe a bridge between clean font and handwriting. Shows proper stroke types mostly.
    image

  • A-OTF ShinmaruGo Pro B (A-OTF 新丸ゴ Pro B) - Bold, rounded, gothic style. Quite pleasant, and pretty easy still.
    image

  • Hakusyu Kaisyo Extra Bold (白舟極太楷書教漢) - A more brush-stroke-y style, looks nice. Missing English and most of the higher level kanji.
    image

  • Chihaya Jyun - Easy, small, pleasantly different.
    image

  • S2G Moon font - Handwriting-y, a little slanted, pretty easy.
    image

  • Hachi Maru Pop Regular - Playful, rounded, space-filling. easy except for some of the rounding maybe.
    image

  • Aquafont - Crude/quirky, sorta thick lines.
    image

  • Nagayama-kai - Very brush stroke-y, very cool. A little small, and a little more difficult.
    image

  • SoukouMincho - Nice cause it’s different. A little hard to read between the thin horizontal and thick vertical lines.
    image

  • Darts Font - Slightly challenging, handwriting-y. Missing a few kanji.
    image

  • AsobiMemogaki - A little eroded-looking, but easy enough. Missing a few kanji.
    image

  • CP&U-Fo - Bold and blocky with rounded edges. The bolding and shapes make it a little challenging.
    image

  • AK-Japonesque - Who decided to make this and randomly include jinmeiyou while excluding basic characters like 語? Looks pretty cool though, like a weird rounded version of brush strokes.
    image

  • FC-Flower - A little harder to make out, looks like marker handwriting. Missing a lot of kanji.
    image

  • Chihaya Kaku (ちはや角) - Angular, bold font. Missing a few kanji.
    image

  • PixelMplus12 Regular - Pixel font, but only gets hard to read when it gets very dense.
    image

  • ArmedLemon - Scraggly, has character, a little difficult.
    image

  • AoyagiReisyoSimo2 (青柳隷書SIMO2), AoyagiKouzanFont2OTF - Very cool. Classical style. Gets very small and brush stroke-y at times, so hard to read.
    image

  • GN-KMBFont-UB-NewstyleKanaB - BIG. BOLD. INTERESTING. Remind me of Kill la Kill’s font. Missing a few kanji.
    image

  • Nagurigaki Crayon - Unique and surprisingly hard to read.
    image

  • KouzanBrushFontGyousyo - Calligraphy font, so cool but also hard. Common to see this style on restaurant signs and the like, so good to practice.
    image

  • ZinHenaKokuryu - More brush stroke-y than full calligraphy, but still
    very hard. Warped-looking. Missing a few kanji.
    image

  • ZinHenaBokuryu - Different style of the above, slightly harder IMO. Missing a few kanji.
    image

  • MisakiGothic - Fine to basically impossible depending on the kanji density. 7x7 pixels. Imagine having to read dragon quest in this size font: basically just context!
    image

Bonus

  • KouzanBrushFontSousyo - Basically unreadable, but cool looking. Makes some vague sense if you know stroke order, but only vague. May see it on signs and things as well, but even Japanese people can’t read it most of the time. I included it in the list because it’s interesting, but I actually deleted it from my script because I never could read it.
    image

Windows Fonts (some of these might be JP Windows-specific):

  • Yu Gothic Light (游ゴシック Light) - Thin lines are good for practicing that look.
    image

  • Yu Mincho Regular (游明朝) - Basic but nice mincho font. Comes with JP Windows.
    image

  • UD Digi Kyokasho NK-R (UD デジタル 教科書体 NK-R) - Comes with JP Windows, looks very nice. Can’t see stroke type well but otherwise a bolder kyoukasho font.
    image

  • HGPKyoukashotai (HGP教科書体) - Great kyoukasho font. Comes with JP Windows.
    image

  • HGPSoeiKakupoptai (HGP創英角ポップ体) - Comes with JP Windows. The comic sans of Japanese. Maybe I’ve seen it too much but I hate it personally.
    image

10 Likes

I might look for fonts in the CDN / online; otherwise free to share. It is possible to host the fonts, and link to [Userscript] WK Read that if you can if the fonts are truly free, and cannot be found online yet.

It is also possible to modify Jitai to download online fonts on the go. (which will be slow on first load, but maybe fixable with font-display: swap)

1 Like

By the way, if you’re using Brave and have fingerprint blocking set to strict, it doesn’t allow measuring font size and none of the fonts get loaded (which is the point of the feature). Setting blocking to normal lets it work though.

3 Likes