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

pstoedit objects distorted if edited with pdf2svg and vice versa #56

Closed
sizmailov opened this issue Oct 29, 2018 · 1 comment · Fixed by #58
Closed

pstoedit objects distorted if edited with pdf2svg and vice versa #56

sizmailov opened this issue Oct 29, 2018 · 1 comment · Fixed by #58
Labels
bug Something isn't working
Milestone

Comments

@sizmailov
Copy link
Collaborator

sizmailov commented Oct 29, 2018

Steps to reproduce:

  1. Create TexText object with pstoedit backend
  2. Apply skew/rotation to TexText object
  3. Open TexText object with pdf2svg backend, click "Save" button.

Affected systems:

  • Ubuntu 18.04.1
    • pstoedit: 3.70-5
    • ghostscript: 9.25~dfsg+1
    • pdf2svg: 0.2.3-1
    • textext 0.8.1
    • inkscape 0.92.3
  • Ubuntu 14.04.5
    • pstoedit: 3.62
    • ghostscript: 9.25~dfsg+1
    • pdf2svg: 0.2.2-1
    • textext 0.8.1
    • inkscape 0.48.4

Here is and example:

     $$\lim_{x \to 0} \frac{\sin(x)}{x} = 1$$

image

image

Edit 1: Add system info
Edit 2: Test bug on Ubuntu 14.04

@sizmailov sizmailov changed the title pstoedit objects distorted if edited with pdf2svg pstoedit objects distorted if edited with pdf2svg and vice versa Oct 29, 2018
@sizmailov
Copy link
Collaborator Author

sizmailov commented Oct 30, 2018

The solution:
Change

textext/textext.py

Lines 1137 to 1141 in 0164a57

old_transform = ref_node.get_attrib('transform')
composition = st.parseTransform(old_transform, scale_transform)
# Account for vertical flipping of pstoedit nodes when recompiled via pdf2svg and vice versa
composition = self._check_and_fix_transform(ref_node, composition)

to

        old_transform = st.parseTransform(ref_node.get_attrib('transform'))

        # Account for vertical flipping of pstoedit nodes when recompiled via pdf2svg and vice versa
        revert_flip = ... 
        composition = st.composeTransform(old_transform, revert_flip)

        composition = st.composeTransform(scale_transform, composition)

where revert flip is [[1,0,0],[0,1,0]] if converter is same and [[1,0,0],[0,-1,0]] otherwise

I propose to change signature and name of _check_and_fix_transform to return such matrix.

sizmailov added a commit to sizmailov/textext that referenced this issue Oct 30, 2018
@jcwinkler jcwinkler added this to the 0.8.2 milestone Nov 5, 2018
@jcwinkler jcwinkler added the bug Something isn't working label Nov 5, 2018
jcwinkler added a commit that referenced this issue Nov 5, 2018
fix flipping compensation for distorted nodes, closes #56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants