Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(textkit): make indentation only affect first line. #2975

Merged
merged 2 commits into from
Nov 26, 2024

Conversation

daslaf
Copy link
Contributor

@daslaf daslaf commented Nov 22, 2024

Prepend width minus indentation instead of subtracting the indentation value in first entry of availableWidths.
In the linebreak algorithm, a line length is determined by the length value provided in the lines array in a specific index or by using the last item of the array, however most of the arrays provided when calling layoutParagraph have just a single value. By subtracting the indent from the first value in the array (which in most cases is also the last one) will make all lines that do not have a matching element in the array the same width, hence having a lot of extra whitespace on the right hand side when providing a value for indent.

Closes #2968

Copy link

changeset-bot bot commented Nov 22, 2024

🦋 Changeset detected

Latest commit: a93dcc6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 9 packages
Name Type
@react-pdf/textkit Patch
@react-pdf/layout Patch
@react-pdf/render Patch
@react-pdf/renderer Patch
next-14 Patch
next-15 Patch
@react-pdf/vite-example Patch
@react-pdf/e2e-node-cjs Patch
@react-pdf/e2e-node-esm Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@diegomura diegomura changed the title Fix 2968: Make indentation only affect first line. fix(textkit): make indentation only affect first line. Nov 26, 2024
Copy link
Owner

@diegomura diegomura left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK

Thanks!

@diegomura diegomura merged commit 00bfdc1 into diegomura:master Nov 26, 2024
natterstefan added a commit to traveltechdeluxe/react-pdf that referenced this pull request Dec 6, 2024
# By Diego Muracciole (31) and others
# Via GitHub
* upstream/master: (60 commits)
  feat: allow units for page size (diegomura#2773)
  chore: bump jay-peg
  chore: release packages (diegomura#2981)
  fix(textkit): make indentation only affect first line. (diegomura#2975)
  fix: conditional rendering (diegomura#2983)
  fix(reconciler): missing dependencies (diegomura#2980)
  chore: release packages (diegomura#2959)
  feat: rem border widths (diegomura#2960)
  fix: add scheduler dependency (diegomura#2958)
  chore: update README
  chore: release packages (diegomura#2953)
  feat: support rem units (diegomura#2955)
  feat: add image stress test example (diegomura#2954)
  feat: support multiple line-height units (diegomura#2952)
  chore: release packages (diegomura#2946)
  fix: note rendering (diegomura#2951)
  feat: accept commas between transformations (diegomura#2950)
  fix: document metadata setters (diegomura#2949)
  fix: stroke dash array computation (diegomura#2948)
  feat: remove cross-fetch (diegomura#2947)
  ...

# Conflicts:
#	packages/renderer/index.d.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

textIndent leads to subsequent lines having their RHS reduced by same amount
2 participants