@readium/navigator 2.0.0-beta.2 → 2.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +113 -157
- package/dist/index.umd.cjs +11 -11
- package/package.json +1 -1
- package/src/epub/css/ReadiumCSS.ts +3 -19
- package/src/epub/preferences/EpubDefaults.ts +2 -5
- package/src/epub/preferences/EpubPreferences.ts +2 -5
- package/src/epub/preferences/EpubPreferencesEditor.ts +1 -14
- package/src/epub/preferences/EpubSettings.ts +0 -7
- package/src/helpers/lineLength.ts +22 -74
- package/types/src/epub/css/ReadiumCSS.d.ts +0 -1
- package/types/src/epub/preferences/EpubDefaults.d.ts +0 -2
- package/types/src/epub/preferences/EpubPreferences.d.ts +0 -2
- package/types/src/epub/preferences/EpubPreferencesEditor.d.ts +0 -1
- package/types/src/epub/preferences/EpubSettings.d.ts +0 -2
- package/types/src/helpers/lineLength.d.ts +2 -16
package/package.json
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { LineLengths } from "../../helpers";
|
|
2
2
|
import { getContentWidth } from "../../helpers/dimensions";
|
|
3
3
|
import { LayoutStrategy } from "../../preferences";
|
|
4
4
|
import { EpubSettings } from "../preferences/EpubSettings";
|
|
5
5
|
import { IUserProperties, RSProperties, UserProperties } from "./Properties";
|
|
6
6
|
|
|
7
|
-
type ILineLengthsProps = {
|
|
8
|
-
[K in Exclude<keyof ILineLengthsConfig, "fontSize" | "sample" | "isCJK" | "getRelative">]?: ILineLengthsConfig[K]
|
|
9
|
-
};
|
|
10
|
-
|
|
11
7
|
export interface IReadiumCSS {
|
|
12
8
|
rsProperties: RSProperties;
|
|
13
9
|
userProperties: UserProperties;
|
|
@@ -55,13 +51,12 @@ export class ReadiumCSS {
|
|
|
55
51
|
|
|
56
52
|
// This has to be updated before pagination
|
|
57
53
|
// otherwise the metrics won’t be correct for line length
|
|
58
|
-
this.
|
|
54
|
+
this.lineLengths.update({
|
|
59
55
|
fontFace: settings.fontFamily,
|
|
60
56
|
letterSpacing: settings.letterSpacing,
|
|
61
57
|
pageGutter: settings.pageGutter,
|
|
62
58
|
wordSpacing: settings.wordSpacing,
|
|
63
59
|
optimalChars: settings.optimalLineLength,
|
|
64
|
-
userChars: settings.lineLength,
|
|
65
60
|
minChars: settings.minimalLineLength,
|
|
66
61
|
maxChars: settings.maximalLineLength
|
|
67
62
|
});
|
|
@@ -131,17 +126,6 @@ export class ReadiumCSS {
|
|
|
131
126
|
this.userProperties = new UserProperties(updated);
|
|
132
127
|
}
|
|
133
128
|
|
|
134
|
-
private updateLineLengths(props: ILineLengthsProps) {
|
|
135
|
-
if (props.fontFace !== undefined) this.lineLengths.fontFace = props.fontFace;
|
|
136
|
-
if (props.letterSpacing !== undefined) this.lineLengths.letterSpacing = props.letterSpacing || 0;
|
|
137
|
-
if (props.pageGutter !== undefined) this.lineLengths.pageGutter = props.pageGutter || 0;
|
|
138
|
-
if (props.wordSpacing !== undefined) this.lineLengths.wordSpacing = props.wordSpacing || 0;
|
|
139
|
-
if (props.optimalChars) this.lineLengths.optimalChars = props.optimalChars;
|
|
140
|
-
if (props.userChars !== undefined) this.lineLengths.userChars = props.userChars;
|
|
141
|
-
if (props.minChars !== undefined) this.lineLengths.minChars = props.minChars;
|
|
142
|
-
if (props.maxChars !== undefined) this.lineLengths.maxChars = props.maxChars;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
129
|
private updateLayout(scale: number | null, deprecatedImplem: boolean | null, scroll: boolean | null, colCount?: number | null) {
|
|
146
130
|
const isScroll = scroll ?? this.userProperties.view === "scroll";
|
|
147
131
|
|
|
@@ -165,7 +149,7 @@ export class ReadiumCSS {
|
|
|
165
149
|
return {
|
|
166
150
|
zoomFactor: zoomFactor,
|
|
167
151
|
zoomCompensation: zoomCompensation,
|
|
168
|
-
optimal: Math.round(this.lineLengths.
|
|
152
|
+
optimal: Math.round(this.lineLengths.optimalLineLength) * zoomFactor,
|
|
169
153
|
minimal: this.lineLengths.minimalLineLength !== null
|
|
170
154
|
? Math.round(this.lineLengths.minimalLineLength * zoomFactor)
|
|
171
155
|
: null,
|
|
@@ -43,7 +43,6 @@ export interface IEpubDefaults {
|
|
|
43
43
|
letterSpacing?: number | null,
|
|
44
44
|
ligatures?: boolean | null,
|
|
45
45
|
lineHeight?: number | null,
|
|
46
|
-
lineLength?: number | null,
|
|
47
46
|
linkColor?: string | null,
|
|
48
47
|
maximalLineLength?: number | null,
|
|
49
48
|
minimalLineLength?: number | null,
|
|
@@ -85,7 +84,6 @@ export class EpubDefaults {
|
|
|
85
84
|
letterSpacing: number | null;
|
|
86
85
|
ligatures: boolean | null;
|
|
87
86
|
lineHeight: number | null;
|
|
88
|
-
lineLength: number | null;
|
|
89
87
|
linkColor: string | null;
|
|
90
88
|
maximalLineLength: number | null;
|
|
91
89
|
minimalLineLength: number | null;
|
|
@@ -146,9 +144,8 @@ export class EpubDefaults {
|
|
|
146
144
|
this.visitedColor = ensureString(defaults.visitedColor) || null;
|
|
147
145
|
this.wordSpacing = ensureNonNegative(defaults.wordSpacing) || null;
|
|
148
146
|
|
|
149
|
-
this.lineLength = ensureNonNegative(defaults.lineLength) || null;
|
|
150
147
|
this.optimalLineLength = ensureNonNegative(defaults.optimalLineLength) || 65;
|
|
151
|
-
this.maximalLineLength = withFallback(ensureMoreThanOrEqual(defaults.maximalLineLength, this.
|
|
152
|
-
this.minimalLineLength = withFallback(ensureLessThanOrEqual(defaults.minimalLineLength, this.
|
|
148
|
+
this.maximalLineLength = withFallback(ensureMoreThanOrEqual(defaults.maximalLineLength, this.optimalLineLength), 80);
|
|
149
|
+
this.minimalLineLength = withFallback(ensureLessThanOrEqual(defaults.minimalLineLength, this.optimalLineLength), 40);
|
|
153
150
|
}
|
|
154
151
|
}
|
|
@@ -40,7 +40,6 @@ export interface IEpubPreferences {
|
|
|
40
40
|
letterSpacing?: number | null,
|
|
41
41
|
ligatures?: boolean | null,
|
|
42
42
|
lineHeight?: number | null,
|
|
43
|
-
lineLength?: number | null,
|
|
44
43
|
linkColor?: string | null,
|
|
45
44
|
maximalLineLength?: number | null,
|
|
46
45
|
minimalLineLength?: number | null,
|
|
@@ -82,7 +81,6 @@ export class EpubPreferences implements ConfigurablePreferences {
|
|
|
82
81
|
letterSpacing?: number | null;
|
|
83
82
|
ligatures?: boolean | null;
|
|
84
83
|
lineHeight?: number | null;
|
|
85
|
-
lineLength?: number | null;
|
|
86
84
|
linkColor?: string | null;
|
|
87
85
|
maximalLineLength?: number | null;
|
|
88
86
|
minimalLineLength?: number | null;
|
|
@@ -138,7 +136,6 @@ export class EpubPreferences implements ConfigurablePreferences {
|
|
|
138
136
|
this.visitedColor = ensureString(preferences.visitedColor);
|
|
139
137
|
this.wordSpacing = ensureNonNegative(preferences.wordSpacing);
|
|
140
138
|
|
|
141
|
-
this.lineLength = ensureNonNegative(preferences.lineLength);
|
|
142
139
|
this.optimalLineLength = ensureNonNegative(preferences.optimalLineLength);
|
|
143
140
|
this.maximalLineLength = ensureNonNegative(preferences.maximalLineLength);
|
|
144
141
|
this.minimalLineLength = ensureNonNegative(preferences.minimalLineLength);
|
|
@@ -167,12 +164,12 @@ export class EpubPreferences implements ConfigurablePreferences {
|
|
|
167
164
|
(
|
|
168
165
|
key !== "maximalLineLength" ||
|
|
169
166
|
other[key] === null ||
|
|
170
|
-
(other[key] >= (other.
|
|
167
|
+
(other[key] >= (other.optimalLineLength ?? merged.optimalLineLength ?? 65))
|
|
171
168
|
) &&
|
|
172
169
|
(
|
|
173
170
|
key !== "minimalLineLength" ||
|
|
174
171
|
other[key] === null ||
|
|
175
|
-
(other[key] <= (other.
|
|
172
|
+
(other[key] <= (other.optimalLineLength ?? merged.optimalLineLength ?? 65))
|
|
176
173
|
)
|
|
177
174
|
) {
|
|
178
175
|
merged[key] = other[key];
|
|
@@ -285,19 +285,6 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
|
|
|
285
285
|
});
|
|
286
286
|
}
|
|
287
287
|
|
|
288
|
-
get lineLength(): RangePreference<number> {
|
|
289
|
-
return new RangePreference<number>({
|
|
290
|
-
initialValue: this.preferences.lineLength,
|
|
291
|
-
effectiveValue: this.settings.lineLength || this.settings.optimalLineLength,
|
|
292
|
-
isEffective: this.layout === EPUBLayout.reflowable && this.preferences.lineLength !== null,
|
|
293
|
-
onChange: (newValue: number | null | undefined) => {
|
|
294
|
-
this.updatePreference("lineLength", newValue || null);
|
|
295
|
-
},
|
|
296
|
-
supportedRange: [20, 100],
|
|
297
|
-
step: 1
|
|
298
|
-
});
|
|
299
|
-
}
|
|
300
|
-
|
|
301
288
|
get linkColor(): Preference<string> {
|
|
302
289
|
return new Preference<string>({
|
|
303
290
|
initialValue: this.preferences.linkColor,
|
|
@@ -350,7 +337,7 @@ export class EpubPreferencesEditor implements IPreferencesEditor {
|
|
|
350
337
|
return new RangePreference<number>({
|
|
351
338
|
initialValue: this.preferences.optimalLineLength,
|
|
352
339
|
effectiveValue: this.settings.optimalLineLength,
|
|
353
|
-
isEffective: this.layout === EPUBLayout.reflowable
|
|
340
|
+
isEffective: this.layout === EPUBLayout.reflowable,
|
|
354
341
|
onChange: (newValue: number | null | undefined) => {
|
|
355
342
|
this.updatePreference("optimalLineLength", newValue as number);
|
|
356
343
|
},
|
|
@@ -27,7 +27,6 @@ export interface IEpubSettings {
|
|
|
27
27
|
letterSpacing?: number | null,
|
|
28
28
|
ligatures?: boolean | null,
|
|
29
29
|
lineHeight?: number | null,
|
|
30
|
-
lineLength?: number | null,
|
|
31
30
|
linkColor?: string | null,
|
|
32
31
|
maximalLineLength?: number | null,
|
|
33
32
|
minimalLineLength?: number | null,
|
|
@@ -69,7 +68,6 @@ export class EpubSettings implements ConfigurableSettings {
|
|
|
69
68
|
letterSpacing: number | null;
|
|
70
69
|
ligatures: boolean | null;
|
|
71
70
|
lineHeight: number | null;
|
|
72
|
-
lineLength: number | null;
|
|
73
71
|
linkColor: string | null;
|
|
74
72
|
maximalLineLength: number | null;
|
|
75
73
|
minimalLineLength: number | null;
|
|
@@ -160,11 +158,6 @@ export class EpubSettings implements ConfigurableSettings {
|
|
|
160
158
|
: defaults.lineHeight !== undefined
|
|
161
159
|
? defaults.lineHeight
|
|
162
160
|
: null;
|
|
163
|
-
this.lineLength = preferences.lineLength !== undefined
|
|
164
|
-
? preferences.lineLength
|
|
165
|
-
: defaults.lineLength !== undefined
|
|
166
|
-
? defaults.lineLength
|
|
167
|
-
: null;
|
|
168
161
|
this.linkColor = preferences.linkColor || defaults.linkColor || null;
|
|
169
162
|
this.maximalLineLength = preferences.maximalLineLength === null
|
|
170
163
|
? null
|
|
@@ -9,7 +9,6 @@ export interface ILineLengthsConfig {
|
|
|
9
9
|
optimalChars: number;
|
|
10
10
|
minChars?: number | null;
|
|
11
11
|
maxChars?: number | null;
|
|
12
|
-
userChars?: number | null;
|
|
13
12
|
baseFontSize?: number | null;
|
|
14
13
|
sample?: string | null;
|
|
15
14
|
pageGutter?: number | null;
|
|
@@ -22,7 +21,6 @@ export interface ILineLengthsConfig {
|
|
|
22
21
|
|
|
23
22
|
export interface ILineLengths {
|
|
24
23
|
min: number | null;
|
|
25
|
-
user: number | null;
|
|
26
24
|
max: number | null;
|
|
27
25
|
optimal: number;
|
|
28
26
|
baseFontSize: number;
|
|
@@ -41,7 +39,7 @@ const DEFAULT_FONT_FACE = fontStacks.RS__oldStyleTf;
|
|
|
41
39
|
// offset on the y-axis (using fillText), and getting the total height.
|
|
42
40
|
// If you don’t need high accuracy, it’s acceptable to use the one returned with isCJK.
|
|
43
41
|
//
|
|
44
|
-
// Instead of measuring text for min
|
|
42
|
+
// Instead of measuring text for min and maximal, we define multipliers
|
|
45
43
|
// at the end, with optimalLineLength as a ref, before returning the lineLengths object.
|
|
46
44
|
|
|
47
45
|
export class LineLengths {
|
|
@@ -50,7 +48,6 @@ export class LineLengths {
|
|
|
50
48
|
private _optimalChars: number;
|
|
51
49
|
private _minChars?: number | null;
|
|
52
50
|
private _maxChars?: number | null;
|
|
53
|
-
private _userChars: number | null;
|
|
54
51
|
private _baseFontSize: number;
|
|
55
52
|
private _fontFace: string | ICustomFontFace;
|
|
56
53
|
private _sample: string | null;
|
|
@@ -62,7 +59,6 @@ export class LineLengths {
|
|
|
62
59
|
|
|
63
60
|
private _padding: number;
|
|
64
61
|
private _minDivider: number | null;
|
|
65
|
-
private _userMultiplier: number | null;
|
|
66
62
|
private _maxMultiplier: number | null;
|
|
67
63
|
private _approximatedWordSpaces: number;
|
|
68
64
|
|
|
@@ -73,7 +69,6 @@ export class LineLengths {
|
|
|
73
69
|
this._optimalChars = config.optimalChars;
|
|
74
70
|
this._minChars = config.minChars;
|
|
75
71
|
this._maxChars = config.maxChars;
|
|
76
|
-
this._userChars = config.userChars || null;
|
|
77
72
|
this._baseFontSize = config.baseFontSize || DEFAULT_FONT_SIZE;
|
|
78
73
|
this._fontFace = config.fontFace || DEFAULT_FONT_FACE;
|
|
79
74
|
this._sample = config.sample || null;
|
|
@@ -92,9 +87,6 @@ export class LineLengths {
|
|
|
92
87
|
: this._minChars === null
|
|
93
88
|
? null
|
|
94
89
|
: 1;
|
|
95
|
-
this._userMultiplier = this._userChars
|
|
96
|
-
? this._userChars / this._optimalChars
|
|
97
|
-
: null;
|
|
98
90
|
this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars
|
|
99
91
|
? this._maxChars / this._optimalChars
|
|
100
92
|
: this._maxChars === null
|
|
@@ -103,25 +95,13 @@ export class LineLengths {
|
|
|
103
95
|
this._approximatedWordSpaces = LineLengths.approximateWordSpaces(this._optimalChars, this._sample);
|
|
104
96
|
}
|
|
105
97
|
|
|
106
|
-
|
|
107
|
-
if (n === this._minChars) return;
|
|
108
|
-
this._minChars = n;
|
|
98
|
+
private updateMultipliers() {
|
|
109
99
|
this._minDivider = this._minChars && this._minChars < this._optimalChars
|
|
110
100
|
? this._optimalChars / this._minChars
|
|
111
101
|
: this._minChars === null
|
|
112
102
|
? null
|
|
113
103
|
: 1;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
set optimalChars(n: number) {
|
|
117
|
-
if (n === this._optimalChars) return;
|
|
118
|
-
this._optimalChars = n;
|
|
119
|
-
this._optimalLineLength = this.getOptimalLineLength();
|
|
120
|
-
}
|
|
121
104
|
|
|
122
|
-
set maxChars(n: number | null) {
|
|
123
|
-
if (n === this._maxChars) return;
|
|
124
|
-
this._maxChars = n;
|
|
125
105
|
this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars
|
|
126
106
|
? this._maxChars / this._optimalChars
|
|
127
107
|
: this._maxChars === null
|
|
@@ -129,52 +109,30 @@ export class LineLengths {
|
|
|
129
109
|
: 1;
|
|
130
110
|
}
|
|
131
111
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
if (
|
|
140
|
-
this.
|
|
141
|
-
this.
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
if (
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
this._baseFontSize = n;
|
|
152
|
-
this._optimalLineLength = this.getOptimalLineLength();
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
set fontFace(f: string | ICustomFontFace | null) {
|
|
156
|
-
this._fontFace = f || DEFAULT_FONT_FACE;
|
|
157
|
-
this._optimalLineLength = this.getOptimalLineLength();
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
set sample(s: string) {
|
|
161
|
-
if (s === this._sample) return;
|
|
162
|
-
this._sample = s;
|
|
163
|
-
this._approximatedWordSpaces = LineLengths.approximateWordSpaces(this._optimalChars, this._sample);
|
|
164
|
-
}
|
|
112
|
+
// Batch update to guarantee up-to-date values
|
|
113
|
+
// Not filtering because pretty much everything can
|
|
114
|
+
// trigger a recomputation anyway.
|
|
115
|
+
update(props: Partial<ILineLengthsConfig>) {
|
|
116
|
+
if (props.optimalChars) this._optimalChars = props.optimalChars;
|
|
117
|
+
if (props.minChars !== undefined) this._minChars = props.minChars;
|
|
118
|
+
if (props.maxChars !== undefined) this._maxChars = props.maxChars;
|
|
119
|
+
if (props.baseFontSize) this._baseFontSize = props.baseFontSize;
|
|
120
|
+
if (props.fontFace !== undefined) this._fontFace = props.fontFace || DEFAULT_FONT_FACE;
|
|
121
|
+
if (props.letterSpacing) this._letterSpacing = props.letterSpacing;
|
|
122
|
+
if (props.wordSpacing) this._wordSpacing = props.wordSpacing;
|
|
123
|
+
if (props.isCJK != null) this._isCJK = props.isCJK;
|
|
124
|
+
if (props.pageGutter) this._pageGutter = props.pageGutter;
|
|
125
|
+
if (props.getRelative) this._getRelative = props.getRelative;
|
|
126
|
+
|
|
127
|
+
if (props.sample) {
|
|
128
|
+
this._sample = props.sample;
|
|
129
|
+
this._approximatedWordSpaces = LineLengths.approximateWordSpaces(this._optimalChars, this._sample);
|
|
130
|
+
}
|
|
165
131
|
|
|
166
|
-
|
|
167
|
-
if (n === this._pageGutter) return;
|
|
168
|
-
this._pageGutter = n;
|
|
169
|
-
this._padding = this._pageGutter * 2;
|
|
132
|
+
this.updateMultipliers();
|
|
170
133
|
this._optimalLineLength = this.getOptimalLineLength();
|
|
171
134
|
}
|
|
172
135
|
|
|
173
|
-
set relativeGetters(b: boolean) {
|
|
174
|
-
if (b === this._getRelative) return;
|
|
175
|
-
this._getRelative = b;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
136
|
get baseFontSize() {
|
|
179
137
|
return this._baseFontSize;
|
|
180
138
|
}
|
|
@@ -188,15 +146,6 @@ export class LineLengths {
|
|
|
188
146
|
: null;
|
|
189
147
|
}
|
|
190
148
|
|
|
191
|
-
get userLineLength(): number | null {
|
|
192
|
-
if (!this._optimalLineLength) {
|
|
193
|
-
this._optimalLineLength = this.getOptimalLineLength();
|
|
194
|
-
}
|
|
195
|
-
return this._userMultiplier !== null
|
|
196
|
-
? Math.round((this._optimalLineLength * this._userMultiplier) + this._padding) / (this._getRelative ? this._baseFontSize : 1)
|
|
197
|
-
: null;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
149
|
get maximalLineLength(): number | null {
|
|
201
150
|
if (!this._optimalLineLength) {
|
|
202
151
|
this._optimalLineLength = this.getOptimalLineLength();
|
|
@@ -219,7 +168,6 @@ export class LineLengths {
|
|
|
219
168
|
}
|
|
220
169
|
return {
|
|
221
170
|
min: this.minimalLineLength,
|
|
222
|
-
user: this.userLineLength,
|
|
223
171
|
max: this.maximalLineLength,
|
|
224
172
|
optimal: this.optimalLineLength,
|
|
225
173
|
baseFontSize: this._baseFontSize
|
|
@@ -21,7 +21,6 @@ export interface IEpubDefaults {
|
|
|
21
21
|
letterSpacing?: number | null;
|
|
22
22
|
ligatures?: boolean | null;
|
|
23
23
|
lineHeight?: number | null;
|
|
24
|
-
lineLength?: number | null;
|
|
25
24
|
linkColor?: string | null;
|
|
26
25
|
maximalLineLength?: number | null;
|
|
27
26
|
minimalLineLength?: number | null;
|
|
@@ -62,7 +61,6 @@ export declare class EpubDefaults {
|
|
|
62
61
|
letterSpacing: number | null;
|
|
63
62
|
ligatures: boolean | null;
|
|
64
63
|
lineHeight: number | null;
|
|
65
|
-
lineLength: number | null;
|
|
66
64
|
linkColor: string | null;
|
|
67
65
|
maximalLineLength: number | null;
|
|
68
66
|
minimalLineLength: number | null;
|
|
@@ -22,7 +22,6 @@ export interface IEpubPreferences {
|
|
|
22
22
|
letterSpacing?: number | null;
|
|
23
23
|
ligatures?: boolean | null;
|
|
24
24
|
lineHeight?: number | null;
|
|
25
|
-
lineLength?: number | null;
|
|
26
25
|
linkColor?: string | null;
|
|
27
26
|
maximalLineLength?: number | null;
|
|
28
27
|
minimalLineLength?: number | null;
|
|
@@ -63,7 +62,6 @@ export declare class EpubPreferences implements ConfigurablePreferences {
|
|
|
63
62
|
letterSpacing?: number | null;
|
|
64
63
|
ligatures?: boolean | null;
|
|
65
64
|
lineHeight?: number | null;
|
|
66
|
-
lineLength?: number | null;
|
|
67
65
|
linkColor?: string | null;
|
|
68
66
|
maximalLineLength?: number | null;
|
|
69
67
|
minimalLineLength?: number | null;
|
|
@@ -33,7 +33,6 @@ export declare class EpubPreferencesEditor implements IPreferencesEditor {
|
|
|
33
33
|
get letterSpacing(): RangePreference<number>;
|
|
34
34
|
get ligatures(): BooleanPreference;
|
|
35
35
|
get lineHeight(): RangePreference<number>;
|
|
36
|
-
get lineLength(): RangePreference<number>;
|
|
37
36
|
get linkColor(): Preference<string>;
|
|
38
37
|
get maximalLineLength(): RangePreference<number>;
|
|
39
38
|
get minimalLineLength(): RangePreference<number>;
|
|
@@ -24,7 +24,6 @@ export interface IEpubSettings {
|
|
|
24
24
|
letterSpacing?: number | null;
|
|
25
25
|
ligatures?: boolean | null;
|
|
26
26
|
lineHeight?: number | null;
|
|
27
|
-
lineLength?: number | null;
|
|
28
27
|
linkColor?: string | null;
|
|
29
28
|
maximalLineLength?: number | null;
|
|
30
29
|
minimalLineLength?: number | null;
|
|
@@ -65,7 +64,6 @@ export declare class EpubSettings implements ConfigurableSettings {
|
|
|
65
64
|
letterSpacing: number | null;
|
|
66
65
|
ligatures: boolean | null;
|
|
67
66
|
lineHeight: number | null;
|
|
68
|
-
lineLength: number | null;
|
|
69
67
|
linkColor: string | null;
|
|
70
68
|
maximalLineLength: number | null;
|
|
71
69
|
minimalLineLength: number | null;
|
|
@@ -6,7 +6,6 @@ export interface ILineLengthsConfig {
|
|
|
6
6
|
optimalChars: number;
|
|
7
7
|
minChars?: number | null;
|
|
8
8
|
maxChars?: number | null;
|
|
9
|
-
userChars?: number | null;
|
|
10
9
|
baseFontSize?: number | null;
|
|
11
10
|
sample?: string | null;
|
|
12
11
|
pageGutter?: number | null;
|
|
@@ -18,7 +17,6 @@ export interface ILineLengthsConfig {
|
|
|
18
17
|
}
|
|
19
18
|
export interface ILineLengths {
|
|
20
19
|
min: number | null;
|
|
21
|
-
user: number | null;
|
|
22
20
|
max: number | null;
|
|
23
21
|
optimal: number;
|
|
24
22
|
baseFontSize: number;
|
|
@@ -28,7 +26,6 @@ export declare class LineLengths {
|
|
|
28
26
|
private _optimalChars;
|
|
29
27
|
private _minChars?;
|
|
30
28
|
private _maxChars?;
|
|
31
|
-
private _userChars;
|
|
32
29
|
private _baseFontSize;
|
|
33
30
|
private _fontFace;
|
|
34
31
|
private _sample;
|
|
@@ -39,25 +36,14 @@ export declare class LineLengths {
|
|
|
39
36
|
private _getRelative;
|
|
40
37
|
private _padding;
|
|
41
38
|
private _minDivider;
|
|
42
|
-
private _userMultiplier;
|
|
43
39
|
private _maxMultiplier;
|
|
44
40
|
private _approximatedWordSpaces;
|
|
45
41
|
private _optimalLineLength;
|
|
46
42
|
constructor(config: ILineLengthsConfig);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
set maxChars(n: number | null);
|
|
50
|
-
set userChars(n: number | null);
|
|
51
|
-
set letterSpacing(n: number);
|
|
52
|
-
set wordSpacing(n: number);
|
|
53
|
-
set baseFontSize(n: number);
|
|
54
|
-
set fontFace(f: string | ICustomFontFace | null);
|
|
55
|
-
set sample(s: string);
|
|
56
|
-
set pageGutter(n: number);
|
|
57
|
-
set relativeGetters(b: boolean);
|
|
43
|
+
private updateMultipliers;
|
|
44
|
+
update(props: Partial<ILineLengthsConfig>): void;
|
|
58
45
|
get baseFontSize(): number;
|
|
59
46
|
get minimalLineLength(): number | null;
|
|
60
|
-
get userLineLength(): number | null;
|
|
61
47
|
get maximalLineLength(): number | null;
|
|
62
48
|
get optimalLineLength(): number;
|
|
63
49
|
get all(): ILineLengths;
|