Skip to content

Commit

Permalink
fix(禁則処理): ルビ・縦中横・傍点関連への禁則処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
famibee committed Jun 30, 2024

Verified

This commit was signed with the committer’s verified signature.
cjihrig Colin Ihrig
1 parent 5b877bf commit 5727009
Showing 14 changed files with 328 additions and 152 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
- fix(禁則処理): ルビ・縦中横・傍点関連への禁則処理を修正
- ぶら下げ領域にはみ出す場合
- 追い出しになる場合
- fix(文字レイヤ): クリック待ちが[tcy]の二文字目直下に行ってしまう件(safari以外)
- fix(CSS): いつの間にか Safari も縦中横(text-combine-upright)対応していたので、-webkit-text-combine(Firefox以外) の設定を削除
- "text-combine" | Can I use... Support tables for HTML5, CSS3, etc https://caniuse.com/?search=text-combine
- test(禁則処理): ルビのテストデータ修正
- ルビと改行状態のさまざまなケースでのテスト導入
- test(禁則処理): 「犬神使いと少年」スクリプト+ debugHtm スイッチによりテスト
- 既知の問題:fn=ss_050 line=739 において一文字(広いルビ)がぶら下げ領域にはみ出す
```scheme
の明治二
・井上圓《えん》了《りょう》
```
- 既知の問題:以下のような「。で終わらない非ぶら下げ文字」で、ぶら下げ領域にはみ出す不具合あり。ただ通常の使用ではまずない&見た目的にそんな気にならないので保留。
```scheme
 こいつが無邪気なのか、強いのかは俺には分から口《☀》ビ《☂》末《⛈》[r] ;ok
 こいつが無邪気なのか、強いのかは俺には分からな口末頭。[r] ;ok
 こいつが無邪気なのか、強いのかは俺には分からな口《☀》末頭[r] ;ng
 こいつが無邪気なのか、強いのかは俺には分からな口《☀》末《☂》頭[r] ;ng
 こいつが無邪気なのか、強いのかは俺には分からな口末頭\ ;ng
```
- fix: リファクタリングなど


# [1.55.0](https://github.com/famibee/SKYNovel/compare/v1.54.1...v1.55.0) (2024-06-27)


