ppt-codec 1.0.2 → 1.1.1

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.
Files changed (100) hide show
  1. package/README.md +142 -38
  2. package/dist/content-write.cjs +114 -0
  3. package/dist/content-write.d.cts +11 -0
  4. package/dist/content-write.d.ts +11 -0
  5. package/dist/content-write.js +112 -0
  6. package/dist/content.cjs +22 -2
  7. package/dist/content.js +22 -2
  8. package/dist/document/color-scheme-write.cjs +57 -0
  9. package/dist/document/color-scheme-write.d.cts +4 -0
  10. package/dist/document/color-scheme-write.d.ts +4 -0
  11. package/dist/document/color-scheme-write.js +56 -0
  12. package/dist/document/document-atom-write.cjs +12 -0
  13. package/dist/document/document-atom-write.d.cts +5 -0
  14. package/dist/document/document-atom-write.d.ts +5 -0
  15. package/dist/document/document-atom-write.js +11 -0
  16. package/dist/document/fonts-write.cjs +17 -0
  17. package/dist/document/fonts-write.d.cts +4 -0
  18. package/dist/document/fonts-write.d.ts +4 -0
  19. package/dist/document/fonts-write.js +16 -0
  20. package/dist/document/master-write.cjs +128 -0
  21. package/dist/document/master-write.d.cts +15 -0
  22. package/dist/document/master-write.d.ts +15 -0
  23. package/dist/document/master-write.js +123 -0
  24. package/dist/document/notes-list-write.cjs +12 -0
  25. package/dist/document/notes-list-write.d.cts +5 -0
  26. package/dist/document/notes-list-write.d.ts +5 -0
  27. package/dist/document/notes-list-write.js +11 -0
  28. package/dist/document/notes-list.cjs +22 -0
  29. package/dist/document/notes-list.d.cts +9 -0
  30. package/dist/document/notes-list.d.ts +9 -0
  31. package/dist/document/notes-list.js +21 -0
  32. package/dist/document/notes-write.cjs +43 -0
  33. package/dist/document/notes-write.d.cts +6 -0
  34. package/dist/document/notes-write.d.ts +6 -0
  35. package/dist/document/notes-write.js +41 -0
  36. package/dist/document/notes.cjs +41 -0
  37. package/dist/document/notes.d.cts +12 -0
  38. package/dist/document/notes.d.ts +12 -0
  39. package/dist/document/notes.js +37 -0
  40. package/dist/document/slide-list-write.cjs +12 -0
  41. package/dist/document/slide-list-write.d.cts +8 -0
  42. package/dist/document/slide-list-write.d.ts +8 -0
  43. package/dist/document/slide-list-write.js +11 -0
  44. package/dist/drawing/shapes-write.cjs +60 -0
  45. package/dist/drawing/shapes-write.d.cts +10 -0
  46. package/dist/drawing/shapes-write.d.ts +10 -0
  47. package/dist/drawing/shapes-write.js +58 -0
  48. package/dist/errors.cjs +7 -0
  49. package/dist/errors.d.cts +4 -1
  50. package/dist/errors.d.ts +4 -1
  51. package/dist/errors.js +7 -1
  52. package/dist/index.cjs +112 -3
  53. package/dist/index.d.cts +24 -7
  54. package/dist/index.d.ts +24 -7
  55. package/dist/index.js +25 -8
  56. package/dist/metadata.cjs +14 -0
  57. package/dist/metadata.d.cts +6 -0
  58. package/dist/metadata.d.ts +6 -0
  59. package/dist/metadata.js +13 -0
  60. package/dist/read.cjs +33 -8
  61. package/dist/read.d.cts +5 -1
  62. package/dist/read.d.ts +5 -1
  63. package/dist/read.js +32 -10
  64. package/dist/record/types.cjs +8 -0
  65. package/dist/record/types.d.cts +5 -1
  66. package/dist/record/types.d.ts +5 -1
  67. package/dist/record/types.js +5 -1
  68. package/dist/record/write.cjs +75 -0
  69. package/dist/record/write.d.cts +17 -0
  70. package/dist/record/write.d.ts +17 -0
  71. package/dist/record/write.js +65 -0
  72. package/dist/stream/current-user-write.cjs +13 -0
  73. package/dist/stream/current-user-write.d.cts +4 -0
  74. package/dist/stream/current-user-write.d.ts +4 -0
  75. package/dist/stream/current-user-write.js +12 -0
  76. package/dist/stream/current-user.cjs +7 -5
  77. package/dist/stream/current-user.d.cts +3 -1
  78. package/dist/stream/current-user.d.ts +3 -1
  79. package/dist/stream/current-user.js +6 -6
  80. package/dist/stream/persist-write.cjs +14 -0
  81. package/dist/stream/persist-write.d.cts +16 -0
  82. package/dist/stream/persist-write.d.ts +16 -0
  83. package/dist/stream/persist-write.js +12 -0
  84. package/dist/text/style-write.cjs +79 -0
  85. package/dist/text/style-write.d.cts +5 -0
  86. package/dist/text/style-write.d.ts +5 -0
  87. package/dist/text/style-write.js +78 -0
  88. package/dist/text/style.cjs +85 -30
  89. package/dist/text/style.d.cts +50 -1
  90. package/dist/text/style.d.ts +50 -1
  91. package/dist/text/style.js +44 -31
  92. package/dist/units.cjs +4 -0
  93. package/dist/units.d.cts +2 -1
  94. package/dist/units.d.ts +2 -1
  95. package/dist/units.js +4 -1
  96. package/dist/write.cjs +145 -0
  97. package/dist/write.d.cts +11 -0
  98. package/dist/write.d.ts +11 -0
  99. package/dist/write.js +142 -0
  100. package/package.json +4 -4
