text_layer.d.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /**
  2. * Text layer render parameters.
  3. */
  4. export type TextLayerRenderParameters = {
  5. /**
  6. * - Text content to
  7. * render (the object is returned by the page's `getTextContent` method).
  8. */
  9. textContent?: import("./api").TextContent | undefined;
  10. /**
  11. * - Text content stream to
  12. * render (the stream is returned by the page's `streamTextContent` method).
  13. */
  14. textContentStream?: ReadableStream<any> | undefined;
  15. /**
  16. * - HTML element that will contain text runs.
  17. */
  18. container: HTMLElement;
  19. /**
  20. * - The target
  21. * viewport to properly layout the text runs.
  22. */
  23. viewport: import("./display_utils").PageViewport;
  24. /**
  25. * - HTML elements that are correspond
  26. * to the text items of the textContent input. This is output and shall be
  27. * initially be set to empty array.
  28. */
  29. textDivs?: HTMLElement[] | undefined;
  30. /**
  31. * - Strings that correspond to
  32. * the `str` property of the text items of textContent input. This is output
  33. * and shall be initially be set to empty array.
  34. */
  35. textContentItemsStr?: string[] | undefined;
  36. /**
  37. * - Delay in milliseconds before rendering of the
  38. * text runs occurs.
  39. */
  40. timeout?: number | undefined;
  41. /**
  42. * - Whether to turn on the text
  43. * selection enhancement.
  44. */
  45. enhanceTextSelection?: boolean | undefined;
  46. };
  47. /**
  48. * @param {TextLayerRenderParameters} renderParameters
  49. * @returns {TextLayerRenderTask}
  50. */
  51. export function renderTextLayer(renderParameters: TextLayerRenderParameters): TextLayerRenderTask;
  52. declare class TextLayerRenderTask {
  53. constructor({ textContent, textContentStream, container, viewport, textDivs, textContentItemsStr, enhanceTextSelection, }: {
  54. textContent: any;
  55. textContentStream: any;
  56. container: any;
  57. viewport: any;
  58. textDivs: any;
  59. textContentItemsStr: any;
  60. enhanceTextSelection: any;
  61. });
  62. _textContent: any;
  63. _textContentStream: any;
  64. _container: any;
  65. _document: any;
  66. _viewport: any;
  67. _textDivs: any;
  68. _textContentItemsStr: any;
  69. _enhanceTextSelection: boolean;
  70. _fontInspectorEnabled: boolean;
  71. _reader: any;
  72. _layoutTextLastFontSize: any;
  73. _layoutTextLastFontFamily: any;
  74. _layoutTextCtx: any;
  75. _textDivProperties: WeakMap<object, any>;
  76. _renderingDone: boolean;
  77. _canceled: boolean;
  78. _capability: import("../shared/util.js").PromiseCapability;
  79. _renderTimer: any;
  80. _bounds: any[];
  81. /**
  82. * Promise for textLayer rendering task completion.
  83. * @type {Promise<void>}
  84. */
  85. get promise(): Promise<void>;
  86. /**
  87. * Cancel rendering of the textLayer.
  88. */
  89. cancel(): void;
  90. /**
  91. * @private
  92. */
  93. private _processItems;
  94. /**
  95. * @private
  96. */
  97. private _layoutText;
  98. /**
  99. * @private
  100. */
  101. private _render;
  102. /**
  103. * @param {boolean} [expandDivs]
  104. */
  105. expandTextDivs(expandDivs?: boolean | undefined): void;
  106. }
  107. export {};