예제 #1
0
  def check_gdef(self):
    if self._skip('gdef'):
      return

    mark_glyphs = [cp for cp in self.target_chars if unicode_data.category(cp) == 'Mn']
    if self._check_gdef_class_defs(mark_glyphs):
      self._check_gdef_marks(mark_glyphs)
      self._check_gdef_combining()
예제 #2
0
  def check_gdef(self):
    if self._skip('gdef'):
      return

    mark_glyphs = [cp for cp in self.target_chars if unicode_data.category(cp) == 'Mn']
    if self._check_gdef_class_defs(mark_glyphs):
      self._check_gdef_marks(mark_glyphs)
      self._check_gdef_combining()
예제 #3
0
def _write_char_text(chars, filepath, chars_per_line):
  text = [unichr(cp) for cp in chars
          if not unicode_data.category(cp)[0] in ['M', 'C', 'Z']]
  filename, _ = path.splitext(path.basename(filepath))
  m = re.match(r'(.*)-(?:Regular|Bold|Italic|BoldItalic)', filename)
  if m:
    filename = m.group(1)
  filename += '_chars.txt'
  print 'writing file: %s' % filename
  print '%d characters (of %d)' % (len(text), len(chars))
  if chars_per_line > 0:
    lines = []
    for n in range(0, len(text), chars_per_line):
      substr = text[n:n + chars_per_line]
      lines.append(' '.join(cp for cp in substr))
    text = '\n'.join(lines)
  with codecs.open(filename, 'w', 'utf-8') as f:
    f.write(text)
예제 #4
0
 def accept_cp(cp):
   cat = unicode_data.category(cp)
   return cat[0] not in ['M', 'C', 'Z'] or cat == 'Co'
예제 #5
0
def sample_text_from_exemplar(exemplar):
    exemplar = [
        c for c in exemplar if unicode_data.category(c[0])[0] in 'LNPS'
    ]
    exemplar = exemplar[:EXEMPLAR_CUTOFF_SIZE]
    return ' '.join(exemplar)
예제 #6
0
 def accept_cp(cp):
   cat = unicode_data.category(cp)
   return cat[0] not in ['M', 'C', 'Z'] or cat == 'Co'
def sample_text_from_exemplar(exemplar):
    exemplar = [c for c in exemplar
                  if unicode_data.category(c[0])[0] in 'LNPS']
    exemplar = exemplar[:EXEMPLAR_CUTOFF_SIZE]
    return ' '.join(exemplar)
예제 #8
0
 def accept(s):
   return len(s) > 1 or unicode_data.category(s)[0] in cat
예제 #9
0
 def test_category(self):
     """Tests the category() method."""
     self.assertEqual('Co', unicode_data.category(0xF0001))
     self.assertEqual('Cn', unicode_data.category(0xE01F0))
예제 #10
0
 def accept(s):
     return len(s) > 1 or unicode_data.category(s)[0] in cat