@@ -0,0 +1,79 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_record_types = require("../record/types.cjs");
3
+ const require_text_style = require("./style.cjs");
4
+ const require_record_write = require("../record/write.cjs");
5
+ //#region src/text/style-write.ts
6
+ function writeColorIndexStruct(color) {
7
+ return new Uint8Array([
8
+ color.red,
9
+ color.green,
10
+ color.blue,
11
+ 254
12
+ ]);
13
+ }
14
+ function writeTextPFException(properties) {
15
+ let masks = 0;
16
+ const fields = [];
17
+ if (properties.alignment !== void 0) {
18
+ masks |= require_text_style.PF_ALIGN;
19
+ fields.push(require_record_write.u16le(properties.alignment));
20
+ }
21
+ if (properties.lineSpacing !== void 0) {
22
+ masks |= require_text_style.PF_LINE_SPACING;
23
+ fields.push(require_record_write.i16le(properties.lineSpacing));
24
+ }
25
+ if (properties.spaceBefore !== void 0) {
26
+ masks |= require_text_style.PF_SPACE_BEFORE;
27
+ fields.push(require_record_write.i16le(properties.spaceBefore));
28
+ }
29
+ if (properties.spaceAfter !== void 0) {
30
+ masks |= require_text_style.PF_SPACE_AFTER;
31
+ fields.push(require_record_write.i16le(properties.spaceAfter));
32
+ }
33
+ if (properties.leftMargin !== void 0) {
34
+ masks |= 256;
35
+ fields.push(require_record_write.i16le(properties.leftMargin));
36
+ }
37
+ if (properties.indent !== void 0) {
38
+ masks |= require_text_style.PF_INDENT;
39
+ fields.push(require_record_write.i16le(properties.indent));
40
+ }
41
+ return require_record_write.concatBytes(require_record_write.u32le(masks), ...fields);
42
+ }
43
+ function writeTextCFException(properties) {
44
+ let masks = 0;
45
+ let fontStyle = 0;
46
+ const hasFontStyle = properties.bold !== void 0 || properties.italic !== void 0 || properties.underline !== void 0;
47
+ if (properties.bold !== void 0) {
48
+ masks |= 1;
49
+ if (properties.bold) fontStyle |= 1;
50
+ }
51
+ if (properties.italic !== void 0) {
52
+ masks |= 2;
53
+ if (properties.italic) fontStyle |= 2;
54
+ }
55
+ if (properties.underline !== void 0) {
56
+ masks |= 4;
57
+ if (properties.underline) fontStyle |= 4;
58
+ }
59
+ if (properties.fontRef !== void 0) masks |= require_text_style.CF_TYPEFACE;
60
+ if (properties.sizePt !== void 0) masks |= require_text_style.CF_SIZE;
61
+ if (properties.color !== void 0) masks |= require_text_style.CF_COLOR;
62
+ const fields = [require_record_write.u32le(masks)];
63
+ if (hasFontStyle) fields.push(require_record_write.u16le(fontStyle));
64
+ if (properties.fontRef !== void 0) fields.push(require_record_write.u16le(properties.fontRef));
65
+ if (properties.sizePt !== void 0) fields.push(require_record_write.i16le(Math.round(properties.sizePt)));
66
+ if (properties.color !== void 0) fields.push(writeColorIndexStruct(properties.color));
67
+ return require_record_write.concatBytes(...fields);
68
+ }
69
+ function writeParagraphRun(run) {
70
+ return require_record_write.concatBytes(require_record_write.u32le(run.count), require_record_write.u16le(run.properties.indentLevel), writeTextPFException(run.properties));
71
+ }
72
+ function writeCharacterRun(run) {
73
+ return require_record_write.concatBytes(require_record_write.u32le(run.count), writeTextCFException(run.properties));
74
+ }
75
+ function writeStyleTextPropAtom(style) {
76
+ return require_record_write.writeAtom(require_record_types.RT_StyleTextPropAtom, require_record_write.concatBytes(...style.paragraphRuns.map(writeParagraphRun), ...style.characterRuns.map(writeCharacterRun)));
77
+ }
78
+ //#endregion
79
+ exports.writeStyleTextPropAtom = writeStyleTextPropAtom;
@@ -0,0 +1,5 @@
1
+ import { StyleTextProps } from "./style.cjs";
2
+ //#region src/text/style-write.d.ts
3
+ declare function writeStyleTextPropAtom(style: StyleTextProps): Uint8Array<ArrayBuffer>;
4
+ //#endregion
5
+ export { writeStyleTextPropAtom };
@@ -0,0 +1,5 @@
1
+ import { StyleTextProps } from "./style.js";
2
+ //#region src/text/style-write.d.ts
3
+ declare function writeStyleTextPropAtom(style: StyleTextProps): Uint8Array<ArrayBuffer>;
4
+ //#endregion
5
+ export { writeStyleTextPropAtom };
@@ -0,0 +1,78 @@
1
+ import { RT_StyleTextPropAtom } from "../record/types.js";
2
+ import { CF_COLOR, CF_SIZE, CF_TYPEFACE, PF_ALIGN, PF_INDENT, PF_LINE_SPACING, PF_SPACE_AFTER, PF_SPACE_BEFORE } from "./style.js";
3
+ import { concatBytes, i16le, u16le, u32le, writeAtom } from "../record/write.js";
4
+ //#region src/text/style-write.ts
5
+ function writeColorIndexStruct(color) {
6
+ return new Uint8Array([
7
+ color.red,
8
+ color.green,
9
+ color.blue,
10
+ 254
11
+ ]);
12
+ }
13
+ function writeTextPFException(properties) {
14
+ let masks = 0;
15
+ const fields = [];
16
+ if (properties.alignment !== void 0) {
17
+ masks |= PF_ALIGN;
18
+ fields.push(u16le(properties.alignment));
19
+ }
20
+ if (properties.lineSpacing !== void 0) {
21
+ masks |= PF_LINE_SPACING;
22
+ fields.push(i16le(properties.lineSpacing));
23
+ }
24
+ if (properties.spaceBefore !== void 0) {
25
+ masks |= PF_SPACE_BEFORE;
26
+ fields.push(i16le(properties.spaceBefore));
27
+ }
28
+ if (properties.spaceAfter !== void 0) {
29
+ masks |= PF_SPACE_AFTER;
30
+ fields.push(i16le(properties.spaceAfter));
31
+ }
32
+ if (properties.leftMargin !== void 0) {
33
+ masks |= 256;
34
+ fields.push(i16le(properties.leftMargin));
35
+ }
36
+ if (properties.indent !== void 0) {
37
+ masks |= PF_INDENT;
38
+ fields.push(i16le(properties.indent));
39
+ }
40
+ return concatBytes(u32le(masks), ...fields);
41
+ }
42
+ function writeTextCFException(properties) {
43
+ let masks = 0;
44
+ let fontStyle = 0;
45
+ const hasFontStyle = properties.bold !== void 0 || properties.italic !== void 0 || properties.underline !== void 0;
46
+ if (properties.bold !== void 0) {
47
+ masks |= 1;
48
+ if (properties.bold) fontStyle |= 1;
49
+ }
50
+ if (properties.italic !== void 0) {
51
+ masks |= 2;
52
+ if (properties.italic) fontStyle |= 2;
53
+ }
54
+ if (properties.underline !== void 0) {
55
+ masks |= 4;
56
+ if (properties.underline) fontStyle |= 4;
57
+ }
58
+ if (properties.fontRef !== void 0) masks |= CF_TYPEFACE;
59
+ if (properties.sizePt !== void 0) masks |= CF_SIZE;
60
+ if (properties.color !== void 0) masks |= CF_COLOR;
61
+ const fields = [u32le(masks)];
62
+ if (hasFontStyle) fields.push(u16le(fontStyle));
63
+ if (properties.fontRef !== void 0) fields.push(u16le(properties.fontRef));
64
+ if (properties.sizePt !== void 0) fields.push(i16le(Math.round(properties.sizePt)));
65
+ if (properties.color !== void 0) fields.push(writeColorIndexStruct(properties.color));
66
+ return concatBytes(...fields);
67
+ }
68
+ function writeParagraphRun(run) {
69
+ return concatBytes(u32le(run.count), u16le(run.properties.indentLevel), writeTextPFException(run.properties));
70
+ }
71
+ function writeCharacterRun(run) {
72
+ return concatBytes(u32le(run.count), writeTextCFException(run.properties));
73
+ }
74
+ function writeStyleTextPropAtom(style) {
75
+ return writeAtom(RT_StyleTextPropAtom, concatBytes(...style.paragraphRuns.map(writeParagraphRun), ...style.characterRuns.map(writeCharacterRun)));
76
+ }
77
+ //#endregion
78
+ export { writeStyleTextPropAtom };
@@ -9,6 +9,10 @@ const ALIGN_JUSTIFY = 3;
9
9
  const ALIGN_DISTRIBUTED = 4;
