mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-06-28 02:55:49 +02:00
Add support for line ending in FreeTextAnnotation callouts.
This commit is contained in:
parent
4f1078dc63
commit
fe2680fa9b
@ -969,6 +969,37 @@ class Annotation {
|
||||
this.color = getRgbColor(color);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the line ending; should only be used with FreeText annotations.
|
||||
* @param {Name} lineEnding - The line ending name.
|
||||
*/
|
||||
setLineEnding(lineEnding) {
|
||||
if (typeof PDFJSDev !== "undefined" && PDFJSDev.test("MOZCENTRAL")) {
|
||||
throw new Error("Not implemented: setLineEnding");
|
||||
}
|
||||
|
||||
this.lineEnding = "None"; // The default value.
|
||||
|
||||
if (lineEnding instanceof Name) {
|
||||
switch (lineEnding.name) {
|
||||
case "None":
|
||||
return;
|
||||
case "Square":
|
||||
case "Circle":
|
||||
case "Diamond":
|
||||
case "OpenArrow":
|
||||
case "ClosedArrow":
|
||||
case "Butt":
|
||||
case "ROpenArrow":
|
||||
case "RClosedArrow":
|
||||
case "Slash":
|
||||
this.lineEnding = lineEnding.name;
|
||||
return;
|
||||
}
|
||||
}
|
||||
warn(`Ignoring invalid lineEnding: ${lineEnding}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the line endings; should only be used with specific annotation types.
|
||||
* @param {Array} lineEndings - The line endings array.
|
||||
@ -3882,11 +3913,16 @@ class FreeTextAnnotation extends MarkupAnnotation {
|
||||
// We want to be able to add mouse listeners to the annotation.
|
||||
this.data.noHTML = false;
|
||||
|
||||
const { evaluatorOptions, xref } = params;
|
||||
const { evaluatorOptions, xref, dict } = params;
|
||||
this.data.annotationType = AnnotationType.FREETEXT;
|
||||
this.setDefaultAppearance(params);
|
||||
this._hasAppearance = !!this.appearance;
|
||||
|
||||
if (typeof PDFJSDev === "undefined" || !PDFJSDev.test("MOZCENTRAL")) {
|
||||
this.setLineEnding(dict.getArray("LE"));
|
||||
this.data.lineEnding = this.lineEnding;
|
||||
}
|
||||
|
||||
if (this._hasAppearance) {
|
||||
const { fontColor, fontSize } = parseAppearanceStream(
|
||||
this.appearance,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user