-
Notifications
You must be signed in to change notification settings - Fork 10.2k
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 text rendering modes in SVG backend #10022
Conversation
Firefox seems to have a problem when SVG |
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.
Looks good! Some minor comments, but I'm glad that work is being done to improve the SVG back-end.
src/display/svg.js
Outdated
if (current.fillColor !== SVG_DEFAULTS.fillColor) { | ||
current.tspan.setAttributeNS(null, 'fill', current.fillColor); | ||
|
||
let fillStrokeMode = current.textRenderingMode & |
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.
This can be const
instead of let
.
src/display/svg.js
Outdated
@@ -865,7 +890,16 @@ SVGGraphics = (function SVGGraphicsClosure() { | |||
current.xcoords = []; | |||
}, | |||
|
|||
endText: function SVGGraphics_endText() {}, | |||
endText() { | |||
let current = this.current; |
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.
This can be const
instead of let
.
src/display/svg.js
Outdated
endText() { | ||
let current = this.current; | ||
if ((current.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG) && | ||
current.txtElement && current.txtElement.hasChildNodes()) { |
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.
Add one more space to this line to make it align with the inner parenthesis.
src/display/svg.js
Outdated
|
||
current.element.setAttributeNS(null, 'fill', 'none'); | ||
|
||
this.endPath(); | ||
} | ||
}, | ||
|
||
setStrokeAttributes(element) { |
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.
Let's make this private, i.e., _setStrokeAttributes
, because it's not part of the public interface.
src/display/svg.js
Outdated
|
||
current.element.setAttributeNS(null, 'fill', 'none'); | ||
|
||
this.endPath(); | ||
} | ||
}, | ||
|
||
setStrokeAttributes(element) { | ||
let current = this.current; |
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.
This can be const
instead of let
.
src/display/svg.js
Outdated
@@ -978,7 +1012,8 @@ SVGGraphics = (function SVGGraphicsClosure() { | |||
var clipPath = this.svgFactory.createElement('svg:clipPath'); | |||
clipPath.setAttributeNS(null, 'id', clipId); | |||
clipPath.setAttributeNS(null, 'transform', pm(this.transformMatrix)); | |||
var clipElement = current.element.cloneNode(); | |||
// A deep clone is needed when text is used as a clipping path. | |||
var clipElement = current.element.cloneNode(true); |
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.
Let's change this from var
to const
too while we're touching the line. In general we only modernize if we either touch the line or we convert the entire file/class in a new commit, so the former is fine here.
Great work! I tested this locally since we don't have reference tests for the SVG back-end and this works just fine. |
Good job! Any estimates on when it is going to be a part of a new release? |
No exact date yet, but we have been talking about making a release really soon now that we have most patches merged. |
This implements the operator
Tr
in the SVG backend.Fixes #7017 (comment)
Fixes #9647
Fixes #9999