10
10
  const ALIGN_THAI_DISTRIBUTED = 5;
11
11
  const ALIGN_JUSTIFY_LOW = 6;
12
+ const PF_HAS_BULLET = 1;
13
+ const PF_BULLET_HAS_FONT = 2;
14
+ const PF_BULLET_HAS_COLOR = 4;
15
+ const PF_BULLET_HAS_SIZE = 8;
12
16
  const PF_BULLET_FONT = 16;
13
17
  const PF_BULLET_COLOR = 32;
14
18
  const PF_BULLET_SIZE = 64;
@@ -21,13 +25,19 @@ const PF_SPACE_BEFORE = 8192;
21
25
  const PF_SPACE_AFTER = 16384;
22
26
  const PF_DEFAULT_TAB_SIZE = 32768;
23
27
  const PF_FONT_ALIGN = 65536;
28
+ const PF_CHAR_WRAP = 1 << 17;
29
+ const PF_WORD_WRAP = 1 << 18;
30
+ const PF_OVERFLOW = 1 << 19;
24
31
  const PF_TAB_STOPS = 1 << 20;
25
32
  const PF_TEXT_DIRECTION = 1 << 21;
26
33
  const CF_BOLD = 1;
27
34
  const CF_ITALIC = 2;
28
35
  const CF_UNDERLINE = 4;
29
36
  const CF_SHADOW = 16;
37
+ const CF_FEHINT = 32;
38
+ const CF_KUMI = 128;
30
39
  const CF_EMBOSS = 512;
40
+ const CF_HAS_STYLE = 15360;
31
41
  const CF_TYPEFACE = 65536;
32
42
  const CF_SIZE = 1 << 17;
33
43
  const CF_COLOR = 1 << 18;
