-
Notifications
You must be signed in to change notification settings - Fork 99
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
Svg refinement #1657
Svg refinement #1657
Conversation
…icular viewBox so that text size matches containing document; Define image file type list
…its, and AVOID scaling, so that text size matches document
Just to double-check, is this the kind of output you are seeing for the example in #1196 ? The other examples seem quite pleasing, especially the one in #632 . The tikz examples from the showcase |
Pretty much, yeah; it isn't perfect, but quite close given that the absolute dimensions and not having the same math font as TeX. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Impressive PR, lots of upgrades!
I have a limited understanding here, but tried to spot what I could, and remarked on what was hard to read through. Quite happy with the updated/added tests!
I'm even wondering if it's better to have some of those as HTML to easily preview if they look right using a browser... but I assume you did that with latexmlpost locally, which is fine.
$Ax = 0; | ||
$Bx = $w->subtract($Bw)->ptValue; | ||
$w = 2 * $maxw unless $w; | ||
$h = $Ah + $Bh unless $h; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are the zero cases important here? i.e. compared to unless defined $h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly, I've lost track by now.
AssignValue('\psorigin', Pair($c0->getX->negate, $c0->getY->negate)); | ||
my $org = getNecessaryTransform(); | ||
AssignValue('_psActiveCCTransform', $org); | ||
ackTransform($org); | ||
$whatsit->setProperties(need => 1, transform => $org->ptValue); | ||
|
||
$whatsit->setProperties(need => 1, transform => $org->ptValue, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking: the transform here is still in ptValue
even if all others are switching to px?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possibly; transform in this case is a simple dimension, not the css/svg one. Lack of testing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
Overall refinement of SVG output from both TikZ and the picture environment. The main thrust is to avoid any scaling that causes the text within the SVG to be different size than the text in the containing document. This basically means to consistently use pixel units within the SVG, and avoid the
viewBox
attribute (which introduces an unknowable scaling).Several other Tikz/picture improvements were snuck in along the way.
Thus this:
fixes #1646
fixes #1196
fixes #632
Note that we currently can only estimate the text size from TeX's perspective, and have no way of knowing the browser's fonts. Thus any such scaling compounds any alignment and sizing errors.