Ejemplo n.º 1
0
            def _read(self):
                self._debug['format']['start'] = self._io.pos()
                self.format = PcfFont.Format(self._io, self, self._root)
                self.format._read()
                self._debug['format']['end'] = self._io.pos()
                self._debug['num_glyphs']['start'] = self._io.pos()
                self.num_glyphs = self._io.read_u4le()
                self._debug['num_glyphs']['end'] = self._io.pos()
                self._debug['names']['start'] = self._io.pos()
                self.names = [None] * (self.num_glyphs)
                for i in range(self.num_glyphs):
                    if not 'arr' in self._debug['names']:
                        self._debug['names']['arr'] = []
                    self._debug['names']['arr'].append({'start': self._io.pos()})
                    _t_names = PcfFont.Table.GlyphNames.StringRef(self._io, self, self._root)
                    _t_names._read()
                    self.names[i] = _t_names
                    self._debug['names']['arr'][i]['end'] = self._io.pos()

                self._debug['names']['end'] = self._io.pos()
                self._debug['len_strings']['start'] = self._io.pos()
                self.len_strings = self._io.read_u4le()
                self._debug['len_strings']['end'] = self._io.pos()
                self._debug['strings']['start'] = self._io.pos()
                self._raw_strings = self._io.read_bytes(self.len_strings)
                _io__raw_strings = KaitaiStream(BytesIO(self._raw_strings))
                self.strings = bytes_with_io.BytesWithIo(_io__raw_strings)
                self.strings._read()
                self._debug['strings']['end'] = self._io.pos()
Ejemplo n.º 2
0
            def _read(self):
                self._debug['format']['start'] = self._io.pos()
                self.format = PcfFont.Format(self._io, self, self._root)
                self.format._read()
                self._debug['format']['end'] = self._io.pos()
                self._debug['num_props']['start'] = self._io.pos()
                self.num_props = self._io.read_u4le()
                self._debug['num_props']['end'] = self._io.pos()
                self._debug['props']['start'] = self._io.pos()
                self.props = [None] * (self.num_props)
                for i in range(self.num_props):
                    if not 'arr' in self._debug['props']:
                        self._debug['props']['arr'] = []
                    self._debug['props']['arr'].append({'start': self._io.pos()})
                    _t_props = PcfFont.Table.Properties.Prop(self._io, self, self._root)
                    _t_props._read()
                    self.props[i] = _t_props
                    self._debug['props']['arr'][i]['end'] = self._io.pos()

                self._debug['props']['end'] = self._io.pos()
                self._debug['padding']['start'] = self._io.pos()
                self.padding = self._io.read_bytes((0 if (self.num_props & 3) == 0 else (4 - (self.num_props & 3))))
                self._debug['padding']['end'] = self._io.pos()
                self._debug['len_strings']['start'] = self._io.pos()
                self.len_strings = self._io.read_u4le()
                self._debug['len_strings']['end'] = self._io.pos()
                self._debug['strings']['start'] = self._io.pos()
                self._raw_strings = self._io.read_bytes(self.len_strings)
                _io__raw_strings = KaitaiStream(BytesIO(self._raw_strings))
                self.strings = bytes_with_io.BytesWithIo(_io__raw_strings)
                self.strings._read()
                self._debug['strings']['end'] = self._io.pos()
Ejemplo n.º 3
0
 def _read(self):
     self._debug['decompressor_id']['start'] = self._io.pos()
     self.decompressor_id = self._io.read_s2be()
     self._debug['decompressor_id']['end'] = self._io.pos()
     self._debug['decompressor_specific_parameters_with_io']['start'] = self._io.pos()
     self._raw_decompressor_specific_parameters_with_io = self._io.read_bytes(4)
     _io__raw_decompressor_specific_parameters_with_io = KaitaiStream(BytesIO(self._raw_decompressor_specific_parameters_with_io))
     self.decompressor_specific_parameters_with_io = bytes_with_io.BytesWithIo(_io__raw_decompressor_specific_parameters_with_io)
     self.decompressor_specific_parameters_with_io._read()
     self._debug['decompressor_specific_parameters_with_io']['end'] = self._io.pos()
