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