refactor(gsub): unsupported lookup 也折叠 subCount=1(与 GPOS/supported 对称)

GSUB unsupported lookup(type5 ReverseChain 等)原逐 subtable 写空 subtable,
现折叠 subCount=1 单空 subtable,与 supported 分支(优化337) + subsetGPOS 优化330 一致。
N 个空 subtable 与 1 个渲染语义等价(都查不到 coverage 跳过)。

基准字体无 unsupported lookup(type5 罕见),30 用例 SSIM+体积完全不变,
此为模式③对称补齐,对未来含 type5 的字体严格更优。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
崮生(子虚) 2026-07-25 13:15:16 +08:00
parent 665a089019
commit 1adbf2e0d1

View File

@ -1718,32 +1718,29 @@ export function subsetGSUB(
}
} else {
/** lookuptype5 ReverseChain
* lookup type/flag/subCount subtable subtable subtable
* subtable coverage/ClassDef
* lookup / type4
* coverage subtable 2594 subtable coverage
* lookup lookup */
const lookupFlag = r.u16(lk.origLookupOff + 2);
const useMarkFilteringSet = (lookupFlag & 0x0010) !== 0;
/**
* 337 supported + subsetGPOS 330 unsupported lookup
* subtable gid coverage N subtable 1 subtable
* subCount=1 subtable lookup type/flag
* feature lookup unsupported lookuptype5 */
w.writeUint16(r.u16(lk.origLookupOff));
w.writeUint16(lookupFlag);
w.writeUint16(lk.subtableAbsOffs.length);
w.writeUint16(1);
const lookupStart = w.length - 6;
/**
* 334 supported 329 unsupported lookup subtable
* writeUint16(0) + slot + writeInt16At reserveOffset16
*/
const subtableSlotsStart = w.length;
for (let j = 0; j < lk.subtableAbsOffs.length; j++) {
w.writeUint16(0);
}
w.writeUint16(0);
if (useMarkFilteringSet) {
w.writeUint16(r.u16(lk.origLookupOff + 6 + lk.subtableAbsOffs.length * 2));
}
for (let j = 0; j < lk.subtableAbsOffs.length; j++) {
w.writeInt16At(subtableSlotsStart + j * 2, w.length - lookupStart);
writeEmptySubtable(w, lk.effectiveType);
}
const subtablePos = w.length;
writeEmptySubtable(w, lk.effectiveType);
w.writeInt16At(subtableSlotsStart, subtablePos - lookupStart);
}
/** 优化333: 回填 lookup 偏移槽(相对 LookupList 起始) */
w.writeInt16At(lookupSlotsStart + i * 2, lookupAbsPositions[i] - lookupListAbs);