cosmic-text icon indicating copy to clipboard operation
cosmic-text copied to clipboard

Spans of font sizes

Open rhelmot opened this issue 2 years ago • 8 comments

This is a highly requested feature from a rich text editor - being able to change font size within a line.

I looked into doing this myself but couldn't figure out a good way to get the attrs into layout without adding a font size field to the shaping structs, which seemed to be against the spirit of the design. If there's any advice on what changes would need to be made where to make this happen, I'll gladly do it.

rhelmot avatar Jan 25 '23 18:01 rhelmot

Color was also done in that sort of strange way. Perhaps both color and font size could be a struct specifically for overriding things later on in the process?

jackpot51 avatar Jan 25 '23 18:01 jackpot51

How much later though? Because wouldn't font size affect shaping? (it my not, I'm just wondering)

geom3trik avatar Jan 25 '23 22:01 geom3trik

font size affects layout, not shaping. Though I'd probably break up runs of different font sizes into different shaping runs to make sure they don't have ligatures connecting them.

jackpot51 avatar Jan 30 '23 14:01 jackpot51

I just wanted to leave a plus one on this please. I would make heavy use of this

J-Cake avatar Feb 24 '23 22:02 J-Cake

Yeah, I am implementing markdown support for my app using cosmic-text, and for implementing markdown headings this feature would be really handy, so plus one to it.

Dimchikkk avatar Jun 09 '23 08:06 Dimchikkk

Hello, @conradludgate! I noticed that you referenced this specific issue and made some changes to the code. I'm curious to know the current status of those changes. Do you have any plans to submit a PR soon to address the issue? I'm quite interested in having this feature implemented and would appreciate any updates or information you can provide. Thank you!

Dimchikkk avatar Jun 21 '23 09:06 Dimchikkk

Hello, @conradludgate! I noticed that you referenced this specific issue and made some changes to the code. I'm curious to know the current status of those changes. Do you have any plans to submit a PR soon to address the issue? I'm quite interested in having this feature implemented and would appreciate any updates or information you can provide. Thank you!

I believe it worked well enough for my needs. I don't have time right now to continue working on it, but I'm happy for someone to take my commit and open a PR from it

conradludgate avatar Jun 21 '23 09:06 conradludgate

@conradludgate I gave the changes a try, but they're not quite what I had in mind. What I really need is a feature to make spans bigger by adjusting the font size, so I can effectively implement markdown headings.

Dimchikkk avatar Jun 21 '23 10:06 Dimchikkk