wallento / wavedrompy

WaveDrom compatible python command line

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

First Letter of Header and Footer Text Is Truncated

MutantPlatypus opened this issue · comments

The first letter of header and footer text is not rendered in the SVG. Adding a header and footer to the example in Readme.md as below reproduces the error.

import wavedrom
svg = wavedrom.render("""
{ "signal": [
 { "name": "CK",   "wave": "P.......",                                              "period": 2  },
 { "name": "CMD",  "wave": "x.3x=x4x=x=x=x=x", "data": "RAS NOP CAS NOP NOP NOP NOP", "phase": 0.5 },
 { "name": "ADDR", "wave": "x.=x..=x........", "data": "ROW COL",                     "phase": 0.5 },
 { "name": "DQS",  "wave": "z.......0.1010z." },
 { "name": "DQ",   "wave": "z.........5555z.", "data": "D0 D1 D2 D3" }
],
"head":{
    "text": "WaveDrom example"
},
"foot":{
    "text": "Figure 100"
}
}""")
svg.saveas("demo1.svg")

Gives

            <text fill="#000" text-anchor="middle" x="320.0" xml:space="preserve" y="-33">
                <tspan>a</tspan>
                <tspan>v</tspan>
                <tspan>e</tspan>
                <tspan>D</tspan>
                <tspan>r</tspan>
                <tspan>o</tspan>
                <tspan>m</tspan>
                <tspan>
                </tspan>
                <tspan>e</tspan>
                <tspan>x</tspan>
                <tspan>a</tspan>
                <tspan>m</tspan>
                <tspan>p</tspan>
                <tspan>l</tspan>
                <tspan>e</tspan>
            </text>

image

demo1.svg generated above attached in full: demo1.zip

That's strange, thanks for reporting, I will look into it!

I have fixed it in 5092dd7, can you please give it a try? Thanks

Confirmed fixed:

>>> import wavedrom
>>> wavedrom.version
'1.8.0.post5.dev3+g5092dd7'
>>> svg = wavedrom.render("""
... { "signal": [
...  { "name": "CK",   "wave": "P.......",                                              "period": 2  },
...  { "name": "CMD",  "wave": "x.3x=x4x=x=x=x=x", "data": "RAS NOP CAS NOP NOP NOP NOP", "phase": 0.5 },
...  { "name": "ADDR", "wave": "x.=x..=x........", "data": "ROW COL",                     "phase": 0.5 },
...  { "name": "DQS",  "wave": "z.......0.1010z." },
...  { "name": "DQ",   "wave": "z.........5555z.", "data": "D0 D1 D2 D3" }
... ],
... "head":{
...     "text": "WaveDrom example"
... },
... "foot":{
...     "text": "Figure 100"
... }
... }""")
>>> svg.saveas("demo1.svg")

image
demo1.zip

Hi, reopened on purpose?

Yes. I thought I could point to the commit and would get some options when clicking the close button. I have since learned it has to be closed by a pull request into the main trunk. (I think. I'm still learning the terminology and workflow.) I wasn't sure if you wanted to close it via the pull request so I just reopened it. I see you are closing other issues in a similar way, so I'll just close it now. Thanks for your help!

Confirmed fixed in 5092dd7.

Oh yeah, the workflows differ usually. I tend to use "close by commit" only for my own issues and let users confirm. Anyhow, I just this morning changed it to "I will close and users can re-open if they found the fix did not work". Anyhow, I am not religious about the workflow for this size of a project :)

And thanks a lot for reporting the various issues. It is very helpful!

In case you find time and are allowed to you may consider to share regression tests with me. Known wave descriptions that we can ensure with automatic tests will not be broken accidentally.

I actually already took a peek at the regression tests, but didn't understand the Regression object after giving it 20 seconds of though so I tabled it for later. I am definitely considering it, though.

Oh, yeah, you need to understand a bit of the internals. It would be great if you can share with me some "interesting" waves. The regression checks that they are rendered properly. Unfortunately there are no other regressions (yet)

This is now also tested in the regression tests. You can add more tests if you have similar to 0afc434!

I'll try. What has your workflow been for adding a running a test locally before pushing to the remote repository? I see the .gitignore file has Spyder and Jupyter entries... are you using either of those?

I am rather conservative:

  • Create multiple virtual envs for different Python versions (I run them occasionally on Python 2.7 and Python 3.5)
  • pip install -e .[test] in each venv
  • WAVEDROMDIR=path/to/wavedrom pytest -v in each venv (mostly -k for some specific test I am fixing)

Obviously this can be improved, but it is not painful enough for me to look into alternatives :)