39 changes: 19 additions & 20 deletions dist/app.js
Original file line number Diff line number Diff line change
@@ -20881,7 +20881,7 @@ class u0 {
continue;
}
let p = h - 1;
for (; o[p].elm.tagName === "RT"; ) --p;
o[p].elm.parentElement?.tagName === "RUBY" && --p;
const { elm: v, rect: y, ch: _ } = o[p];
if (!this.break_fixed) {
this.break_fixed_left = y.x, this.break_fixed_top = y.y;
@@ -20936,15 +20936,15 @@ class u0 {
hyph_alg(t, e, i, n, s) {
if (!this.#s.test(i)) {
if (this.#r.test(s))
for (; n > 0; ) {
const { elm: o, ch: a } = t[--n];
for (; --n >= 0; ) {
const { elm: o, ch: a } = t[n];
if (o.tagName !== "RT" && !this.#r.test(a))
break;
}
else if (!(i === s && this.#a.test(i))) return { cont: !0, ins: n + 1 };
}
for (n = e; n > 0; ) {
const { elm: o, ch: a } = t[--n];
for (n = e; --n >= 0; ) {
const { elm: o, ch: a } = t[n];
if (o.tagName !== "RT" && !this.#s.test(a))
break;
}
@@ -20962,35 +20962,36 @@ class u0 {
* @return {number} result.ins - 手前に改行を挿入すべき要素の添字
*/
hyph_alg_bura(t, e, i, n) {
const s = n - 2, { ch: o } = t[s];
const s = t[e - 1].elm.tagName === "RT" ? e - 2 : e - 1, { ch: o } = t[s];
if (this.#f.test(o) || this.#r.test(o)) {
let h = s + 1;
(this.#f.test(i) || this.#r.test(i)) && (h = e + 1);
let h = e;
(this.#f.test(i) || this.#r.test(i)) && ++h;
const { ch: l } = t[h - 1], { ch: u } = t[h];
if (l === u && this.#a.test(u)) return { cont: !1, ins: h - 1 };
if (!this.#s.test(l)) return { cont: !1, ins: h };
for (n = h - 1; n > 0; ) {
const { elm: c, ch: f } = t[--n];
for (; --h >= 0; ) {
const { elm: c, ch: f } = t[h];
if (c.tagName !== "RT" && !this.#s.test(f))
break;
}
return { cont: !1, ins: n + 1 };
return { cont: !1, ins: h + 1 };
}
const a = n - 3;
const a = s - 1;
if (n >= 3) {
const { ch: h } = t[a];
if (this.#a.test(o) && h === o)
return { cont: !1, ins: a };
if (this.#s.test(h)) {
for (n = a; --n > 0; ) {
const { elm: l, ch: u } = t[n];
if (l.tagName !== "RT" && !this.#s.test(u))
let l = a;
for (; --l >= 0; ) {
const { elm: u, ch: c } = t[l];
if (u.tagName !== "RT" && !this.#s.test(c))
break;
}
return { cont: !1, ins: n + 1 };
return ++l, { cont: !1, ins: l };
}
}
return { cont: !1, ins: n - 2 };
return { cont: !1, ins: s };
}
}
class ht extends Nt {
@@ -22171,9 +22172,7 @@ class ot extends jt {
const { t: h, r: l = "", wait: u = null, style: c = "", r_style: f = "" } = JSON.parse(a);
ot.#t.doRecLog() && (this.#it += t + (e ? `《${e}》` : ""), this.#Q += h);
const d = k.isSafari ? l.replaceAll(/[A-Za-z0-9]/g, (y) => String.fromCharCode(y.charCodeAt(0) + 65248)) : l, { cl: m, sty: p, lnk: v } = this.#z(!0, u);
n = `<span${m} style='${p}${this.#C(h)} ${c}'><ruby><span${v} style='${p} display: inline;
text-combine-upright: all;
-webkit-text-combine: horizontal;'>${h}</span><rt${v}${this.#V(
n = `<span${m} style='${p}${this.#C(h)} ${c}'><ruby><span${v} style='${p} display: inline; text-combine-upright: all;'>${h}</span><rt${v}${this.#V(
h,
d,
this.#w,
2 changes: 1 addition & 1 deletion dist/app.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/sn/Hyphenation.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sn/TxtLayer.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/sn/TxtStage.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 19 additions & 20 deletions dist/web.js
Original file line number Diff line number Diff line change
@@ -22475,7 +22475,7 @@ class Hyphenation {
continue;
}
let W = $ - 1;
for (; D[W].elm.tagName === "RT"; ) --W;
D[W].elm.parentElement?.tagName === "RUBY" && --W;
const { elm: Y, rect: K, ch: Z } = D[W];
if (!this.break_fixed) {
this.break_fixed_left = K.x, this.break_fixed_top = K.y;
@@ -22530,15 +22530,15 @@ class Hyphenation {
hyph_alg(t, e, r, k, N) {
if (!this.#s.test(r)) {
if (this.#i.test(N))
for (; k > 0; ) {
const { elm: D, ch: B } = t[--k];
for (; --k >= 0; ) {
const { elm: D, ch: B } = t[k];
if (D.tagName !== "RT" && !this.#i.test(B))
break;
}
else if (!(r === N && this.#o.test(r))) return { cont: !0, ins: k + 1 };
}
for (k = e; k > 0; ) {
const { elm: D, ch: B } = t[--k];
for (k = e; --k >= 0; ) {
const { elm: D, ch: B } = t[k];
if (D.tagName !== "RT" && !this.#s.test(B))
break;
}
@@ -22556,35 +22556,36 @@ class Hyphenation {
* @return {number} result.ins - 手前に改行を挿入すべき要素の添字
*/
hyph_alg_bura(t, e, r, k) {
const N = k - 2, { ch: D } = t[N];
const N = t[e - 1].elm.tagName === "RT" ? e - 2 : e - 1, { ch: D } = t[N];
if (this.#f.test(D) || this.#i.test(D)) {
let $ = N + 1;
(this.#f.test(r) || this.#i.test(r)) && ($ = e + 1);
let $ = e;
(this.#f.test(r) || this.#i.test(r)) && ++$;
const { ch: U } = t[$ - 1], { ch: H } = t[$];
if (U === H && this.#o.test(H)) return { cont: !1, ins: $ - 1 };
if (!this.#s.test(U)) return { cont: !1, ins: $ };
for (k = $ - 1; k > 0; ) {
const { elm: z, ch: V } = t[--k];
for (; --$ >= 0; ) {
const { elm: z, ch: V } = t[$];
if (z.tagName !== "RT" && !this.#s.test(V))
break;
}
return { cont: !1, ins: k + 1 };
return { cont: !1, ins: $ + 1 };
}
const B = k - 3;
const B = N - 1;
if (k >= 3) {
const { ch: $ } = t[B];
if (this.#o.test(D) && $ === D)
return { cont: !1, ins: B };
if (this.#s.test($)) {
for (k = B; --k > 0; ) {
const { elm: U, ch: H } = t[k];
if (U.tagName !== "RT" && !this.#s.test(H))
let U = B;
for (; --U >= 0; ) {
const { elm: H, ch: z } = t[U];
if (H.tagName !== "RT" && !this.#s.test(z))
break;
}
return { cont: !1, ins: k + 1 };
return ++U, { cont: !1, ins: U };
}
}
return { cont: !1, ins: k - 2 };
return { cont: !1, ins: N };
}
}
class TxtStage extends Container {
@@ -23765,9 +23766,7 @@ class TxtLayer extends Layer {
const { t: $, r: U = "", wait: H = null, style: z = "", r_style: V = "" } = JSON.parse(B);
TxtLayer.#t.doRecLog() && (this.#rt += t + (e ? `《${e}》` : ""), this.#Q += $);
const X = CmnLib.isSafari ? U.replaceAll(/[A-Za-z0-9]/g, (K) => String.fromCharCode(K.charCodeAt(0) + 65248)) : U, { cl: q, sty: W, lnk: Y } = this.#z(!0, H);
k = `<span${q} style='${W}${this.#O($)} ${z}'><ruby><span${Y} style='${W} display: inline;
text-combine-upright: all;
-webkit-text-combine: horizontal;'>${$}</span><rt${Y}${this.#V(
k = `<span${q} style='${W}${this.#O($)} ${z}'><ruby><span${Y} style='${W} display: inline; text-combine-upright: all;'>${$}</span><rt${Y}${this.#V(
$,
X,
this.#E,
2 changes: 1 addition & 1 deletion dist/web.js.map

Large diffs are not rendered by default.

Loading

0 comments on commit 5727009

Please sign in to comment.