Jitai (字体): The font randomizer that fits


#321

Before you answer it does

  • Changed font by default
  • Original font on hover.

After you answer it does

  • Original font by default
  • Changed font on hover

Is that not what you’re seeing?


#322

Yes. Usually. Now I wonder… maybe my mouse cursor was just hanging over it by accident ? … it turns almost invisible at that point, so that might be it. I’ll keep an eye out. Thanks again!


#323

I’ve seen a bug similar to what you describe in an old version of Jitai, so… it might also be that, coming back to haunt me. I fixed it ages ago, though, so I’d be surprised. If it happens again, let me know!

Thanks for enjoying Jitai! :laughing:


#324

Thank you so much for making this - I installed this earlier today after having finished my reviews (and lessons are currently at 0 too). I just came back for a quick review and, having totally forgotten that I’d installed this script, was convinced for a solid 5 seconds that I’d accidentally clicked new lessons rather than review! This script really forces you to deeply process the kanji which can only be a good thing!

Edit: Here’s an article from a few years ago that confirms my last statement: http://www.nytimes.com/2011/04/19/health/19mind.html

Edit 2: Another article with an interview with one of the lead researchers: https://hbr.org/2012/03/hard-to-read-fonts-promote-better-recall


#325

Yo, that’s wonderful! Jitai is based on the reasonable notion that having a variety of unfamiliar and difficult fonts would be beneficial for learning, but of course I didn’t have any studies in support of that. Turns out they exist, though! It seems it can help not only reading skills, but aid in memorization too. That’s great to hear.

Thanks for looking around and linking it here!


#326

There probably aren’t thaaat many fonts people are using, couldn’t we just pr / submit them to @obskyr to add to the
// Other Japanese fonts people use. // You might want to try some of these!?
section?

A few extra kb in the script won’t matter much.

If so, I use these which are really great.
YOzFontK
YOzFont-Pro-R


#327

Please, go ahead! The only reservation I have is I want to make sure there’s a good balance of different fonts (and not too many of one type), so people who install all the fonts on the GitHub page get a good experience. Beyond that, I’d be more than happy to add more fonts to the default collection.


#328

I agree, if it’s just another standard gothic/mincho not much point.


#329

Hi - I’m having a problem getting the fonts. The first bit of this post and the links to the help post for setting up Tampermonkey were great, then the detail dropped and I can’t fill in the gaps myself to actually get the fonts working.

I went to the list and followed all the links for the top 10ish fonts suggested - have zip files in my downloads box - but it’s only showing one font (the first one on the list).

I am not very computer savvy and would appreciate it if you could update the post/add a comment with the steps to take after following the link to the font suggestion page and downloading them. Otherwise I just have some font files sat there for no reason.

Thanks!


#330

Now that you have your zip files, you need to install the fonts within them. To do that, you open the zip files (by simply double-clicking on them), then open the font files (once again, by double-clicking on them), and then click the “Install” button. Once you’ve done that, they should show up in Jitai!


#331

image


#332

Today at my japanese class I confused 入 with 人 because in handwriting there is not the line on top of “enter”, so my teacher suggested I should use different font when studying kanji. So I just installed this script, I think it’s just perfect. The idea of showing the usual kanji on mouseover does not force me to get a wrong result if I don’t recognize it and at the same time I am learning the different possibilities, so thanks a lot for this! Also, this is my first script installed :smiley:

Since I am on Linux, I will add here what I did to install new fonts and maybe you can consider put it in the OP. I am on Linux Mint 18.4, but I am pretty sure it will be the same process more or less in all linux systems.
Go to “Synaptic Package Manager” and type “japanese fonts” in the search bar, install all the fonts you want.
I installed every one of them, then I added in the Jitai script the followings:

"mikachan",
"MigMix 1M",
"Monapo",
"Sawarabi Mincho",
"Sawarabi Gothic",
"AoyagiKouzanFontT",
"Mona",
"AoyagiSosekiFont2",
"Dejima",
"KouzanBrushFont",
"SetoFont",
"MisakiMincho", // MisakiMincho and
"MisakiGothic", // MisakiGothic are bitmap fonts
"MotoyaLCedar",
"MotoyaLMaru"

