-
Notifications
You must be signed in to change notification settings - Fork 112
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
WIP: Multiple font size / line height spans (updated) #203
Conversation
whats missing in this? :) |
The checkbox list in the description is accurate. The main thing is the editor abstraction isn't quite working properly (compare for example pressing enter a bunch of times in the If you have time to look into this your help would be very welcome. I've done some basic fixing up of compile errors. But haven't had time to look into the bugs. |
Did a quick check, the bug with no cursor on newllne, is because the height of empy lines becomes zero from the LayoutLine::line_height() return the default value of f32 when the line contains no characters... I was planning on changing it into returning an option, so empty lines return a None value, but I am unsure of where to grab the line height value from then... Probably the height of the previous lines last character... but that also mucks up if the previous line has no characters... |
And there is also an error in the [Buffer:set_rich_text] code, its trying to add only newlines to the rich_text example makes that one bug out as well |
…e the height of the line by providing an empty_height value to the layout function, that sets the line height for lines without characters
I dont like the segregation, so an update to this PR is found here |
src/attrs.rs
Outdated
/// # Panics | ||
/// | ||
/// Will panic if font size is zero. | ||
pub fn size(mut self, size: f32) -> Self { |
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.
pub fn size(mut self, size: f32) -> Self { | |
pub fn font_size(mut self, size: f32) -> Self { |
I've tested Seems like there is a bug after rebasing |
I am currently testing this using the ./rich-text.sh in this repo. Could you elaborate on the issue you are seeing and would it be reproducable in this repository? |
@TotalKrill there is actually the issue on your fork. I created reproducible example here: TotalKrill/cosmic-text@multi-size-fix-examples...StaffEngineer:cosmic-text:multi-size-fix-examples If you run rich-text example it prints:
But it should output:
(notice spans are empty) |
Empty lines get a span attached, and those spans are used to determin…
Multi size fix examples
Updated with a fix to that, I believe :), thanks for helping testing! |
Closing in favour of #235 (which is this PR rebased on top of latest |
Implement specifying multiple font sizes and/or line heights.
Current status
Almost done. Working, with some fixes for the editing required.
Todo
enum LineHeight
line_heights()
Metrics
rebasemain
merged into branch. Will need to squash prior to merge.termion
, see Update terminal example using olored` #129)iced
(incompatible API))Future work:
Attrs
:color_opt
,metadata
,font_size
,line_height
Buffer
should have a defaultAttrs
Attrs
in aBuffer
Attrs
more carefullyQuestions:
Hash
impl ofAttrs
include line height?Metrics
be restored as a property ofAttrs
, with definitionMetrics { font_size: f32, line_height: LineHeight }
?