7b4a051a1f
margin 後備(供缺 OpenType halt 之字型): - jiya.halfWidth: "halt"(預設)|"margin"。margin 以 width:0.5em+字身依墨色 偏側溢出定位,於 CSS 盒模型重現 halt 之半形 advance(真 0.5em;相鄰標點各 0.5em、合佔 1em,無負 margin 之鄰接疊加/單側重疊)。模式由 data-jz-halfwidth 子樹屬性決定(可逐區塊/逐 lang,含 halt-island 反置)。 - 偏側 inkBias 依字身墨色中心給 left/center/right/full;參考表據方正書宋 GBK 實測,consumer 可經 jiya.bias 逐 lang 逐字覆寫。 - _lang.css 字型堆疊僅作後備(全包 :where 零特異度、只命中帶 lang 屬性之元素、 不直接覆寫 jz-inner)→ 消費端 font-family 恆優先,標點隨之以消費端字型渲染。 - 新增 tools/measure-bias.py(量 glyph ink 中心、產偏側建議表)+ README 「字型適配工作流」。demo/fallback.html:方正書宋 GBK 對照 halt 失效 vs margin。 下游回饋修復: - 1a:adjacentLogicalChar 透明穿越 jz-jinze(同 jz-hws/樣式行內)→ pill 緊鄰 CJK 標點時,左緣間隙與作者空格剝除復原(jinze 先於 spacing 之交互)。 - 1b:CJK↔CJK 贅餘作者空格(含跨 inline 標籤)剝除、不留隙,與 CJK↔Latin 之 邊界正規化一致(DEL 哨符,全形空格 U+3000 不動)。 - 問題二:新增 justifyAtoms 選項;false → jz-char/jz-jinze 改 display:inline, 相容分頁器(Paged.js)對齊引擎(halt 半形與禁則 nowrap 保留)。 測試 43→49 全通過;dist 重建;README/ARCHITECTURE 同步更新契約。
53 lines
2.9 KiB
TypeScript
53 lines
2.9 KiB
TypeScript
import type { LangClass } from "./locale.js";
|
||
/** CJK 表意文字/假名/注音等範圍(沿用並擴充 v1 之 PANGU_CJK)。 */
|
||
export declare const CJK: string;
|
||
/** 西文字母與數字。 */
|
||
export declare const ALNUM = "A-Za-z0-9";
|
||
/** 西文字母。 */
|
||
export declare const ALPHA = "A-Za-z";
|
||
/** 任一 CJK 字元測試。 */
|
||
export declare const ANY_CJK: RegExp;
|
||
/** CJK 之後可接間隙之西文集(含希臘字母、運算符、拉丁補充、箭號、裝飾符)。 */
|
||
export declare const ANS_AFTER_CJK: string;
|
||
/** CJK 之前可接間隙之西文集(同上,去 @)。 */
|
||
export declare const ANS_BEFORE_CJK: string;
|
||
/** 句末點號:。!?(開明式與全角式皆保持全形,不擠壓)。 */
|
||
export declare const BD_STOP = "\u3002\uFF01\uFF1F";
|
||
/** 句內點號:,、;:(開明式擠成半形;全角式保持全形)。 */
|
||
export declare const BD_PAUSE = "\uFF0C\u3001\uFF1B\uFF1A";
|
||
/** 開始括號/引號:「『(《〈【〖〔[{“‘。 */
|
||
export declare const BD_OPEN = "\u300C\u300E\uFF08\u300A\u3008\u3010\u3016\u3014\uFF3B\uFF5B\u201C\u2018";
|
||
/** 結束括號/引號:」』)》〉】〗〕]}”’。 */
|
||
export declare const BD_CLOSE = "\u300D\u300F\uFF09\u300B\u3009\u3011\u3017\u3015\uFF3D\uFF5D\u201D\u2019";
|
||
/** 間隔/分隔號:·・‧。 */
|
||
export declare const BD_MIDDLE = "\u00B7\u30FB\u2027";
|
||
/** 連續省略/破折:…—。 */
|
||
export declare const BD_LIGA = "\u2026\u2014";
|
||
/** 全體標點字元(供 charify 走訪偵測)。 */
|
||
export declare const BD_ALL: string;
|
||
/**
|
||
* 將單一標點字元歸入其 bd-* 子類;非標點回傳 null。
|
||
* 供 jiya 之 charify 為 jz-char 標記 class。
|
||
*/
|
||
export declare function classifyBiaodian(ch: string): string | null;
|
||
/** 全體 bd-* 子類名(DOM 端讀取 jz-char 之 bd class 用)。 */
|
||
export declare const BD_CLASS_NAMES: readonly ["bd-stop", "bd-pause", "bd-open", "bd-close", "bd-middle", "bd-liga"];
|
||
/**
|
||
* 標點之「可壓縮空白」側(橫排)。字面偏左者空白在右(句內/句末/閉類),
|
||
* 開類字面偏右、空白在左。間隔號/連接號不壓縮。擠壓即收掉對應側之半形空白。
|
||
*/
|
||
export declare function blankSides(bdClass: string | null): {
|
||
left: boolean;
|
||
right: boolean;
|
||
};
|
||
/** 字形墨色偏側。 */
|
||
export type Bias = "left" | "center" | "right" | "full";
|
||
/** 逐 lang 逐字之偏側覆寫表(消費端傳入,覆寫參考預設)。 */
|
||
export type BiasTable = Partial<Record<LangClass, Record<string, Bias>>>;
|
||
/**
|
||
* 解析標點字元在某語言下之墨色偏側(margin 後備模式用)。
|
||
* 優先序:消費端 overrides[langClass][ch] > 括號表 > 內建點號參考表。
|
||
* 非可壓縮標點(間隔/連接號等)回傳 null(margin 模式不收)。
|
||
*/
|
||
export declare function inkBias(ch: string, langClass: LangClass, overrides?: BiasTable): Bias | null;
|