Skip to content

Implement pgf baseline#2535

Merged
brucemiller merged 2 commits intomasterfrom
pgf-baseline
Mar 24, 2025
Merged

Implement pgf baseline#2535
brucemiller merged 2 commits intomasterfrom
pgf-baseline

Conversation

@brucemiller
Copy link
Copy Markdown
Owner

This PR implements the baseline keyword option of pgf. It is basically #2477, but directly implements the baseline adjustment using CSS vertical-align, rather than usurping the imagedepth attribute. All the debugging was done by @xworld21 Thanks!!!

Closes #2477

@brucemiller brucemiller requested a review from dginev March 20, 2025 22:24
$whatsit->setProperty(depth => Dimension(0));
$whatsit->setProperty(pxwidth => $w);
$whatsit->setProperty(pxheight => $h);
$whatsit->setProperty(style => "vertical-align:".$base."px") if $base;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

With a CSS hat on, the vertical-align property would work on inline, inline-block or table-cell display types. Should we explicit enforce the mode that is intended here? I assume it is display: inline; ?

At least that is the default for the SVG display attribute... so that can also be an explicit attribute added in $document->openElement('svg:svg', above.

Mostly worried about cases where something may override that, though I don't have specific examples in mind.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The same would apply to the img tag.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

That's the reason #2534 adds the <span class="ltx_inline-block"> wrapper for svg:svg; @xworld21 had discovered that vertical-align wasn't being consistently respected, particularly within an mtext. Simply asserting display on the svg wasn't enough for Firefox.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Simply asserting display on the svg wasn't enough for Firefox.

Sheesh. Good to know.

@brucemiller brucemiller merged commit ac3255d into master Mar 24, 2025
26 checks passed
@brucemiller brucemiller deleted the pgf-baseline branch March 24, 2025 15:32
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.

3 participants