Skip to content

Commit

Permalink
fix(troika-three-text): fix text baseline being positioned too low
Browse files Browse the repository at this point in the history
  • Loading branch information
lojjic committed Oct 19, 2020
1 parent 0c397b6 commit 596d8ca
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/troika-three-text/src/worker/FontProcessor.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ export function createFontProcessor(fontParser, sdfGenerator, config) {
// Determine line height and leading adjustments
lineHeight = lineHeight * fontSize
const halfLeading = (lineHeight - (ascender - descender) * fontSizeMult) / 2
const topBaseline = -(fontSize + halfLeading)
const topBaseline = -(ascender * fontSizeMult + halfLeading)
const caretHeight = Math.min(lineHeight, (ascender - descender) * fontSizeMult)
const caretBottomOffset = (ascender + descender) / 2 * fontSizeMult - caretHeight / 2

Expand Down

0 comments on commit 596d8ca

Please sign in to comment.