diff --git a/OTFbuild/calligra_font_tests.odt b/OTFbuild/calligra_font_tests.odt index 687354a..bc904ae 100644 Binary files a/OTFbuild/calligra_font_tests.odt and b/OTFbuild/calligra_font_tests.odt differ diff --git a/OTFbuild/font_builder.py b/OTFbuild/font_builder.py index db8c411..f7e161c 100644 --- a/OTFbuild/font_builder.py +++ b/OTFbuild/font_builder.py @@ -281,7 +281,13 @@ def build_font(assets_dir, output_path, no_bitmap=False, no_features=False): if advance == 0: x_offset -= g.props.nudge_x * SCALE - y_offset = -g.props.nudge_y * SCALE + # For STACK_DOWN marks (below-base diacritics), negative nudge_y + # means "shift content down to below baseline". The sign convention + # is opposite to non-marks where positive nudge_y means shift down. + if g.props.stack_where == SC.STACK_DOWN and g.props.write_on_top >= 0: + y_offset = g.props.nudge_y * SCALE + else: + y_offset = -g.props.nudge_y * SCALE contours = trace_bitmap(g.bitmap, g.props.width) diff --git a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt index b6bd8af..440684c 100755 --- a/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt +++ b/src/net/torvald/terrarumsansbitmap/gdx/TerrarumSansBitmap.kt @@ -1250,7 +1250,7 @@ class TerrarumSansBitmap( // set Y pos according to diacritics position when (thisProp.stackWhere) { GlyphProps.STACK_DOWN -> { - posYbuffer[charIndex] = -thisProp.nudgeY + (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign() stackDownwardCounter++ } GlyphProps.STACK_UP -> { @@ -1272,11 +1272,11 @@ class TerrarumSansBitmap( // dbgprn("lastNonDiacriticChar: ${lastNonDiacriticChar.charInfo()}; stack counter: $stackUpwardCounter") } GlyphProps.STACK_UP_N_DOWN -> { - posYbuffer[charIndex] = -thisProp.nudgeY + (H_DIACRITICS * stackDownwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = (-thisProp.nudgeY + H_DIACRITICS * stackDownwardCounter) * flipY.toSign() stackDownwardCounter++ - posYbuffer[charIndex] = -thisProp.nudgeY + (-H_DIACRITICS * stackUpwardCounter + -thisProp.nudgeY) * flipY.toSign() + posYbuffer[charIndex] = (-thisProp.nudgeY + -H_DIACRITICS * stackUpwardCounter) * flipY.toSign() // shift down on lowercase if applicable if (getSheetType(thisChar) in autoShiftDownOnLowercase && lastNonDiacriticChar.isLowHeight()) {