pa_font 0.3.3 → 0.3.4

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/paFont.cjs CHANGED
@@ -3378,10 +3378,7 @@ function normalizeParagraphOptions(fontInstance, options = {}) {
3378
3378
  width,
3379
3379
  height,
3380
3380
  gap: gap ?? DEFAULT_PARAGRAPH_GAP,
3381
- anchor: anchor ?? {
3382
- x: 0,
3383
- y: 0
3384
- },
3381
+ anchor,
3385
3382
  lineHeight: resolveLineHeight(options.lineHeight, textOptions.size),
3386
3383
  align: normalizeEnum(options.align, [
3387
3384
  "left",
@@ -3823,13 +3820,13 @@ function finalizeLayoutBox(layoutBox, options, textHeight) {
3823
3820
  };
3824
3821
  }
3825
3822
  function applyParagraphAnchor(lines, textBBox, layoutBox, anchor) {
3826
- if (anchor == null || Math.abs(anchor.x) <= JUSTIFY_EPSILON && Math.abs(anchor.y) <= JUSTIFY_EPSILON) return {
3823
+ if (anchor == null) return {
3827
3824
  lines,
3828
3825
  textBBox,
3829
3826
  layoutBox
3830
3827
  };
3831
- const tx = -layoutBox.contentBox.w * anchor.x;
3832
- const ty = -layoutBox.contentBox.h * anchor.y;
3828
+ const tx = layoutBox.contentX - (textBBox.x + textBBox.w * anchor.x);
3829
+ const ty = layoutBox.contentY - (textBBox.y + textBBox.h * anchor.y);
3833
3830
  return {
3834
3831
  lines: translatePositionedLines(lines, tx, ty),
3835
3832
  textBBox: translateRect(textBBox, tx, ty),