@@ -81,7 +91,7 @@ var FieldCursor = class {
81
91
  function readColorIndexStruct(cursor) {
82
92
  const [red, green, blue, index] = cursor.bytes(4);
83
93
  if (red === void 0 || green === void 0 || blue === void 0 || index === void 0) throw new require_errors.PptFormatError("ColorIndexStruct read returned fewer than its four bytes");
84
- return index === COLOR_INDEX_SRGB ? {
94
+ return index === 254 ? {
85
95
  red,
86
96
  green,
87
97
  blue
@@ -90,26 +100,29 @@ function readColorIndexStruct(cursor) {
90
100
  function readTextPFException(cursor, indentLevel) {
91
101
  const masks = cursor.u32();
92
102
  if ((masks & 15) !== 0) cursor.skip(2);
93
- if ((masks & PF_BULLET_CHAR) !== 0) cursor.skip(2);
94
- if ((masks & PF_BULLET_FONT) !== 0) cursor.skip(2);
95
- if ((masks & PF_BULLET_SIZE) !== 0) cursor.skip(2);
96
- if ((masks & PF_BULLET_COLOR) !== 0) cursor.skip(4);
97
- const alignment = (masks & PF_ALIGN) !== 0 ? cursor.u16() : void 0;
98
- for (const mask of [
99
- PF_LINE_SPACING,
100
- PF_SPACE_BEFORE,
101
- PF_SPACE_AFTER,
102
- PF_LEFT_MARGIN,
103
- PF_INDENT,
104
- PF_DEFAULT_TAB_SIZE
105
- ]) if ((masks & mask) !== 0) cursor.skip(2);
106
- if ((masks & PF_TAB_STOPS) !== 0) cursor.skip(cursor.u16() * 4);
107
- if ((masks & PF_FONT_ALIGN) !== 0) cursor.skip(2);
103
+ if ((masks & 128) !== 0) cursor.skip(2);
104
+ if ((masks & 16) !== 0) cursor.skip(2);
105
+ if ((masks & 64) !== 0) cursor.skip(2);
106
+ if ((masks & 32) !== 0) cursor.skip(4);
107
+ const alignment = (masks & 2048) !== 0 ? cursor.u16() : void 0;
108
+ const lineSpacing = (masks & 4096) !== 0 ? cursor.i16() : void 0;
109
+ const spaceBefore = (masks & 8192) !== 0 ? cursor.i16() : void 0;
110
+ const spaceAfter = (masks & 16384) !== 0 ? cursor.i16() : void 0;
111
+ const leftMargin = (masks & 256) !== 0 ? cursor.i16() : void 0;
112
+ const indent = (masks & 1024) !== 0 ? cursor.i16() : void 0;
113
+ if ((masks & 32768) !== 0) cursor.skip(2);
114
+ if ((masks & 1048576) !== 0) cursor.skip(cursor.u16() * 4);
115
+ if ((masks & 65536) !== 0) cursor.skip(2);
108
116
  if ((masks & 917504) !== 0) cursor.skip(2);
109
- if ((masks & PF_TEXT_DIRECTION) !== 0) cursor.skip(2);
117
+ if ((masks & 2097152) !== 0) cursor.skip(2);
110
118
  return {
111
119
  indentLevel,
112
- alignment
120
+ alignment,
121
+ lineSpacing,
122
+ spaceBefore,
123
+ spaceAfter,
124
+ leftMargin,
125
+ indent
113
126
  };
114
127
  }
115
128
  function styleFlag(masks, maskBit, fontStyle, styleBit) {
@@ -119,19 +132,19 @@ function styleFlag(masks, maskBit, fontStyle, styleBit) {
119
132
  function readTextCFException(cursor) {
120
133
  const masks = cursor.u32();
121
134
  const fontStyle = (masks & 16055) !== 0 ? cursor.u16() : void 0;
122
- const fontRef = (masks & CF_TYPEFACE) !== 0 ? cursor.u16() : void 0;
123
- if ((masks & CF_OLD_EA_TYPEFACE) !== 0) cursor.skip(2);
124
- if ((masks & CF_ANSI_TYPEFACE) !== 0) cursor.skip(2);
125
- if ((masks & CF_SYMBOL_TYPEFACE) !== 0) cursor.skip(2);
126
- const sizePt = (masks & CF_SIZE) !== 0 ? cursor.i16() : void 0;
127
- const color = (masks & CF_COLOR) !== 0 ? readColorIndexStruct(cursor) : void 0;
128
- if ((masks & CF_POSITION) !== 0) cursor.skip(2);
135
+ const fontRef = (masks & 65536) !== 0 ? cursor.u16() : void 0;
136
+ if ((masks & 2097152) !== 0) cursor.skip(2);
137
+ if ((masks & 4194304) !== 0) cursor.skip(2);
138
+ if ((masks & 8388608) !== 0) cursor.skip(2);
139
+ const sizePt = (masks & 131072) !== 0 ? cursor.i16() : void 0;
140
+ const color = (masks & 262144) !== 0 ? readColorIndexStruct(cursor) : void 0;
141
+ if ((masks & 524288) !== 0) cursor.skip(2);
129
142
  return {
130
- bold: styleFlag(masks, CF_BOLD, fontStyle, STYLE_BOLD),
131
- italic: styleFlag(masks, CF_ITALIC, fontStyle, STYLE_ITALIC),
132
- underline: styleFlag(masks, CF_UNDERLINE, fontStyle, STYLE_UNDERLINE),
133
- shadow: styleFlag(masks, CF_SHADOW, fontStyle, STYLE_SHADOW),
134
- emboss: styleFlag(masks, CF_EMBOSS, fontStyle, STYLE_EMBOSS),
143
+ bold: styleFlag(masks, 1, fontStyle, 1),
144
+ italic: styleFlag(masks, 2, fontStyle, 2),
145
+ underline: styleFlag(masks, 4, fontStyle, 4),
146
+ shadow: styleFlag(masks, 16, fontStyle, 16),
147
+ emboss: styleFlag(masks, 512, fontStyle, 512),
135
148
  fontRef,
136
149
  sizePt,
137
150
  color
@@ -170,4 +183,46 @@ exports.ALIGN_JUSTIFY_LOW = ALIGN_JUSTIFY_LOW;
170
183
  exports.ALIGN_LEFT = ALIGN_LEFT;
171
184
  exports.ALIGN_RIGHT = ALIGN_RIGHT;
172
185
  exports.ALIGN_THAI_DISTRIBUTED = ALIGN_THAI_DISTRIBUTED;
186
+ exports.CF_ANSI_TYPEFACE = CF_ANSI_TYPEFACE;
187
+ exports.CF_BOLD = CF_BOLD;
188
+ exports.CF_COLOR = CF_COLOR;
189
+ exports.CF_EMBOSS = CF_EMBOSS;
190
+ exports.CF_FEHINT = CF_FEHINT;
191
+ exports.CF_HAS_STYLE = CF_HAS_STYLE;
192
+ exports.CF_ITALIC = CF_ITALIC;
193
+ exports.CF_KUMI = CF_KUMI;
194
+ exports.CF_OLD_EA_TYPEFACE = CF_OLD_EA_TYPEFACE;
195
+ exports.CF_POSITION = CF_POSITION;
196
+ exports.CF_SHADOW = CF_SHADOW;
197
+ exports.CF_SIZE = CF_SIZE;
198
+ exports.CF_SYMBOL_TYPEFACE = CF_SYMBOL_TYPEFACE;
199
+ exports.CF_TYPEFACE = CF_TYPEFACE;
200
+ exports.CF_UNDERLINE = CF_UNDERLINE;
201
+ exports.COLOR_INDEX_SRGB = COLOR_INDEX_SRGB;
202
+ exports.PF_ALIGN = PF_ALIGN;
203
+ exports.PF_BULLET_CHAR = PF_BULLET_CHAR;
204
+ exports.PF_BULLET_COLOR = PF_BULLET_COLOR;
205
+ exports.PF_BULLET_FONT = PF_BULLET_FONT;
206
+ exports.PF_BULLET_HAS_COLOR = PF_BULLET_HAS_COLOR;
207
+ exports.PF_BULLET_HAS_FONT = PF_BULLET_HAS_FONT;
208
+ exports.PF_BULLET_HAS_SIZE = PF_BULLET_HAS_SIZE;
209
+ exports.PF_BULLET_SIZE = PF_BULLET_SIZE;
210
+ exports.PF_CHAR_WRAP = PF_CHAR_WRAP;
211
+ exports.PF_DEFAULT_TAB_SIZE = PF_DEFAULT_TAB_SIZE;
212
+ exports.PF_FONT_ALIGN = PF_FONT_ALIGN;
213
+ exports.PF_HAS_BULLET = PF_HAS_BULLET;
214
+ exports.PF_INDENT = PF_INDENT;
215
+ exports.PF_LEFT_MARGIN = PF_LEFT_MARGIN;
216
+ exports.PF_LINE_SPACING = PF_LINE_SPACING;
217
+ exports.PF_OVERFLOW = PF_OVERFLOW;
218
+ exports.PF_SPACE_AFTER = PF_SPACE_AFTER;
219
+ exports.PF_SPACE_BEFORE = PF_SPACE_BEFORE;
220
+ exports.PF_TAB_STOPS = PF_TAB_STOPS;
221
+ exports.PF_TEXT_DIRECTION = PF_TEXT_DIRECTION;
222
+ exports.PF_WORD_WRAP = PF_WORD_WRAP;
223
+ exports.STYLE_BOLD = STYLE_BOLD;
224
+ exports.STYLE_EMBOSS = STYLE_EMBOSS;
225
+ exports.STYLE_ITALIC = STYLE_ITALIC;
226
+ exports.STYLE_SHADOW = STYLE_SHADOW;
227
+ exports.STYLE_UNDERLINE = STYLE_UNDERLINE;
173
228
  exports.readStyleTextPropAtom = readStyleTextPropAtom;
@@ -7,6 +7,48 @@ declare const ALIGN_JUSTIFY = 3;
7
7
  declare const ALIGN_DISTRIBUTED = 4;
8
8
  declare const ALIGN_THAI_DISTRIBUTED = 5;
9
9
  declare const ALIGN_JUSTIFY_LOW = 6;
10
+ declare const PF_HAS_BULLET: number;
11
+ declare const PF_BULLET_HAS_FONT: number;
12
+ declare const PF_BULLET_HAS_COLOR: number;
13
+ declare const PF_BULLET_HAS_SIZE: number;
14
+ declare const PF_BULLET_FONT: number;
15
+ declare const PF_BULLET_COLOR: number;
16
+ declare const PF_BULLET_SIZE: number;
17
+ declare const PF_BULLET_CHAR: number;
18
+ declare const PF_LEFT_MARGIN: number;
19
+ declare const PF_INDENT: number;
20
+ declare const PF_ALIGN: number;
21
+ declare const PF_LINE_SPACING: number;
22
+ declare const PF_SPACE_BEFORE: number;
23
+ declare const PF_SPACE_AFTER: number;
24
+ declare const PF_DEFAULT_TAB_SIZE: number;
25
+ declare const PF_FONT_ALIGN: number;
26
+ declare const PF_CHAR_WRAP: number;
27
+ declare const PF_WORD_WRAP: number;
28
+ declare const PF_OVERFLOW: number;
29
+ declare const PF_TAB_STOPS: number;
30
+ declare const PF_TEXT_DIRECTION: number;
31
+ declare const CF_BOLD: number;
32
+ declare const CF_ITALIC: number;
33
+ declare const CF_UNDERLINE: number;
34
+ declare const CF_SHADOW: number;
35
+ declare const CF_FEHINT: number;
36
+ declare const CF_KUMI: number;
37
+ declare const CF_EMBOSS: number;
38
+ declare const CF_HAS_STYLE: number;
39
+ declare const CF_TYPEFACE: number;
40
+ declare const CF_SIZE: number;
41
+ declare const CF_COLOR: number;
42
+ declare const CF_POSITION: number;
43
+ declare const CF_OLD_EA_TYPEFACE: number;
44
+ declare const CF_ANSI_TYPEFACE: number;
45
+ declare const CF_SYMBOL_TYPEFACE: number;
46
+ declare const STYLE_BOLD: number;
47
+ declare const STYLE_ITALIC: number;
48
+ declare const STYLE_UNDERLINE: number;
49
+ declare const STYLE_SHADOW: number;
50
+ declare const STYLE_EMBOSS: number;
51
+ declare const COLOR_INDEX_SRGB = 254;
10
52
  interface RgbColor {
11
53
  readonly red: number;
12
54
  readonly green: number;
@@ -15,6 +57,13 @@ interface RgbColor {
15
57
  interface ParagraphProperties {
16
58
  readonly indentLevel: number;
17
59
  readonly alignment: number | undefined;
60
+ /** ParaSpacing ([MS-PPT]), raw and unconverted: 0-13200 is a percentage of line height (value/100 = percent), negative is the absolute value in master units. content.ts's own paraSpacingToLineSpacing/paraSpacingToPoints do the schema-facing conversion -- this module stays format-level, with no document-schema.js knowledge of its own. */
61
+ readonly lineSpacing: number | undefined;
62
+ readonly spaceBefore: number | undefined;
63
+ readonly spaceAfter: number | undefined;
64
+ /** MarginOrIndent ([MS-PPT]): a signed offset in master units, no percentage form -- leftMargin is the paragraph's own left margin, indent the first line's own offset relative to it (negative for a hanging/bullet indent), the identical relationship DrawingML's later marL/indent pair states for the same binary predecessor format. */
65
+ readonly leftMargin: number | undefined;
66
+ readonly indent: number | undefined;
18
67
  }
19
68
  interface CharacterProperties {
20
69
  readonly bold: boolean | undefined;
@@ -36,4 +85,4 @@ interface StyleTextProps {
36
85
  }
37
86
  declare function readStyleTextPropAtom(record: PptRecord, characterCount: number): StyleTextProps;
38
87
  //#endregion
39
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CharacterProperties, ParagraphProperties, RgbColor, StyleRun, StyleTextProps, readStyleTextPropAtom };
88
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CharacterProperties, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom };
@@ -7,6 +7,48 @@ declare const ALIGN_JUSTIFY = 3;
7
7
  declare const ALIGN_DISTRIBUTED = 4;
8
8
  declare const ALIGN_THAI_DISTRIBUTED = 5;
9
9
  declare const ALIGN_JUSTIFY_LOW = 6;
10
+ declare const PF_HAS_BULLET: number;
11
+ declare const PF_BULLET_HAS_FONT: number;
12
+ declare const PF_BULLET_HAS_COLOR: number;
13
+ declare const PF_BULLET_HAS_SIZE: number;
14
+ declare const PF_BULLET_FONT: number;
15
+ declare const PF_BULLET_COLOR: number;
16
+ declare const PF_BULLET_SIZE: number;
17
+ declare const PF_BULLET_CHAR: number;
18
+ declare const PF_LEFT_MARGIN: number;
19
+ declare const PF_INDENT: number;
20
+ declare const PF_ALIGN: number;
21
+ declare const PF_LINE_SPACING: number;
22
+ declare const PF_SPACE_BEFORE: number;
23
+ declare const PF_SPACE_AFTER: number;
24
+ declare const PF_DEFAULT_TAB_SIZE: number;
25
+ declare const PF_FONT_ALIGN: number;
26
+ declare const PF_CHAR_WRAP: number;
27
+ declare const PF_WORD_WRAP: number;
28
+ declare const PF_OVERFLOW: number;
29
+ declare const PF_TAB_STOPS: number;
30
+ declare const PF_TEXT_DIRECTION: number;
31
+ declare const CF_BOLD: number;
32
+ declare const CF_ITALIC: number;
33
+ declare const CF_UNDERLINE: number;
34
+ declare const CF_SHADOW: number;
35
+ declare const CF_FEHINT: number;
36
+ declare const CF_KUMI: number;
37
+ declare const CF_EMBOSS: number;
38
+ declare const CF_HAS_STYLE: number;
39
+ declare const CF_TYPEFACE: number;
40
+ declare const CF_SIZE: number;
41
+ declare const CF_COLOR: number;
42
+ declare const CF_POSITION: number;
43
+ declare const CF_OLD_EA_TYPEFACE: number;
44
+ declare const CF_ANSI_TYPEFACE: number;
45
+ declare const CF_SYMBOL_TYPEFACE: number;
46
+ declare const STYLE_BOLD: number;
47
+ declare const STYLE_ITALIC: number;
48
+ declare const STYLE_UNDERLINE: number;
49
+ declare const STYLE_SHADOW: number;
50
+ declare const STYLE_EMBOSS: number;
51
+ declare const COLOR_INDEX_SRGB = 254;
10
52
  interface RgbColor {
11
53
  readonly red: number;
12
54
  readonly green: number;
@@ -15,6 +57,13 @@ interface RgbColor {
15
57
  interface ParagraphProperties {
16
58
  readonly indentLevel: number;
17
59
  readonly alignment: number | undefined;
60
+ /** ParaSpacing ([MS-PPT]), raw and unconverted: 0-13200 is a percentage of line height (value/100 = percent), negative is the absolute value in master units. content.ts's own paraSpacingToLineSpacing/paraSpacingToPoints do the schema-facing conversion -- this module stays format-level, with no document-schema.js knowledge of its own. */
61
+ readonly lineSpacing: number | undefined;
62
+ readonly spaceBefore: number | undefined;
63
+ readonly spaceAfter: number | undefined;
64
+ /** MarginOrIndent ([MS-PPT]): a signed offset in master units, no percentage form -- leftMargin is the paragraph's own left margin, indent the first line's own offset relative to it (negative for a hanging/bullet indent), the identical relationship DrawingML's later marL/indent pair states for the same binary predecessor format. */
65
+ readonly leftMargin: number | undefined;
66
+ readonly indent: number | undefined;
18
67
  }
19
68
  interface CharacterProperties {
20
69
  readonly bold: boolean | undefined;
@@ -36,4 +85,4 @@ interface StyleTextProps {
36
85
  }
37
86
  declare function readStyleTextPropAtom(record: PptRecord, characterCount: number): StyleTextProps;
38
87
  //#endregion
39
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CharacterProperties, ParagraphProperties, RgbColor, StyleRun, StyleTextProps, readStyleTextPropAtom };
88
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, CharacterProperties, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, ParagraphProperties, RgbColor, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, StyleRun, StyleTextProps, readStyleTextPropAtom };
@@ -8,6 +8,10 @@ const ALIGN_JUSTIFY = 3;
8
8
  const ALIGN_DISTRIBUTED = 4;
9
9
  const ALIGN_THAI_DISTRIBUTED = 5;
10
10
  const ALIGN_JUSTIFY_LOW = 6;
11
+ const PF_HAS_BULLET = 1;
12
+ const PF_BULLET_HAS_FONT = 2;
13
+ const PF_BULLET_HAS_COLOR = 4;
14
+ const PF_BULLET_HAS_SIZE = 8;
11
15
  const PF_BULLET_FONT = 16;
12
16
  const PF_BULLET_COLOR = 32;
13
17
  const PF_BULLET_SIZE = 64;
@@ -20,13 +24,19 @@ const PF_SPACE_BEFORE = 8192;
20
24
  const PF_SPACE_AFTER = 16384;
21
25
  const PF_DEFAULT_TAB_SIZE = 32768;
22
26
  const PF_FONT_ALIGN = 65536;
27
+ const PF_CHAR_WRAP = 1 << 17;
28
+ const PF_WORD_WRAP = 1 << 18;
29
+ const PF_OVERFLOW = 1 << 19;
23
30
  const PF_TAB_STOPS = 1 << 20;
24
31
  const PF_TEXT_DIRECTION = 1 << 21;
25
32
  const CF_BOLD = 1;
26
33
  const CF_ITALIC = 2;
27
34
  const CF_UNDERLINE = 4;
28
35
  const CF_SHADOW = 16;
36
+ const CF_FEHINT = 32;
37
+ const CF_KUMI = 128;
29
38
  const CF_EMBOSS = 512;
39
+ const CF_HAS_STYLE = 15360;
30
40
  const CF_TYPEFACE = 65536;
31
41
  const CF_SIZE = 1 << 17;
32
42
  const CF_COLOR = 1 << 18;
@@ -80,7 +90,7 @@ var FieldCursor = class {
80
90
  function readColorIndexStruct(cursor) {
81
91
  const [red, green, blue, index] = cursor.bytes(4);
82
92
  if (red === void 0 || green === void 0 || blue === void 0 || index === void 0) throw new PptFormatError("ColorIndexStruct read returned fewer than its four bytes");
83
- return index === COLOR_INDEX_SRGB ? {
93
+ return index === 254 ? {
84
94
  red,
85
95
  green,
86
96
  blue
@@ -89,26 +99,29 @@ function readColorIndexStruct(cursor) {
89
99
  function readTextPFException(cursor, indentLevel) {
90
100
  const masks = cursor.u32();
91
101
  if ((masks & 15) !== 0) cursor.skip(2);
92
- if ((masks & PF_BULLET_CHAR) !== 0) cursor.skip(2);
93
- if ((masks & PF_BULLET_FONT) !== 0) cursor.skip(2);
94
- if ((masks & PF_BULLET_SIZE) !== 0) cursor.skip(2);
95
- if ((masks & PF_BULLET_COLOR) !== 0) cursor.skip(4);
96
- const alignment = (masks & PF_ALIGN) !== 0 ? cursor.u16() : void 0;
97
- for (const mask of [
98
- PF_LINE_SPACING,
99
- PF_SPACE_BEFORE,
100
- PF_SPACE_AFTER,
101
- PF_LEFT_MARGIN,
102
- PF_INDENT,
103
- PF_DEFAULT_TAB_SIZE
104
- ]) if ((masks & mask) !== 0) cursor.skip(2);
105
- if ((masks & PF_TAB_STOPS) !== 0) cursor.skip(cursor.u16() * 4);
106
- if ((masks & PF_FONT_ALIGN) !== 0) cursor.skip(2);
102
+ if ((masks & 128) !== 0) cursor.skip(2);
103
+ if ((masks & 16) !== 0) cursor.skip(2);
104
+ if ((masks & 64) !== 0) cursor.skip(2);
105
+ if ((masks & 32) !== 0) cursor.skip(4);
106
+ const alignment = (masks & 2048) !== 0 ? cursor.u16() : void 0;
107
+ const lineSpacing = (masks & 4096) !== 0 ? cursor.i16() : void 0;
108
+ const spaceBefore = (masks & 8192) !== 0 ? cursor.i16() : void 0;
109
+ const spaceAfter = (masks & 16384) !== 0 ? cursor.i16() : void 0;
110
+ const leftMargin = (masks & 256) !== 0 ? cursor.i16() : void 0;
111
+ const indent = (masks & 1024) !== 0 ? cursor.i16() : void 0;
112
+ if ((masks & 32768) !== 0) cursor.skip(2);
113
+ if ((masks & 1048576) !== 0) cursor.skip(cursor.u16() * 4);
114
+ if ((masks & 65536) !== 0) cursor.skip(2);
107
115
  if ((masks & 917504) !== 0) cursor.skip(2);
108
- if ((masks & PF_TEXT_DIRECTION) !== 0) cursor.skip(2);
116
+ if ((masks & 2097152) !== 0) cursor.skip(2);
109
117
  return {
110
118
  indentLevel,
111
- alignment
119
+ alignment,
120
+ lineSpacing,
121
+ spaceBefore,
122
+ spaceAfter,
123
+ leftMargin,
124
+ indent
112
125
  };
113
126
  }
114
127
  function styleFlag(masks, maskBit, fontStyle, styleBit) {
@@ -118,19 +131,19 @@ function styleFlag(masks, maskBit, fontStyle, styleBit) {
118
131
  function readTextCFException(cursor) {
119
132
  const masks = cursor.u32();
120
133
  const fontStyle = (masks & 16055) !== 0 ? cursor.u16() : void 0;
121
- const fontRef = (masks & CF_TYPEFACE) !== 0 ? cursor.u16() : void 0;
122
- if ((masks & CF_OLD_EA_TYPEFACE) !== 0) cursor.skip(2);
123
- if ((masks & CF_ANSI_TYPEFACE) !== 0) cursor.skip(2);
124
- if ((masks & CF_SYMBOL_TYPEFACE) !== 0) cursor.skip(2);
125
- const sizePt = (masks & CF_SIZE) !== 0 ? cursor.i16() : void 0;
126
- const color = (masks & CF_COLOR) !== 0 ? readColorIndexStruct(cursor) : void 0;
127
- if ((masks & CF_POSITION) !== 0) cursor.skip(2);
134
+ const fontRef = (masks & 65536) !== 0 ? cursor.u16() : void 0;
135
+ if ((masks & 2097152) !== 0) cursor.skip(2);
136
+ if ((masks & 4194304) !== 0) cursor.skip(2);
137
+ if ((masks & 8388608) !== 0) cursor.skip(2);
138
+ const sizePt = (masks & 131072) !== 0 ? cursor.i16() : void 0;
139
+ const color = (masks & 262144) !== 0 ? readColorIndexStruct(cursor) : void 0;
140
+ if ((masks & 524288) !== 0) cursor.skip(2);
128
141
  return {
129
- bold: styleFlag(masks, CF_BOLD, fontStyle, STYLE_BOLD),
130
- italic: styleFlag(masks, CF_ITALIC, fontStyle, STYLE_ITALIC),
131
- underline: styleFlag(masks, CF_UNDERLINE, fontStyle, STYLE_UNDERLINE),
132
- shadow: styleFlag(masks, CF_SHADOW, fontStyle, STYLE_SHADOW),
133
- emboss: styleFlag(masks, CF_EMBOSS, fontStyle, STYLE_EMBOSS),
142
+ bold: styleFlag(masks, 1, fontStyle, 1),
143
+ italic: styleFlag(masks, 2, fontStyle, 2),
144
+ underline: styleFlag(masks, 4, fontStyle, 4),
145
+ shadow: styleFlag(masks, 16, fontStyle, 16),
146
+ emboss: styleFlag(masks, 512, fontStyle, 512),
134
147
  fontRef,
135
148
  sizePt,
136
149
  color
@@ -162,4 +175,4 @@ function readStyleTextPropAtom(record, characterCount) {
162
175
  };
163
176
  }
164
177
  //#endregion
165
- export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, readStyleTextPropAtom };
178
+ export { ALIGN_CENTER, ALIGN_DISTRIBUTED, ALIGN_JUSTIFY, ALIGN_JUSTIFY_LOW, ALIGN_LEFT, ALIGN_RIGHT, ALIGN_THAI_DISTRIBUTED, CF_ANSI_TYPEFACE, CF_BOLD, CF_COLOR, CF_EMBOSS, CF_FEHINT, CF_HAS_STYLE, CF_ITALIC, CF_KUMI, CF_OLD_EA_TYPEFACE, CF_POSITION, CF_SHADOW, CF_SIZE, CF_SYMBOL_TYPEFACE, CF_TYPEFACE, CF_UNDERLINE, COLOR_INDEX_SRGB, PF_ALIGN, PF_BULLET_CHAR, PF_BULLET_COLOR, PF_BULLET_FONT, PF_BULLET_HAS_COLOR, PF_BULLET_HAS_FONT, PF_BULLET_HAS_SIZE, PF_BULLET_SIZE, PF_CHAR_WRAP, PF_DEFAULT_TAB_SIZE, PF_FONT_ALIGN, PF_HAS_BULLET, PF_INDENT, PF_LEFT_MARGIN, PF_LINE_SPACING, PF_OVERFLOW, PF_SPACE_AFTER, PF_SPACE_BEFORE, PF_TAB_STOPS, PF_TEXT_DIRECTION, PF_WORD_WRAP, STYLE_BOLD, STYLE_EMBOSS, STYLE_ITALIC, STYLE_SHADOW, STYLE_UNDERLINE, readStyleTextPropAtom };
package/dist/units.cjs CHANGED
@@ -6,7 +6,11 @@ const MASTER_UNITS_PER_POINT = MASTER_UNITS_PER_INCH / 72;
6
6
  function masterUnitsToPoints(masterUnits) {
7
7
  return masterUnits / 8;
8
8
  }
9
+ function pointsToMasterUnits(points) {
10
+ return Math.round(points * 8);
11
+ }
9
12
  //#endregion
10
13
  exports.MASTER_UNITS_PER_POINT = MASTER_UNITS_PER_POINT;
11
14
  exports.POINTS_PER_INCH = POINTS_PER_INCH;
12
15
  exports.masterUnitsToPoints = masterUnitsToPoints;
16
+ exports.pointsToMasterUnits = pointsToMasterUnits;
package/dist/units.d.cts CHANGED
@@ -2,5 +2,6 @@
2
2
  declare const POINTS_PER_INCH = 72;
3
3
  declare const MASTER_UNITS_PER_POINT: number;
4
4
  declare function masterUnitsToPoints(masterUnits: number): number;
5
+ declare function pointsToMasterUnits(points: number): number;
5
6
  //#endregion
6
- export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints };
7
+ export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits };
package/dist/units.d.ts CHANGED
@@ -2,5 +2,6 @@
2
2
  declare const POINTS_PER_INCH = 72;
3
3
  declare const MASTER_UNITS_PER_POINT: number;
4
4
  declare function masterUnitsToPoints(masterUnits: number): number;
5
+ declare function pointsToMasterUnits(points: number): number;
5
6
  //#endregion
6
- export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints };
7
+ export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits };
package/dist/units.js CHANGED
@@ -5,5 +5,8 @@ const MASTER_UNITS_PER_POINT = MASTER_UNITS_PER_INCH / 72;
5
5
  function masterUnitsToPoints(masterUnits) {
6
6
  return masterUnits / 8;
7
7
  }
8
+ function pointsToMasterUnits(points) {
9
+ return Math.round(points * 8);
10
+ }
8
11
  //#endregion
9
- export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints };
12
+ export { MASTER_UNITS_PER_POINT, POINTS_PER_INCH, masterUnitsToPoints, pointsToMasterUnits };