@qrcommunication/gigapdf-lib 0.52.2 → 0.52.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.d.cts CHANGED
@@ -1094,8 +1094,16 @@ declare class GigaPdfDoc {
1094
1094
  * font's char→glyph map (Identity-H, 2-byte glyph ids). `rgb` is packed
1095
1095
  * `0xRRGGBB`; `rotationDeg` rotates CCW about `(x, y)`. For a built-in base-14
1096
1096
  * family with no embedding, use {@link addStandardText}.
1097
- */
1098
- addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
1097
+ *
1098
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1099
+ * draws a rule just below the baseline, `{ strikethrough: true }` a rule near
1100
+ * the x-height — both span the run's advance and are filled in the text colour.
1101
+ * Omitting `opts` is fully backward-compatible (no decoration).
1102
+ */
1103
+ addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number, opts?: {
1104
+ underline?: boolean;
1105
+ strikethrough?: boolean;
1106
+ }): boolean;
1099
1107
  /**
1100
1108
  * Draw `text` at `(x, y)` in a built-in **base-14 standard font** (`fontName`,
1101
1109
  * e.g. `"Times-Bold"`, `"Courier-Oblique"`, `"Symbol"`) — no embedding needed,
@@ -1103,8 +1111,15 @@ declare class GigaPdfDoc {
1103
1111
  * {@link embedFont} (a Google Font fetched by the host, or one pulled out of
1104
1112
  * the document with {@link extractFont}) and use {@link addText}. Returns
1105
1113
  * `false` on an unknown font name or bad page.
1114
+ *
1115
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1116
+ * and/or `{ strikethrough: true }` draw filled rules in the text colour.
1117
+ * Omitting `opts` is fully backward-compatible (no decoration).
1106
1118
  */
1107
- addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
1119
+ addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number, opts?: {
1120
+ underline?: boolean;
1121
+ strikethrough?: boolean;
1122
+ }): boolean;
1108
1123
  /**
1109
1124
  * Stamp a standard-**Helvetica** watermark (no font embed needed): `text` at
1110
1125
  * `(x, y)`, rotated `rotationDeg`° counter-clockwise, `rgb` packed `0xRRGGBB`,
package/dist/index.d.ts CHANGED
@@ -1094,8 +1094,16 @@ declare class GigaPdfDoc {
1094
1094
  * font's char→glyph map (Identity-H, 2-byte glyph ids). `rgb` is packed
1095
1095
  * `0xRRGGBB`; `rotationDeg` rotates CCW about `(x, y)`. For a built-in base-14
1096
1096
  * family with no embedding, use {@link addStandardText}.
1097
- */
1098
- addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
1097
+ *
1098
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1099
+ * draws a rule just below the baseline, `{ strikethrough: true }` a rule near
1100
+ * the x-height — both span the run's advance and are filled in the text colour.
1101
+ * Omitting `opts` is fully backward-compatible (no decoration).
1102
+ */
1103
+ addText(page: number, x: number, y: number, size: number, text: string, fontObj: number, rgb?: number, opacity?: number, rotationDeg?: number, opts?: {
1104
+ underline?: boolean;
1105
+ strikethrough?: boolean;
1106
+ }): boolean;
1099
1107
  /**
1100
1108
  * Draw `text` at `(x, y)` in a built-in **base-14 standard font** (`fontName`,
1101
1109
  * e.g. `"Times-Bold"`, `"Courier-Oblique"`, `"Symbol"`) — no embedding needed,
@@ -1103,8 +1111,15 @@ declare class GigaPdfDoc {
1103
1111
  * {@link embedFont} (a Google Font fetched by the host, or one pulled out of
1104
1112
  * the document with {@link extractFont}) and use {@link addText}. Returns
1105
1113
  * `false` on an unknown font name or bad page.
1114
+ *
1115
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1116
+ * and/or `{ strikethrough: true }` draw filled rules in the text colour.
1117
+ * Omitting `opts` is fully backward-compatible (no decoration).
1106
1118
  */
