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

Newline character ("\n") takes a lot of space. #27

Closed
ArjanAswal opened this issue Feb 16, 2021 · 25 comments
Closed

Newline character ("\n") takes a lot of space. #27

ArjanAswal opened this issue Feb 16, 2021 · 25 comments

Comments

@ArjanAswal
Copy link
Collaborator

ArjanAswal commented Feb 16, 2021

The newline character takes a lot of space and fills the entire screen pretty quickly.
In my opinion it should take as much space as the normal line in a paragraph does.
Right now it is taking twice as much.

@singerdmx
Copy link
Owner

The code should be in default_styles, I suppose

@singerdmx
Copy link
Owner

Yeah, I agree. Are u able to find the fix?

@ArjanAswal
Copy link
Collaborator Author

DefaultTextBlockStyle( this.style, this.verticalSpacing, this.lineSpacing, this.decoration);

@singerdmx Is it this parameter?

@singerdmx
Copy link
Owner

Possible. Just try changing it

@singerdmx
Copy link
Owner

Possibly the verticalSpacing

@ArjanAswal
Copy link
Collaborator Author

@singerdmx In the source code the 3rd parameter (which is lineSpacing) is set to Tuple2(0.0, 0.0). Then how come the newlines are so greatly spaced?

        paragraph: DefaultTextBlockStyle(
            baseStyle, baseSpacing, Tuple2(0.0, 0.0), null),

@singerdmx
Copy link
Owner

Let me double check one thing: is it between text block?

@singerdmx
Copy link
Owner

image

The code may be here

@ArjanAswal
Copy link
Collaborator Author

I have solved the issue by changing

Tuple2<double, double> baseSpacing = Tuple2(6.0, 10);

to:

Tuple2<double, double> baseSpacing = Tuple2(0, 0);

@singerdmx
Copy link
Owner

If the rendering is satisfactory (if it does not break other components), just submit it

@ArjanAswal
Copy link
Collaborator Author

Rendering is satisfactory.

I just changed all the baseSpacing styles in my personal projects (heading 1,2,3 ... paragraph, list, bold, italic, etc) to Tuple2(0, 0).
I suggest we do the same in the source code as we don't want to assign any extra line spacing ourselves and leave that to the developer or user.

Should I proceed with this?

@singerdmx
Copy link
Owner

Yes, go ahead

@singerdmx
Copy link
Owner

Can you submit it to stable branch?

@ArjanAswal
Copy link
Collaborator Author

@singerdmx I only changed the baseSpacing of the paragraph attribute as other implementations were looking quite cramped.

@singerdmx
Copy link
Owner

Actually I think Tuple2<double, double> baseSpacing = Tuple2(6.0, 0) is better when it comes to checkbox

@singerdmx
Copy link
Owner

Tuple2(6.0, 0) macthes checkbox's style, which I think is better

@ArjanAswal
Copy link
Collaborator Author

ArjanAswal commented Feb 16, 2021

Actually I think Tuple2<double, double> baseSpacing = Tuple2(6.0, 0) is better when it comes to checkbox

You are right baseSpacing is actually pretty much necessary for checkboxes and lists. I was testing it out recently.
That is why in the commit I only changed the baseSpacing of the paragraph.
The spacing of other attributes remains the same.

@singerdmx
Copy link
Owner

Oh I see

@singerdmx
Copy link
Owner

I submitted a5ce035
Let me know if there is any issue

@ArjanAswal
Copy link
Collaborator Author

I submitted a5ce035
Let me know if there is any issue

@singerdmx What attributes will be affected by this and to what degree?

@singerdmx
Copy link
Owner

I think it affects the spacing between text blocks

@ArjanAswal
Copy link
Collaborator Author

I actually tried manipulating this variable which you just changed in the commit.

The paragraph was looking normal and the newline character wasn't taking extra space. However, the checkboxes and the list became cramped. Hence, I only changed the paragraph spacing.

So you might wanna check that.

@singerdmx
Copy link
Owner

Cramped? hmm... it looks fine to me

@ArjanAswal
Copy link
Collaborator Author

Cramped? hmm... it looks fine to me

Maybe I was just used to the previous styling in which everything was sort of spaced out.

Also, any chance we can replace tuple with normal line height parameter? Would make things a lot simpler in my opinion.

@singerdmx
Copy link
Owner

Yes, I agree. We should replace Tuple

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

No branches or pull requests

2 participants