Beispiel #1
0
    def __getcharmaps__():
        f = open(get_from_cache('AdobeSourceSansDevanagariGlyphOrderAndAliasDB.txt', URL), 'r')

        glyphnames = []
        for line in f:
            glyphnames += [re.sub(r'\s+', ' ', line).split()]

        return [type('Charmap', (object,),
                     dict(glyphnames=glyphnames,
                          common_name='Unencoded Glyphs',
                          short_name='unencoded-glyphs',
                          native_name=''))]
Beispiel #2
0
    def __getcharmaps__():
        content = open(get_from_cache('Blocks.txt', UNIDATA_URL), 'r').read()

        regex = re.compile('^([\da-f]+)..([\da-f]+);\s*(.*)$', re.I | re.U)
        for line in content.split('\n'):
            m = regex.match(line.strip())
            # 100000..10FFFF; Supplementary Private Use Area-B
            if not m:
                continue

            glyphlist = '0x%s-0x%s' % (m.group(1), m.group(2))
            unicodes = Extension.convert_to_list_of_unicodes(glyphlist)
            yield type('Charmap', (object,),
                       dict(glyphs=unicodes,
                            common_name=u'Unicode Block %s' % m.group(3),
                            native_name=''))
Beispiel #3
0
    def __getcharsets__():
        f = open(get_from_cache("AdobeSourceSansDevanagariGlyphOrderAndAliasDB.txt", URL), "r")

        glyphnames = []
        for line in f:
            glyphnames += [re.sub(r"\s+", " ", line).split()]

        return [
            type(
                "Charset",
                (object,),
                dict(
                    glyphnames=glyphnames, common_name="Unencoded Glyphs", short_name="unencoded-glyphs", native_name=""
                ),
            )
        ]
Beispiel #4
0
    def __getcharsets__():
        f = open(
            get_from_cache('AdobeSourceSansDevanagariGlyphOrderAndAliasDB.txt',
                           URL), 'r')

        glyphnames = []
        for line in f:
            glyphnames += [re.sub(r'\s+', ' ', line).split()]

        return [
            type(
                'Charset', (object, ),
                dict(glyphnames=glyphnames,
                     common_name='Unencoded Glyphs',
                     short_name='unencoded-glyphs',
                     native_name=''))
        ]
Beispiel #5
0
    def __getcharsets__():
        content = open(get_from_cache('Blocks.txt', UNIDATA_URL), 'r', encoding='utf-8').read()

        regex = re.compile('^([\da-f]+)..([\da-f]+);\s*(.*)$', re.I | re.U)
        for line in content.split('\n'):
            m = regex.match(line.strip())
            # 100000..10FFFF; Supplementary Private Use Area-B
            if not m:
                continue

            glyphlist = '0x%s-0x%s' % (m.group(1), m.group(2))
            unicodes = Extension.convert_to_list_of_unicodes(glyphlist)
            yield type('Charset', (object,),
                       dict(glyphs=unicodes,
                            common_name=u'Unicode Block %s' % m.group(3),
                            native_name='',
                            short_name=unicodedata.normalize('NFKD', u'uni-{}'.format(m.group(3).lower().replace(' ', '-')))))
Beispiel #6
0
    def get_codepoints():
        """ Return all XML <scanning-codepoints> in received XML """
        # response = requests.get(EXTENSIS_LANG_XML)
        # if response.status_code != 200:
        #     return []

        path = get_from_cache('languages.xml', EXTENSIS_LANG_XML)

        try:
            xml_content = open(path, 'r').read()
        except IOError:
            logging.error('Could not read languages.xml from cache')
            xml_content = ''

        content = re.sub('<!--.[^>]*-->', '', xml_content)
        doc = etree.fromstring(content.lstrip('`'))

        return doc.findall('.//scanning-codepoints')
Beispiel #7
0
    def get_codepoints():
        """ Return all XML <scanning-codepoints> in received XML """
        # response = requests.get(EXTENSIS_LANG_XML)
        # if response.status_code != 200:
        #     return []

        path = get_from_cache("languages.xml", EXTENSIS_LANG_XML)

        try:
            xml_content = open(path, "r").read()
        except IOError:
            logging.error("Could not read languages.xml from cache")
            xml_content = ""

        content = re.sub("<!--.[^>]*-->", "", xml_content)
        doc = etree.fromstring(content.lstrip("`"))

        return doc.findall(".//scanning-codepoints")
Beispiel #8
0
    def get_codepoints():
        """ Return all XML <scanning-codepoints> in received XML """
        # response = requests.get(EXTENSIS_LANG_XML)
        # if response.status_code != 200:
        #     return []

        path = get_from_cache('languages.xml', EXTENSIS_LANG_XML)

        try:
            xml_content = open(path, 'r').read()
        except IOError:
            logging.error('Could not read languages.xml from cache')
            xml_content = ''

        content = re.sub('<!--.[^>]*-->', '', xml_content)
        doc = etree.fromstring(content.lstrip('`').encode("utf-8"))

        return doc.findall('.//scanning-codepoints')