Insert a dotted circle within <U+0B85, U+0BC2>
diff --git a/src/gen-vowel-constraints.py b/src/gen-vowel-constraints.py
index 8ca90c8..190c041 100755
--- a/src/gen-vowel-constraints.py
+++ b/src/gen-vowel-constraints.py
@@ -25,7 +25,7 @@
import sys
if len (sys.argv) != 3:
- print ('usage: ./gen-vowel-constraints.py HBIndicVowelConstraints.txt Scripts.txt', file=sys.stderr)
+ print ('usage: ./gen-vowel-constraints.py IndicShapingInvalidCluster.txt Scripts.txt', file=sys.stderr)
sys.exit (1)
with io.open (sys.argv[2], encoding='utf-8') as f:
@@ -84,7 +84,8 @@
else:
self._c[first] = ConstraintSet (rest)
- def _indent (self, depth):
+ @staticmethod
+ def _indent (depth):
return (' ' * depth).replace (' ', '\t')
def __str__ (self, index=0, depth=4):
@@ -92,17 +93,20 @@
indent = self._indent (depth)
if isinstance (self._c, list):
if len (self._c) == 0:
+ assert index == 2, 'Cannot use `matched` for this constraint; the general case has not been implemented'
s.append ('{}matched = true;\n'.format (indent))
elif len (self._c) == 1:
+ assert index == 1, 'Cannot use `matched` for this constraint; the general case has not been implemented'
s.append ('{}matched = 0x{:04X}u == buffer->cur ({}).codepoint;\n'.format (indent, next (iter (self._c)), index or ''))
else:
- s.append ('{}if (0x{:04X}u == buffer->cur ({}).codepoint &&\n'.format (indent, self._c[0], index))
- s.append ('{}buffer->idx + {} < count &&\n'.format (self._indent (depth + 2), len (self._c)))
+ s.append ('{}if (0x{:04X}u == buffer->cur ({}).codepoint &&\n'.format (indent, self._c[0], index or ''))
+ if index:
+ s.append ('{}buffer->idx + {} < count &&\n'.format (self._indent (depth + 2), index + 1))
for i, cp in enumerate (self._c[1:], start=1):
s.append ('{}0x{:04X}u == buffer->cur ({}).codepoint{}\n'.format (
self._indent (depth + 2), cp, index + i, ')' if i == len (self._c) - 1 else ' &&'))
s.append ('{}{{\n'.format (indent))
- for i in range (len (self._c)):
+ for i in range (index + 1):
s.append ('{}buffer->next_glyph ();\n'.format (self._indent (depth + 1)))
s.append ('{}_output_dotted_circle (buffer);\n'.format (self._indent (depth + 1)))
s.append ('{}}}\n'.format (indent))
@@ -128,7 +132,12 @@
constraints = {}
with io.open (sys.argv[1], encoding='utf-8') as f:
- constraints_header = [f.readline ().strip () for i in range (2)]
+ constraints_header = []
+ while True:
+ line = f.readline ().strip ()
+ if line == '#':
+ break
+ constraints_header.append(line)
for line in f:
j = line.find ('#')
if j >= 0:
@@ -147,7 +156,7 @@
print ('/*')
print (' * The following functions are generated by running:')
print (' *')
-print (' * %s use Scripts.txt' % sys.argv[0])
+print (' * %s IndicShapingInvalidCluster.txt Scripts.txt' % sys.argv[0])
print (' *')
print (' * on files with these headers:')
print (' *')
@@ -185,7 +194,7 @@
print ('\t\t\t\t hb_buffer_t *buffer,')
print ('\t\t\t\t hb_font_t *font HB_UNUSED)')
print ('{')
-print ('#if defined(HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS)')
+print ('#ifdef HB_NO_OT_SHAPE_COMPLEX_VOWEL_CONSTRAINTS')
print (' return;')
print ('#endif')
print (' if (buffer->flags & HB_BUFFER_FLAG_DO_NOT_INSERT_DOTTED_CIRCLE)')