1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
<!doctype html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>kukuri OrgFlow</title>
<style>
html, body { margin: 0; height: 100%; overflow: hidden; background: #fff; }
#ComposeTarget { width: 100%; height: 100%; display: block; }
#loading { position: absolute; top: 45%; width: 100%; text-align: center; font-family: system-ui, sans-serif; color: #6750a4; }
</style>
<script>
// The deploy server's FTP forbids MKD, so nested composeResources never reach
// the web root. The bundled Japanese font is therefore shipped as a flat
// webfont.js which stores the TTF as base64 in window.__orgflowFontB64.
//
// BUG FIXED 2026-09-26: the shim below used to look only for
// globalThis.__orgflowFontBlobs, which nothing ever created - webfont.js sets
// __orgflowFontB64 (a base64 string), not __orgflowFontBlobs. So every font
// request fell through to the real fetch, the TTF could not be found, and the
// app rendered with no Japanese font at all (the day numbers came out as tofu
// boxes). Decode the base64 once, up front, into the Blobs the shim expects.
(function () {
try {
if (window.__orgflowFontB64 && !globalThis.__orgflowFontBlobs) {
var bin = atob(window.__orgflowFontB64);
var bytes = new Uint8Array(bin.length);
for (var i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
globalThis.__orgflowFontBlobs = { "zenkakugothicnew_regular.ttf": bytes };
}
} catch (e) {}
// webfont.js loads after this script, so also patch the names it looks up by
// exposing the decode as a function the page can call again later.
window.__orgflowFontReady = function () {
if (globalThis.__orgflowFontBlobs) return true;
if (!window.__orgflowFontB64) return false;
var bin = atob(window.__orgflowFontB64);
var bytes = new Uint8Array(bin.length);
for (var i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
globalThis.__orgflowFontBlobs = { "zenkakugothicnew_regular.ttf": bytes };
return true;
};
var origFetch = window.fetch;
window.fetch = function (input, init) {
try {
var url = typeof input === 'string' ? input : (input && input.url) || '';
var m = /composeResources\/[^/]+\/font\/([^/?]+)/.exec(url);
if (m) {
window.__orgflowFontReady();
if (globalThis.__orgflowFontBlobs && globalThis.__orgflowFontBlobs[m[1]]) {
return Promise.resolve(new Response(globalThis.__orgflowFontBlobs[m[1]]));
}
}
} catch (e) {}
return origFetch.call(window, input, init);
};
var oOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url) {
try {
if (typeof url === 'string') {
var m = /composeResources\/[^/]+\/font\/([^/?]+)/.exec(url);
if (m) {
window.__orgflowFontReady();
if (globalThis.__orgflowFontBlobs && globalThis.__orgflowFontBlobs[m[1]]) {
url = URL.createObjectURL(new Blob([globalThis.__orgflowFontBlobs[m[1]]]));
}
}
}
} catch (e) {}
return oOpen.apply(this, [method, url].concat([].slice.call(arguments, 2)));
};
})();
</script>
</head>
<body>
<canvas id="ComposeTarget"></canvas>
<div id="loading">loading kukuri OrgFlow (Compose/Wasm)…</div>
<script>
window.addEventListener("load", () => document.getElementById("loading")?.remove());
</script>
<script src="webfont.js?v=shell1"></script>
<script src="orgflow-ui.js?v=shell1"></script>
</body>
</html>
|