Some characters in:
[hebrew.pdf](https://github.com/mozilla/pdf.js/files/5869562/hebrew.pdf)
are not correct in the text layer (such as question marks).

We get text direction in `evaluator.js` but we don't use it.
It was used in the past, but it seems it has been removed:
https://github.com/mozilla/pdf.js/commit/5bd8a83c9bd7c23003b09e1cfd71422c6b083826#diff-579f2fb8055052aa97906d5fc75aeee84aa7dd9f8efcca24d8a5460d828e1de8L170

*   render (the object is returned by the page's `getTextContent` method).
 * @property {ReadableStream} [textContentStream] - Text content stream to
 *   render (the stream is returned by the page's `streamTextContent` method).
 * @property {HTMLElement} container - HTML element that will contain text runs.
 * @property {import("./display_utils").PageViewport} viewport - The target
 *   viewport to properly layout the text runs.
 * @property {Array<HTMLElement>} [textDivs] - HTML elements that are correspond
 *   to the text items of the textContent input. This is output and shall be
 *   initially be set to empty array.
 * @property {Array<string>} [textContentItemsStr] - Strings that correspond to
 *    the `str` property of the text items of textContent input. This is output
 *   and shall be initially be set to empty array.
 * @property {number} [timeout] - Delay in milliseconds before rendering of the
 *   text runs occurs.
 * @property {boolean} [enhanceTextSelection] - Whether to turn on the text
 *   selection enhancement.
 */
/**
 * @typedef {Object} TextLayerRenderTask
 * @property {Promise<void>} promise
 * @property {() => void} cancel
 * @property {(expandDivs: boolean) => void} expandTextDivs
 */
/**
 * @type {(renderParameters: TextLayerRenderParameters) => TextLayerRenderTask}
 */
const renderTextLayer = (function renderTextLayerClosure() {
  const MAX_TEXT_DIVS_TO_RENDER = 100000;
  const NonWhitespaceRegexp = /\S/;
  function isAllWhitespace(str) {