Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/applyparseattributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@ export function parseAttributes(context: Context, svgNode: SvgNode, node?: Eleme

const alignmentBaseline =
getAttribute(domNode, context.styleSheets, 'vertical-align') ||
getAttribute(domNode, context.styleSheets, 'alignment-baseline')
getAttribute(domNode, context.styleSheets, 'alignment-baseline') ||
getAttribute(domNode, context.styleSheets, 'dominant-baseline')
if (alignmentBaseline) {
const matchArr = alignmentBaseline.match(
/(baseline|text-bottom|alphabetic|ideographic|middle|central|mathematical|text-top|bottom|center|top|hanging)/
Expand Down
3 changes: 2 additions & 1 deletion src/nodes/text.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { GraphicsNode } from './graphicsnode'
import { Rect } from '../utils/geometry'
import { Matrix } from 'jspdf'
import { SvgNode } from './svgnode'
import { parseAttributes } from '../applyparseattributes'
import { parseAttributes, applyContext } from '../applyparseattributes'

interface TrimInfo {
prevText: string
Expand Down Expand Up @@ -153,6 +153,7 @@ export class TextNode extends GraphicsNode {
if (visibility === 'visible') {
const alignmentBaseline = context.attributeState.alignmentBaseline
const textRenderingMode = getTextRenderingMode(context.attributeState)
applyContext(context)
context.pdf.text(transformedText, textX + dx - xOffset, textY + dy, {
baseline: mapAlignmentBaseline(alignmentBaseline),
angle: context.transform,
Expand Down