mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-25 09:38:06 +02:00
Set the text fields font size based on their height
- right now we're using the font size from the pdf itself but we use an other font in the annotation layer. So this size doesn't really make sense and leads to bad rendering (see pdf in #14928); - use a sans-serif font for the fields containing text (fix issue #14736); - remove useless padding in text-based fields (fix issue #14301); - text fields allow/disallow scrolling bars (see bit 24 in Ff entry), so use this value to hide/show scrollbars in annotation layer.
This commit is contained in:
parent
5b3fdee5f5
commit
9d82106d20
7 changed files with 104 additions and 47 deletions
|
@ -24,6 +24,7 @@ import {
|
|||
escapeString,
|
||||
getModificationDate,
|
||||
isAscii,
|
||||
LINE_FACTOR,
|
||||
OPS,
|
||||
RenderingIntentFlag,
|
||||
shadow,
|
||||
|
@ -55,11 +56,6 @@ import { StringStream } from "./stream.js";
|
|||
import { writeDict } from "./writer.js";
|
||||
import { XFAFactory } from "./xfa/factory.js";
|
||||
|
||||
// Represent the percentage of the height of a single-line field over
|
||||
// the font size.
|
||||
// Acrobat seems to use this value.
|
||||
const LINE_FACTOR = 1.35;
|
||||
|
||||
class AnnotationFactory {
|
||||
/**
|
||||
* Create an `Annotation` object of the correct type for the given reference
|
||||
|
@ -1921,6 +1917,7 @@ class TextWidgetAnnotation extends WidgetAnnotation {
|
|||
!this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) &&
|
||||
!this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) &&
|
||||
this.data.maxLen !== null;
|
||||
this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
|
||||
}
|
||||
|
||||
_getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
|
||||
|
@ -2788,6 +2785,9 @@ class LinkAnnotation extends Annotation {
|
|||
this.data.quadPoints = quadPoints;
|
||||
}
|
||||
|
||||
// The color entry for a link annotation is the color of the border.
|
||||
this.data.borderColor = this.data.borderColor || this.data.color;
|
||||
|
||||
Catalog.parseDestDictionary({
|
||||
destDict: params.dict,
|
||||
resultObj: this.data,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue