mirror of
https://github.com/curioustorvald/Terrarum-sans-bitmap.git
synced 2026-03-07 11:51:50 +09:00
a hack was added
This commit is contained in:
@@ -1197,7 +1197,7 @@ def _generate_psts_anusvara(glyphs, has, conjuncts):
|
||||
)
|
||||
|
||||
# Direct predecessor triggers
|
||||
for cp in [0x093E, 0x0948, 0x094C, 0x094F]:
|
||||
for cp in [0x093A, 0x093E, 0x0948, 0x094C, 0x094F]:
|
||||
if has(cp):
|
||||
body.append(
|
||||
f" sub {glyph_name(cp)}"
|
||||
@@ -1537,10 +1537,13 @@ def _generate_anusvara_gpos(glyphs, has):
|
||||
shift3_triggers = [cp for cp in [0x094F, SC.DEVANAGARI_RA_SUPER_COMPLEX]
|
||||
if has(cp)]
|
||||
# +2px triggers: uni0948, uni094C, simple reph
|
||||
shift2_triggers = [cp for cp in [0x093A, 0x0948, 0x094C, SC.DEVANAGARI_RA_SUPER]
|
||||
shift2_triggers = [cp for cp in [0x0948, 0x094C, SC.DEVANAGARI_RA_SUPER]
|
||||
if has(cp)]
|
||||
|
||||
if not shift3_triggers and not shift2_triggers:
|
||||
shift2_up2_triggers = [cp for cp in [0x093A]
|
||||
if has(cp)]
|
||||
|
||||
if not shift3_triggers and not shift2_triggers and not shift2_up2_triggers:
|
||||
return ""
|
||||
|
||||
lines = []
|
||||
@@ -1550,6 +1553,11 @@ def _generate_anusvara_gpos(glyphs, has):
|
||||
lines.append(f" pos {glyph_name(anusvara_lower)} <100 0 0 0>;")
|
||||
lines.append(f"}} AnusvaraShift2;")
|
||||
|
||||
if shift2_up2_triggers:
|
||||
lines.append(f"lookup AnusvaraShift2Up2 {{")
|
||||
lines.append(f" pos {glyph_name(anusvara_lower)} <100 100 0 0>;") # float up by two pixels. This is a hack
|
||||
lines.append(f"}} AnusvaraShift2Up2;")
|
||||
|
||||
if shift3_triggers:
|
||||
lines.append(f"lookup AnusvaraShift3 {{")
|
||||
lines.append(f" pos {glyph_name(anusvara_lower)} <150 0 0 0>;")
|
||||
@@ -1568,6 +1576,11 @@ def _generate_anusvara_gpos(glyphs, has):
|
||||
f" pos {glyph_name(cp)}"
|
||||
f" {glyph_name(anusvara_lower)}' lookup AnusvaraShift2;"
|
||||
)
|
||||
for cp in shift2_up2_triggers:
|
||||
lines.append(
|
||||
f" pos {glyph_name(cp)}"
|
||||
f" {glyph_name(anusvara_lower)}' lookup AnusvaraShift2Up2;"
|
||||
)
|
||||
lines.append("} abvm;")
|
||||
|
||||
return '\n'.join(lines)
|
||||
|
||||
@@ -1258,8 +1258,11 @@ class TerrarumSansBitmap(
|
||||
val effectivePrev = if (hasReph) str.getOrElse(charIndex - 2) { -1 } else prev
|
||||
if (effectivePrev == 0x094F || hasComplexReph) {
|
||||
posXbuffer[charIndex] += 3
|
||||
} else if (effectivePrev in intArrayOf(0x093A, 0x0948, 0x094C) || hasSimpleReph) {
|
||||
} else if (effectivePrev in intArrayOf(0x0948, 0x094C) || hasSimpleReph) {
|
||||
posXbuffer[charIndex] += 2
|
||||
} else if (effectivePrev == 0x093A) {
|
||||
posXbuffer[charIndex] += 2
|
||||
posYbuffer[charIndex] += 2 // float up by two pixels. This is a hack
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1896,7 +1899,7 @@ class TerrarumSansBitmap(
|
||||
// 094E (prishthamatra) is reordered before the consonant cluster,
|
||||
// so scan backward to find it
|
||||
val hasPrishthamatra = (1..5).any { j -> seq4.getOrElse(i - j) { -1 } == 0x094E }
|
||||
if (effectivePrev in intArrayOf(0x093E, 0x0948, 0x094C, 0x094F) || hasPrishthamatra || hasReph) {
|
||||
if (effectivePrev in intArrayOf(0x093A, 0x093E, 0x0948, 0x094C, 0x094F) || hasPrishthamatra || hasReph) {
|
||||
seq4[i] = DEVANAGARI_ANUSVARA_LOWER
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user