From f186612cab271b16bb929fbdb8571d03bb265160 Mon Sep 17 00:00:00 2001 From: Dominik Hufnagel Date: Thu, 7 Jan 2021 17:50:52 +0100 Subject: [PATCH] set font size to input element --- src/display/annotation_layer.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/display/annotation_layer.js b/src/display/annotation_layer.js index 5d2462d8aa13fb..27d48794522caf 100644 --- a/src/display/annotation_layer.js +++ b/src/display/annotation_layer.js @@ -625,6 +625,16 @@ class TextWidgetAnnotationElement extends WidgetAnnotationElement { element.setAttribute("value", textContent); } + if (this.data.defaultAppearance) { + let fontDescription = this.data.defaultAppearance.match(/(\w+)\s(\d+)\sTf/); + if (fontDescription) { + let fontSize = parseInt(fontDescription[2]); + if (fontSize > 0) { + element.style.fontSize = `${fontSize}px`; + } + } + } + elementData.userValue = textContent; element.setAttribute("id", id);