class_docstr: A page layout analyzer that pays attention to text visibility.
class_docstr_tok: ["A","page","layout","analyzer","that","pays","attention","to","text","visibility","."]
docstr: Respond to render char event by updating text state.
docstr_tok: ["Respond","to","render","char","event","by","updating","text","state","."]
code: def render_char(
      self,
      matrix: Matrix,
      font: PDFFont,
      fontsize: float,
      scaling: float,
      rise: float,
      cid: int,
      ncs: PDFColorSpace,
      graphicstate: PDFGraphicState,
  ) -> float:
      """Respond to render char event by updating text state."""
      try:
          text = font.to_unichr(cid)
          assert isinstance(text, str), str(type(text))
      except PDFUnicodeNotDefined:
          text = self.handle_undefined_char(font, cid)
      textwidth = font.char_width(cid)
      textdisp = font.char_disp(cid)
      item = LTStateAwareChar(
          matrix,
          font,
          fontsize,
          scaling,
          rise,
          text,
          textwidth,
          textdisp,
          ncs,
          graphicstate,
          self.textstate,
      )
      self.cur_item.add(item)
      return item.adv
  
imports: from __future__ import annotations
  import re
  from collections.abc import Mapping
  from contextlib import contextmanager
  from math import copysign
  from os import PathLike
  from pathlib import Path
  from typing import Any, Iterator
  from unittest.mock import patch
  import pdfminer
  import pdfminer.encodingdb
  import pdfminer.pdfdevice
  import pdfminer.pdfinterp
  from pdfminer.converter import PDFLayoutAnalyzer
  from pdfminer.layout import LAParams, LTChar, LTPage, LTTextBox
  from pdfminer.pdfcolor import PDFColorSpace
  from pdfminer.pdfdevice import PDFTextSeq
  from pdfminer.pdfdocument import PDFTextExtractionNotAllowed
  from pdfminer.pdffont import FontWidthDict, PDFFont, PDFSimpleFont, PDFUnicodeNotDefined
  from pdfminer.pdfinterp import PDFGraphicState, PDFResourceManager, PDFTextState
  from pdfminer.pdfpage import PDFPage
  from pdfminer.utils import Matrix, bbox2str, matrix2str
  from ocrmypdf.exceptions import EncryptedPdfError, InputFileError
label_desc: Use image node_id 5 for calling the TextPositionTracker obj's underlying member method code with example usage: obj.render_char(matrix, font, fontsize, scaling, rise, cid, ncs, graphicstate) and returns: item