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

Use rmscene 0.5.0, ensure strocks are inside the svg and minor adjustments #19

Merged
merged 24 commits into from
Dec 1, 2024

Conversation

Seb-sti1
Copy link
Contributor

This is largely based on #5 to use the scene tree API. I then used the changelog of rmscene to upgrade to 0.5.0. I finally modify a bit the SVG exporter to ensure the strokes were inside the SVG and fix the anchor issues I stumble upon.

It is the branch used by Seb-sti1/rmtree, and it exports all my files properly (decently aligned to the background PDF, not that much with the background template).

Regarding the rmscene 0.6.0, the main modification needed would probably be done by #18.

Let me know if anything is unclear.

ricklupton and others added 24 commits June 16, 2024 13:13
- use SceneTree API instead of blocks iterator
- use text.TextDocument instead of scene_items.Text
- use SceneTree API instead of blocks iterator
- use SceneTree API instead of blocks iterator
- use proper logger
- mimic rm tree structure in the svg
- add anchor position dictionary
- use text.TextDocument instead of scene_items.Text
Change viewBox min values to the minimum x/y coordinates of the strokes
- extract and rename cutoff into a function
- fix typos
Fix size issue and scale to 72 dpi
Also blurring the lines doesn't make the image look better/closer to the remarkable one and make the image really laggy.
@ricklupton
Copy link
Owner

Thanks for this. Generally looks all good. I'll have to come back on a computer to merge / check conflicts but will try to do that soon.

I'm curious about your changes to the special anchor position y coords. I'm not sure, but I thought these represented the top and bottom edges of the document, so a drawing at the bottom of the page would stay there even if more lines of text were added. Did you find something different?

@Seb-sti1
Copy link
Contributor Author

Thanks for this. Generally looks all good. I'll have to come back on a computer to merge / check conflicts but will try to do that soon.

Thank you :) ! I tried to commit in an easy-to-understand way and keep a linear git history but it's not perfect, so don't hesitate

I'm curious about your changes to the special anchor position y coords. I'm not sure, but I thought these represented the top and bottom edges of the document, so a drawing at the bottom of the page would stay there even if more lines of text were added. Did you find something different?

I find it curious too, an anchor for the end of the page makes a lot of sense. But, when trying to debug the tests/rm/pen_size_test.strokes.rm, I obtained the following:

Image obtained using the PDF exported via the remarkable With 270, 700 for the special anchor With 100, 100 for the special anchor

Looking at it again now, it seems that 270 for CrdtId(0, 281474976710654) would probably be better but 700 for CrdtId(0, 281474976710655) would still be too much.

Test setup:

  • I used a more recent version of the same file (new_pen_size_test.strokes.rm.txt (this is not a txt file, it is just so that GitHub accepts the upload)) even though I am pretty sure that the only modifications are "metadata" and not stroke/anchor related data. I used that file, instead of the one in the repo, so that the PDF and SVGs export were based on the same rm file.
  • The exported PDF is available here DrawStyle.pdf, while the SVGs are here 100_100.svg 270_700.svg.
  • The 100_100.svg is generated using the current version of this mr while 270_700.svg is generated using this version with the anchor_pos = {CrdtId(0, 281474976710654): 270, CrdtId(0, 281474976710655): 700, } (values are from #5)
  • The SVG and PDF images were obtained using gimp and a resolution of 72 pixel/inch. I added a gray background for the SVG to make it easier to see the boundaries on GitHub.

On a side note, I wanted to have a deeper look at the anchor and alignment issues when trying to align the background templates but did not have time yet.

@ricklupton ricklupton merged commit 86daa9e into ricklupton:main Dec 1, 2024
@ricklupton
Copy link
Owner

Thanks @Seb-sti1, this is now merged and I added you to the list of contributors

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.

2 participants