Skip to content

Commit

Permalink
chore: include letter-spacing for more accurate measurements on Truncate
Browse files Browse the repository at this point in the history
  • Loading branch information
artashes-sanoyan authored and chengpeiquan committed Oct 22, 2024
1 parent 186ea82 commit 16c5a3b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Truncate/Truncate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ export const Truncate: React.FC<TruncateProps> = ({
style.fontFamily,
].join(' ')

if (canvasContext) canvasContext.font = font
if (canvasContext) {
canvasContext.font = font
canvasContext.letterSpacing = style.letterSpacing
}

setTargetWidth(newTargetWidth)
}, [canvasContext, width])
Expand Down

0 comments on commit 16c5a3b

Please sign in to comment.