Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement pgf baseline #2535

Merged
merged 2 commits into from
Mar 24, 2025
Merged

Implement pgf baseline #2535

merged 2 commits into from
Mar 24, 2025

Conversation

brucemiller
Copy link
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
@@ -133,6 +134,7 @@ DefConstructor('\lxSVG@insertpicture{}', sub {
$whatsit->setProperty(depth => Dimension(0));
$whatsit->setProperty(pxwidth => $w);
$whatsit->setProperty(pxheight => $h);
$whatsit->setProperty(style => "vertical-align:".$base."px") if $base;
Copy link
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
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
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
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