Skip to content

Commit

Permalink
fix(troika-three-text): Fix anchorY bottom-baseline. Closes #309
Browse files Browse the repository at this point in the history
  • Loading branch information
lojjic committed Apr 9, 2024
1 parent bf0f683 commit 3457b03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/troika-three-text/src/Typesetter.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export function createTypesetter(resolveFonts, bidi) {
baseline: -halfLeading - ascender * fontSizeMult, // baseline offset from top of line height
// cap: -halfLeading - capHeight * fontSizeMult, // cap from top of line height
// ex: -halfLeading - xHeight * fontSizeMult, // ex from top of line height
caretTop: (ascender + descender) / 2 * fontSizeMult + caretHeight / 2,
caretTop,
caretBottom: caretTop - caretHeight
}
metricsByFont.set(fontObj, fontData)
Expand Down Expand Up @@ -390,7 +390,7 @@ export function createTypesetter(resolveFonts, bidi) {
anchorY === 'top-ex' ? -lines[0].ex :
anchorY === 'middle' ? totalHeight / 2 :
anchorY === 'bottom' ? totalHeight :
anchorY === 'bottom-baseline' ? lines[lines.length - 1].baseline :
anchorY === 'bottom-baseline' ? -lines[lines.length - 1].baseline :
parsePercent(anchorY) * totalHeight
}
}
Expand Down

0 comments on commit 3457b03

Please sign in to comment.