(Dejima is already listed before, but since in my Fonts Viewer was written without Mincho I just repeated it to be sure).

Hope this helps :slight_smile:


#333

I think this would be cool if it only used alternative fonts for items of Guru level and higher. The thing is with freshly new items, especially radicals and kanji, I prefer to familiarize myself with the vanilla font to get a better idea on how the item is typically made up / constructed. Only when I become used to that then I can explore how different fonts alternate its style.


#334

At least you can hover over the item to show the original font as a workaround.


#335

Thank you, this script is fantastic!


#336

Ever since I discovered the whole API thing a few days ago it feels like I’m using up more of my time downloading cool stuff than actually studying Japanese :joy:


#337

Is there a way to quickly/easily display which font you’re looking at during reviews?

I installed this script ages ago, but noticed a wallpaper using the nagayama_kai font. It doesn’t look familiar, despite being included in my Jitai load list (and it displays just fine in MS Word), and after some few hundred reviews I don’t believe it’s ever popped up even once. Any ideas why I’m not seeing it?


#338

To see what font is being used for the current review (before you answer), you can open the console and type:
$('#character span').css('font-family')

If you want to see what the nagayama_kai font looks like during reviews (to double check that you haven’t seen it), you can do:
$('#character span').css('font-family', 'nagayama_kai')


Seeing all your fonts that Jitai thinks exists is a little tougher but shouldn’t be too hard. If you open the Jitai script in your script manager, you should copy the lines from var fonts = [ also the way to the closing } for the method function fontExists(fontName) {. Paste that in the console and press enter. And then type existingFonts and press enter again. This will then show the list of fonts you can supposedly render, and you can check if nagayama_kai is included in the list.

For example, for my version of the code (my selected fonts) I’d copy:

Sample Code To Copy
var fonts = [
    // Default Windows fonts
    "Meiryo, メイリオ",
    "MS PGothic, MS Pゴシック, MS Gothic, MS ゴック",
    "MS PMincho, MS P明朝, MS Mincho, MS 明朝",
    "Yu Gothic, YuGothic",
    "Yu Mincho, YuMincho",

    // Other fonts
    "EPSON 行書体M",
    "EPSON 正楷書体M",
    "EPSON 教科書体M",
    //"EPSON 太明朝体B",
    //"EPSON 太行書体B",
    //"EPSON 丸ゴシック体M",
    "nagayama_kai"
];

var existingFonts = [];
for (var i = 0; i < fonts.length; i++) {
    var fontName = fonts[i];
    if (fontExists(fontName)) {
        existingFonts.push(fontName);
    }
}

function fontExists(fontName) {
    // Approach from kirupa.com/html5/detect_whether_font_is_installed.htm - thanks!
    // Will return false for the browser's default monospace font, sadly.
    var canvas = document.createElement('canvas');
    var context = canvas.getContext('2d');
    var text = "wim-—l~ツ亻".repeat(100); // Characters with widths that often vary between fonts.

    context.font = "72px monospace";
    var defaultWidth = context.measureText(text).width;

    // Microsoft Edge raises an error when a context's font is set to a string
    // containing certain special characters... so that needs to be handled.
    try {
        context.font = "72px " + fontName + ", monospace";
    } catch (e) {
        return false;
    }
    var testWidth = context.measureText(text).width;

    return testWidth != defaultWidth;
}

Now that doesn’t guarantee that Jitai can render the script because there’s a secondary check later on, but that should give you a good place to look.


#339

Thanks for the help!

The font does get listed when I go through those steps. I’m still not convinced that I see it showing up in the rotation, but for the time being I’ve just appended (a copy of) it to the end of the list to give it another chance to appear.

Also, grats on 50!! You’re not far off at all now :slight_smile:


#340

Hey all, I recently started using WK, and I mainly do my studying on a Chromebook. Does anyone know if this can work on Chrome OS? I was able to get Tampermonkey and install Jitai no problem, but installing fonts for Jitai to use seems to be an issue. Was wondering if there were any other Chrome OS users who have found a work around for this.

Thanks!