Ejemplo n.º 4
0
 def _read(self):
     self._debug['common_part']['start'] = self._io.pos()
     self.common_part = CompressedResource.Header.CommonPart(self._io, self, self._root)
     self.common_part._read()
     self._debug['common_part']['end'] = self._io.pos()
     self._debug['type_specific_part_raw_with_io']['start'] = self._io.pos()
     self._raw_type_specific_part_raw_with_io = self._io.read_bytes((self.common_part.len_header - 12))
     _io__raw_type_specific_part_raw_with_io = KaitaiStream(BytesIO(self._raw_type_specific_part_raw_with_io))
     self.type_specific_part_raw_with_io = bytes_with_io.BytesWithIo(_io__raw_type_specific_part_raw_with_io)
     self.type_specific_part_raw_with_io._read()
     self._debug['type_specific_part_raw_with_io']['end'] = self._io.pos()
Ejemplo n.º 5
0
            def _read(self):
                self.format = PcfFont.Format(self._io, self, self._root)
                self.num_glyphs = self._io.read_u4le()
                self.names = []
                for i in range(self.num_glyphs):
                    self.names.append(
                        PcfFont.Table.GlyphNames.StringRef(
                            self._io, self, self._root))

                self.len_strings = self._io.read_u4le()
                self._raw_strings = self._io.read_bytes(self.len_strings)
                _io__raw_strings = KaitaiStream(BytesIO(self._raw_strings))
                self.strings = bytes_with_io.BytesWithIo(_io__raw_strings)
Ejemplo n.º 6
0
    def data_blocks_with_io(self):
        """Use `data_blocks` instead,
        unless you need access to this instance's `_io`.
        """
        if hasattr(self, '_m_data_blocks_with_io'):
            return self._m_data_blocks_with_io

        _pos = self._io.pos()
        self._io.seek(self.header.ofs_data_blocks)
        self._raw__m_data_blocks_with_io = self._io.read_bytes(self.header.len_data_blocks)
        _io__raw__m_data_blocks_with_io = KaitaiStream(BytesIO(self._raw__m_data_blocks_with_io))
        self._m_data_blocks_with_io = bytes_with_io.BytesWithIo(_io__raw__m_data_blocks_with_io)
        self._io.seek(_pos)
        return getattr(self, '_m_data_blocks_with_io', None)
Ejemplo n.º 7
0
        def names_with_io(self):
            """Use `names` instead,
            unless you need access to this instance's `_io`.
            """
            if hasattr(self, '_m_names_with_io'):
                return self._m_names_with_io

            _pos = self._io.pos()
            self._io.seek(self.ofs_names)
            self._raw__m_names_with_io = self._io.read_bytes_full()
            _io__raw__m_names_with_io = KaitaiStream(BytesIO(self._raw__m_names_with_io))
            self._m_names_with_io = bytes_with_io.BytesWithIo(_io__raw__m_names_with_io)
            self._io.seek(_pos)
            return getattr(self, '_m_names_with_io', None)
Ejemplo n.º 8
0
            def _read(self):
                self.format = PcfFont.Format(self._io, self, self._root)
                self.num_props = self._io.read_u4le()
                self.props = []
                for i in range(self.num_props):
                    self.props.append(
                        PcfFont.Table.Properties.Prop(self._io, self,
                                                      self._root))

                self.padding = self._io.read_bytes(
                    (0 if (self.num_props & 3) == 0 else
                     (4 - (self.num_props & 3))))
                self.len_strings = self._io.read_u4le()
                self._raw_strings = self._io.read_bytes(self.len_strings)
                _io__raw_strings = KaitaiStream(BytesIO(self._raw_strings))
                self.strings = bytes_with_io.BytesWithIo(_io__raw_strings)