1107
- addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number): boolean;
1119
+ addStandardText(page: number, x: number, y: number, size: number, text: string, fontName: string, rgb?: number, opacity?: number, rotationDeg?: number, opts?: {
1120
+ underline?: boolean;
1121
+ strikethrough?: boolean;
1122
+ }): boolean;
1108
1123
  /**
1109
1124
  * Stamp a standard-**Helvetica** watermark (no font embed needed): `text` at
1110
1125
  * `(x, y)`, rotated `rotationDeg`° counter-clockwise, `rgb` packed `0xRRGGBB`,
package/dist/index.js CHANGED
@@ -1194,11 +1194,18 @@ var GigaPdfDoc = class {
1194
1194
  * font's char→glyph map (Identity-H, 2-byte glyph ids). `rgb` is packed
1195
1195
  * `0xRRGGBB`; `rotationDeg` rotates CCW about `(x, y)`. For a built-in base-14
1196
1196
  * family with no embedding, use {@link addStandardText}.
1197
+ *
1198
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1199
+ * draws a rule just below the baseline, `{ strikethrough: true }` a rule near
1200
+ * the x-height — both span the run's advance and are filled in the text colour.
1201
+ * Omitting `opts` is fully backward-compatible (no decoration).
1197
1202
  */
1198
- addText(page, x, y, size, text, fontObj, rgb = 0, opacity = 1, rotationDeg = 0) {
1203
+ addText(page, x, y, size, text, fontObj, rgb = 0, opacity = 1, rotationDeg = 0, opts) {
1204
+ const underline = opts?.underline ? 1 : 0;
1205
+ const strikethrough = opts?.strikethrough ? 1 : 0;
1199
1206
  return this.g._withStr(
1200
1207
  text,
1201
- (p, l) => this.ex().gp_add_text(
1208
+ (p, l) => this.ex().gp_add_text_styled(
1202
1209
  this.h,
1203
1210
  page,
1204
1211
  x,
@@ -1209,7 +1216,9 @@ var GigaPdfDoc = class {
1209
1216
  fontObj,
1210
1217
  RGB(rgb),
1211
1218
  opacity,
1212
- rotationDeg
1219
+ rotationDeg,
1220
+ underline,
1221
+ strikethrough
1213
1222
  )
1214
1223
  ) === 0;
1215
1224
  }
@@ -1220,13 +1229,19 @@ var GigaPdfDoc = class {
1220
1229
  * {@link embedFont} (a Google Font fetched by the host, or one pulled out of
1221
1230
  * the document with {@link extractFont}) and use {@link addText}. Returns
1222
1231
  * `false` on an unknown font name or bad page.
1232
+ *
1233
+ * Pass `opts` to bake **text decorations** into the run: `{ underline: true }`
1234
+ * and/or `{ strikethrough: true }` draw filled rules in the text colour.
1235
+ * Omitting `opts` is fully backward-compatible (no decoration).
1223
1236
  */
1224
- addStandardText(page, x, y, size, text, fontName, rgb = 0, opacity = 1, rotationDeg = 0) {
1237
+ addStandardText(page, x, y, size, text, fontName, rgb = 0, opacity = 1, rotationDeg = 0, opts) {
1238
+ const underline = opts?.underline ? 1 : 0;
1239
+ const strikethrough = opts?.strikethrough ? 1 : 0;
1225
1240
  return this.g._withStr(
1226
1241
  text,
1227
1242
  (tp, tl) => this.g._withStr(
1228
1243
  fontName,
1229
- (fp, fl) => this.ex().gp_add_text_standard(
1244
+ (fp, fl) => this.ex().gp_add_text_standard_styled(
1230
1245
  this.h,
1231
1246
  page,
1232
1247
  x,
@@ -1238,7 +1253,9 @@ var GigaPdfDoc = class {
1238
1253
  fl,
1239
1254
  RGB(rgb),
1240
1255
  opacity,
1241
- rotationDeg
1256
+ rotationDeg,
1257
+ underline,
1258
+ strikethrough
1242
1259
  )
1243
1260
  )
1244
1261
  ) === 0;