diff --git a/Autokem/autokem.safetensors b/Autokem/autokem.safetensors index 7441808..26d3365 100644 --- a/Autokem/autokem.safetensors +++ b/Autokem/autokem.safetensors @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:7c7a2231ada3bc986e6d16492ef63a4e1e6f62638f9258261f2933d08b28a188 +oid sha256:1642bc950d7a027953e5efa3c2e8806ac2b62250078997c4bccd2e4b192f915f size 470552 diff --git a/OTFbuild/calligra_font_tests.odt b/OTFbuild/calligra_font_tests.odt index 498a840..51a44b6 100644 Binary files a/OTFbuild/calligra_font_tests.odt and b/OTFbuild/calligra_font_tests.odt differ diff --git a/OTFbuild/opentype_features.py b/OTFbuild/opentype_features.py index 1b27797..9cb2530 100644 --- a/OTFbuild/opentype_features.py +++ b/OTFbuild/opentype_features.py @@ -1899,7 +1899,9 @@ def _generate_mark(glyphs, has): # Lowheight adjustment for combining diacritical marks: # shift base anchor Y down so diacritics sit closer to # the shorter base glyph. - if is_dia and g.props.is_low_height: + # Only applies to 'up' marks (and overlay), not 'dn', + # matching Kotlin which only adjusts in STACK_UP/STACK_UP_N_DOWN. + if is_dia and g.props.is_low_height and scat != 'dn': if mark_type == 2: # overlay ay -= SC.H_OVERLAY_LOWERCASE_SHIFTDOWN * SC.SCALE else: # above (type 0) @@ -1937,10 +1939,7 @@ def _generate_mark(glyphs, has): for cp, g in mark_list: mx = mark_anchors.get(cp, 0) - # Cascade nudge_y: the mark2 anchor includes this mark's - # nudge so that the next stacked mark inherits the shift, - # matching the Kotlin engine's nudgeUpwardCounter / nudgeDownwardCounter. - m2y = m2y_base + g.props.nudge_y * SC.SCALE + m2y = m2y_base lines.append( f" pos mark {glyph_name(cp)}" f" mark {class_name};" @@ -1950,6 +1949,46 @@ def _generate_mark(glyphs, has): lines.append("") mkmk_lookup_names.append(mkmk_name) + # --- Nudge-Y gap correction for MarkToMark --- + # Without cascade, the gap between consecutive 'up' marks is + # H_DIACRITICS + nudge_y_2 - nudge_y_1 + # which is less than H_DIACRITICS when nudge_y_1 > nudge_y_2 + # (e.g. Cyrillic uni2DED nudge=2 followed by uni0487 nudge=0). + # Add contextual positioning to compensate: shift mark2 up by + # (nudge_y_1 - nudge_y_2) * SCALE for each such pair. + # This keeps Thai correct (same nudge on both marks → no correction) + # while fixing Cyrillic (different nudge → correction applied). + nudge_groups = {} # nudge_y -> [glyph_name, ...] + for (mark_type, align, is_dia, scat), mark_list in sorted(mark_groups.items()): + if scat != 'up': + continue + for cp, g in mark_list: + ny = g.props.nudge_y + nudge_groups.setdefault(ny, []).append(glyph_name(cp)) + + distinct_nudges = sorted(nudge_groups.keys()) + correction_pairs = [] + for n1 in distinct_nudges: + for n2 in distinct_nudges: + if n1 > n2: + correction_pairs.append((n1, n2, (n1 - n2) * SC.SCALE)) + + if correction_pairs: + for ny, glyphs in sorted(nudge_groups.items()): + lines.append(f"@up_nudge_{ny} = [{' '.join(sorted(glyphs))}];") + lines.append("") + + mkmk_corr_name = "mkmk_nudge_correct" + lines.append(f"lookup {mkmk_corr_name} {{") + for n1, n2, val in correction_pairs: + lines.append( + f" pos @up_nudge_{n1} <0 0 0 0>" + f" @up_nudge_{n2} <0 {val} 0 0>;" + ) + lines.append(f"}} {mkmk_corr_name};") + lines.append("") + mkmk_lookup_names.append(mkmk_corr_name) + # Register MarkToBase lookups under mark. # dev2 is excluded: HarfBuzz/DirectWrite use abvm for Devanagari marks. # deva is INCLUDED: CoreText's old-Indic shaper may need mark/mkmk diff --git a/demo.PNG b/demo.PNG index 1112225..3b14a54 100644 Binary files a/demo.PNG and b/demo.PNG differ diff --git a/src/assets/cyrilic_bulgarian_variable.tga b/src/assets/cyrilic_bulgarian_variable.tga index dc35bfb..1cf4a14 100755 --- a/src/assets/cyrilic_bulgarian_variable.tga +++ b/src/assets/cyrilic_bulgarian_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:b953eb18ddd16423a63487cdae211c3e8cfd1ce4da4fc91995f698f8724cb18f +oid sha256:e6d5079e76b4e8acd64da5bc47186e470e6955e1b42f5c9ee2fe055c741a1fb7 size 122898 diff --git a/src/assets/cyrilic_extB_variable.tga b/src/assets/cyrilic_extB_variable.tga index 3e948e6..06d65d1 100644 --- a/src/assets/cyrilic_extB_variable.tga +++ b/src/assets/cyrilic_extB_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:1c4e8c1554973f1b598d6d0ee058ed75e38c8094f7a9aae3c612170184b0d8d7 +oid sha256:64e02bb7a93fc9d0d32187dd5caa91d89e6d40634548cfac15ef117fa1484904 size 122898 diff --git a/src/assets/cyrilic_serbian_variable.tga b/src/assets/cyrilic_serbian_variable.tga index 7de40fe..0e0720c 100755 --- a/src/assets/cyrilic_serbian_variable.tga +++ b/src/assets/cyrilic_serbian_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e86fdb10fa3751db3b8e094dd3aabf612f7f18f87862084f7013d91ef77f17bf +oid sha256:200e160352cbc91354f51656df9814ac1fcbbcfa4dba1fc9b0d4cba18c4eddd7 size 122898 diff --git a/src/assets/cyrilic_variable.tga b/src/assets/cyrilic_variable.tga index 8806c01..659730d 100755 --- a/src/assets/cyrilic_variable.tga +++ b/src/assets/cyrilic_variable.tga @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:82b3c8029869167835bf36be351553fb4ad39dc5d39cc29c21e48e5f7f16f379 +oid sha256:a9c096d50aba9d4aa8812fbe69db8acf916f25ac0361aeaab3fb585cee2c629d size 389138 diff --git a/work_files/cyrilic_bulgarian_variable.psd b/work_files/cyrilic_bulgarian_variable.psd index d3373ca..fea0099 100644 --- a/work_files/cyrilic_bulgarian_variable.psd +++ b/work_files/cyrilic_bulgarian_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:614c8f8700452ff79af2fb7f3920d2bdf36c572c92cb1e15088678b714b672fa -size 113998 +oid sha256:801dd965ae07b23b782a92062fef5bce1a3902cdd2a3b4d65113dfbeff811b2c +size 115026 diff --git a/work_files/cyrilic_extB_variable.kra b/work_files/cyrilic_extB_variable.kra index 23285b7..66beaed 100644 --- a/work_files/cyrilic_extB_variable.kra +++ b/work_files/cyrilic_extB_variable.kra @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:14ac604d3cdc35f96194614b75e8f9a13a2b531c3a16ea359951d66fde8957f5 -size 60537 +oid sha256:f8f7770989e0e1e10cfdabeacfd9813b38e29f4cd18a2048b29163aacca5a943 +size 60566 diff --git a/work_files/cyrilic_serbian_variable.psd b/work_files/cyrilic_serbian_variable.psd index eb97324..2b44877 100644 --- a/work_files/cyrilic_serbian_variable.psd +++ b/work_files/cyrilic_serbian_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:eede1eb176c094eb7c81dbc4e20c375c268f99eafd36b4c988c4bc21badb7bb6 -size 119478 +oid sha256:ea7da24931ed5a796eb11446fe1c9cd6e7c05ebcc5f00a63c42880dd49029942 +size 119522 diff --git a/work_files/cyrilic_variable.psd b/work_files/cyrilic_variable.psd index e24a30f..81489f1 100644 --- a/work_files/cyrilic_variable.psd +++ b/work_files/cyrilic_variable.psd @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:33eee66b2e52291e9bd807944294e4eaa281569a0454a0314ded8e56c26546d4 -size 419460 +oid sha256:2b26d40498a78f0edb7c89987ea046e8665682dadad1ba40faca5dbbf5658420 +size 419551