<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def _getCharWidths(self, xref, bfname, ext, ordering, limit, idx=0):
 """Return list of glyphs and glyph widths of a font."""

        if self.isClosed or self.isEncrypted:
            raise ValueError("operation illegal for closed / encrypted doc")

        return _fitz.Document__getCharWidths(self, xref, bfname, ext, ordering, limit, idx)