def getTJstr(text, glyphs, simple, ordering):
if text.startswith("<STR_LIT>") and text.endswith("<STR_LIT>"): <EOL><INDENT>return text<EOL><DEDENT>if not bool(text):<EOL><INDENT>return "<STR_LIT>"<EOL><DEDENT>if simple:<EOL><INDENT>if glyphs is None:             <EOL><INDENT>otxt = "<STR_LIT>".join([hex(ord(c))[<NUM_LIT:2>:].rjust(<NUM_LIT:2>, "<STR_LIT:0>") if ord(c)<<NUM_LIT> else "<STR_LIT>" for c in text])<EOL><DEDENT>else:                          <EOL><INDENT>otxt = "<STR_LIT>".join([hex(glyphs[ord(c)][<NUM_LIT:0>])[<NUM_LIT:2>:].rjust(<NUM_LIT:2>, "<STR_LIT:0>") if ord(c)<<NUM_LIT> else "<STR_LIT>" for c in text])<EOL><DEDENT>return "<STR_LIT>" + otxt + "<STR_LIT>"<EOL><DEDENT>if ordering < <NUM_LIT:0>:                   <EOL><INDENT>otxt = "<STR_LIT>".join([hex(glyphs[ord(c)][<NUM_LIT:0>])[<NUM_LIT:2>:].rjust(<NUM_LIT:4>, "<STR_LIT:0>") for c in text])<EOL><DEDENT>else:                              <EOL><INDENT>otxt = "<STR_LIT>".join([hex(ord(c))[<NUM_LIT:2>:].rjust(<NUM_LIT:4>, "<STR_LIT:0>") for c in text])<EOL><DEDENT>return "<STR_LIT>" + otxt + "<STR_LIT>"<EOL>
Return a PDF string enclosed in [] brackets, suitable for the PDF TJ
    operator.

    Notes:
        The input string is converted to either 2 or 4 hex digits per character.
    Args:
        simple: no glyphs: 2-chars, use char codes as the glyph
                glyphs: 2-chars, use glyphs instead of char codes (Symbol,
                ZapfDingbats)
        not simple: ordering < 0: 4-chars, use glyphs not char codes
                    ordering >=0: a CJK font! 4 chars, use char codes as glyphs