Mkana+

Change the font to display characters that cannot be displayed.

Versione datata 29/01/2025. Vedi la nuova versione l'ultima versione.

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

You will need to install an extension such as Tampermonkey to install this script.

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

// ==UserScript==
// @name         Mkana+
// @namespace    https://lit.link/toracatman
// @version      2025-01-29
// @description  Change the font to display characters that cannot be displayed.
// @author       toracatman
// @match        */*
// @icon         data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==
// @grant        none
// @license      MIT
// ==/UserScript==

var css = `@import url('https://fonts.googleapis.com/css2?family=Noto+Color+Emoji&family=Noto+Sans+KR&display=swap');

@font-face {
	font-family: "Mkana+";
	src: local("Mkana+"),
	     url("https://toracatman.github.io/fonts/mkanaplus.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/mkanaplus.woff") format("woff");
	font-display: swap;
	unicode-range: U+0-F8FF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23-FA24, U+FA27-FA29, U+FB00-2F7FF, U+2FA20-10FFFF;
}
@font-face {
	font-family: "MgenKana+";
	src: local("MgenKana+"),
	     url("https://toracatman.github.io/fonts/mgenkanaplus.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/mgenkanaplus.woff") format("woff");
	font-display: swap;
	unicode-range: U+0-F8FF, U+FA0E-FA0F, U+FA11, U+FA13-FA14, U+FA1F, U+FA21, U+FA23-FA24, U+FA27-FA29, U+FB00-2F7FF, U+2FA20-10FFFF;
}
@font-face {
	font-family: "Noto Serif Hentaigana";
	src: local("Noto Serif Hentaigana"),
	     url("https://toracatman.github.io/fonts/NotoSerifHentaigana-Regular.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/NotoSerifHentaigana-Regular.woff") format("woff");
	font-display: swap;
}
@font-face {
	font-family: "Jigmo";
	src: local("Jigmo"),
	     url("https://toracatman.github.io/fonts/Jigmo.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/Jigmo.woff") format("woff");
	font-display: swap;
	unicode-range: U+2E80-302D, U+3030-312F, U+3190-9FFF, U+F900-FAFF, U+FE11-FE12, U+FE51, U+FF61-FFDF, U+1AFF0-1B16F, U+1D372-1D376, U+1F000-1F02F, U+1F200-1F2FF, U+1FA60-1FA6D, U+100000-10FFFF;
}
@font-face {
	font-family: "Jigmo2";
	src: local("Jigmo2"),
	     url("https://toracatman.github.io/fonts/Jigmo2.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/Jigmo2.woff") format("woff");
	font-display: swap;
}
@font-face {
	font-family: "Jigmo3";
	src: local("Jigmo3"),
	     url("https://toracatman.github.io/fonts/Jigmo3.woff2") format("woff2"),
	     url("https://toracatman.github.io/fonts/Jigmo3.woff") format("woff");
	font-display: swap;
}

body {
	font-family: "Mkana+", "MgenKana+", "Noto Color Emoji", "Noto Sans KR", "Noto Serif Hentaigana", "Jigmo", "Jigmo2", "Jigmo3", sans-serif;
}`;

var css2 = `* {
	font-family: "Mkana+", "MgenKana+", "Noto Sans KR", "Noto Serif Hentaigana", "Jigmo", "Jigmo2", "Jigmo3", sans-serif !important;
}`;

(() => {
    var style = document.createElement("style");
    style.textContent = css;
    document.body.appendChild(style);
    if (/^https:\/\/x\.com/.test(location.href)) {
        const font = new FontFace("dummy", "url(https://toracatman.github.io/fonts/dummy.woff)");
        font.load().then(
            () => {
            },
            (err) => {
                console.error(err);
                var div = document.createElement("div");
                div.style.position = "fixed";
                div.style.top = "0";
                div.style.left = "0";
                div.innerHTML = `Webフォントが読み込まれませんでした。
<a href="/compose/post">読み込むために投稿画面に移動</a>
`;
                var a = document.createElement("a");
                a.href = "javascript:void(0)";
                a.onclick = () => div.remove();
                a.textContent = "閉じる";
                div.appendChild(a);
                document.body.appendChild(div);
            },
        );
        style.textContent += css2;
    }
})();