15m15 成书emoji扩区段(加U+FE00~FE0F变体选择符+U+200D ZWJ) + 全页110→115剂量加大
Auto Release / build (push) Successful in 3m27s
Auto Release / build (push) Successful in 3m27s
This commit is contained in:
@@ -396,7 +396,7 @@ public class CustomScreenManager implements Listener {
|
||||
if (!body.isEmpty()) {
|
||||
// 15m10 封页统一整字符硬切100(封页不再往回扫句末, 与正文页同策略):
|
||||
// 先验证"整字符切"会不会断标点。封页/正文页都先歇着句末切点, 纯按字数切。
|
||||
int coverLimit = 110;
|
||||
int coverLimit = 115;
|
||||
// [15m8 句末切点歇着] int best=-1; for(i..) if(。!?;\n){best=i+1;break;}
|
||||
// [15m8 句末切点歇着] int cut = (best<55)? Math.min(body.length(),coverLimit) : Math.min(body.length(),best);
|
||||
int cut = Math.min(body.length(), coverLimit);
|
||||
@@ -416,19 +416,19 @@ public class CustomScreenManager implements Listener {
|
||||
|
||||
// 当前页为空:直接开始新段落
|
||||
if (page.length() == 0) {
|
||||
if (p.length() > 110) {
|
||||
if (p.length() > 115) {
|
||||
java.util.List<String> sentences = splitSentences(p);
|
||||
for (String s : sentences) {
|
||||
// ★ 15m:单句本身超 85(长句无句末可拆)→ 硬切 85,残句进下一页
|
||||
while (s.length() > 110) {
|
||||
if (page.length() + 110 + 1 > 110 && page.length() > 0) {
|
||||
while (s.length() > 115) {
|
||||
if (page.length() + 115 + 1 > 115 && page.length() > 0) {
|
||||
pages.add(page.toString().trim());
|
||||
page = new StringBuilder();
|
||||
}
|
||||
page.append(s.substring(0, 110));
|
||||
s = s.substring(110);
|
||||
page.append(s.substring(0, 115));
|
||||
s = s.substring(115);
|
||||
}
|
||||
if (page.length() + s.length() + 1 > 110 && page.length() > 0) {
|
||||
if (page.length() + s.length() + 1 > 115 && page.length() > 0) {
|
||||
pages.add(page.toString().trim());
|
||||
page = new StringBuilder();
|
||||
}
|
||||
@@ -441,14 +441,14 @@ public class CustomScreenManager implements Listener {
|
||||
}
|
||||
|
||||
// 当前页已有内容:判断段落是否能整段放入
|
||||
if (page.length() + p.length() + 1 <= 110) {
|
||||
if (page.length() + p.length() + 1 <= 115) {
|
||||
page.append("\n").append(p);
|
||||
continue;
|
||||
}
|
||||
|
||||
// 整段放不进:在「当前页 + 段落」里找语义边界截断
|
||||
String candidate = page.toString() + "\n" + p;
|
||||
int cut = findSemanticCut(candidate, 110);
|
||||
int cut = findSemanticCut(candidate, 115);
|
||||
// ★ 15l-7f 修复:不 trim,保留语义边界(。!?;\n)在页内,避免吃掉前面整段
|
||||
String firstHalf = candidate.substring(0, cut);
|
||||
String secondHalf = candidate.substring(cut);
|
||||
@@ -459,8 +459,8 @@ public class CustomScreenManager implements Listener {
|
||||
page = new StringBuilder(secondHalf);
|
||||
|
||||
// 若剩余段仍超页,继续按语义截断或按句拆
|
||||
while (page.length() > 110) {
|
||||
int nextCut = findSemanticCut(page.toString(), 110);
|
||||
while (page.length() > 115) {
|
||||
int nextCut = findSemanticCut(page.toString(), 115);
|
||||
String chunk = page.substring(0, nextCut);
|
||||
String remain = page.substring(nextCut);
|
||||
while (chunk.endsWith("\n") || chunk.endsWith(" ")) chunk = chunk.substring(0, chunk.length() - 1);
|
||||
@@ -481,7 +481,7 @@ public class CustomScreenManager implements Listener {
|
||||
if (pages.size() > 2) {
|
||||
String last = pages.get(pages.size() - 1);
|
||||
String prev = pages.get(pages.size() - 2);
|
||||
if (last.length() < 20 && (prev.length() + last.length() + 1) <= 110) {
|
||||
if (last.length() < 20 && (prev.length() + last.length() + 1) <= 115) {
|
||||
pages.set(pages.size() - 2, prev + "\n" + last);
|
||||
pages.remove(pages.size() - 1);
|
||||
}
|
||||
@@ -491,7 +491,7 @@ public class CustomScreenManager implements Listener {
|
||||
for (int pi = 1; pi + 1 < pages.size(); pi++) {
|
||||
String cur = pages.get(pi);
|
||||
String nxt = pages.get(pi + 1);
|
||||
if (cur.length() < 50 && (cur.length() + nxt.length() + 1) <= 160) {
|
||||
if (cur.length() < 50 && (cur.length() + nxt.length() + 1) <= 165) {
|
||||
pages.set(pi + 1, cur + "\n" + nxt);
|
||||
pages.remove(pi);
|
||||
}
|
||||
@@ -543,9 +543,9 @@ public class CustomScreenManager implements Listener {
|
||||
s = s.replaceAll("(?<!\\*)\\*(?!\\*)", "");
|
||||
// 去代码反引号
|
||||
s = s.replace("`", "");
|
||||
// 15m14 去 emoji/非常规字符(⚠️、✅、❌ 等), 防成书 UI 渲染乱码方块
|
||||
// 保留常见标点与中英文, 其他非 BMP 字符(emoji 区段 U+1F000~U+FFFF)直接删
|
||||
s = s.replaceAll("[\\x{1F000}-\\x{1FFFF}\\x{2600}-\\x{27BF}\\x{2B00}-\\x{2BFF}]", "");
|
||||
// 15m15 去 emoji/非常规字符(⚠️=U+26A0+U+FE0F, ✅❌等), 防成书 UI 渲染乱码方块
|
||||
// 保留常见标点与中英文, 其他非 BMP 字符(emoji 区段 U+1F000~U+FFFF) + 变体选择符 U+FE00~FE0F 直接删
|
||||
s = s.replaceAll("[\\x{1F000}-\\x{1FFFF}\\x{2600}-\\x{27BF}\\x{2B00}-\\x{2BFF}\\x{FE00}-\\x{FE0F}\\x{200D}]", "");
|
||||
// 压缩 3 行以上空行
|
||||
s = s.replaceAll("\\n{3,}", "\n\n");
|
||||
return s;
|
||||
|
||||
Reference in New Issue
Block a user