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

Add bold and underline functionality #46

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

mgazza
Copy link
Contributor

@mgazza mgazza commented Oct 18, 2023

Punt/ Preview PR
Change the font to one that has a bold derivative - (I probably should use fyne bundle instead of go embed).
Add the handling code for supporting underlining and bold.
Make that info available for downstream consumption for fyne.

depends on :
#45
fyne-io/fyne#4244

@andydotxyz andydotxyz marked this pull request as draft October 18, 2023 16:41
@andydotxyz andydotxyz changed the title Draft: Add bold and underline functionality Add bold and underline functionality Oct 18, 2023
@andydotxyz
Copy link
Member

(converted to draft on GitHub rather than in the text)

@mgazza mgazza force-pushed the add-bold-underline branch 2 times, most recently from fa0ae3b to be74aa6 Compare October 24, 2023 09:21
@andydotxyz
Copy link
Member

Trying to come back to a backlog of PRs and I see this one - it seems to have blinking work in it as well, maybe the wrong base branch?
Also as there is discussion about underline and strikethrough in TextStyle I wonder if that changes the API design here?

@mgazza
Copy link
Contributor Author

mgazza commented Nov 13, 2023

Hey, sorry I've been really busy with other things recently. Certainly there's mention of blinking in this PR. That is because it depends on #45

@mgazza
Copy link
Contributor Author

mgazza commented Jun 14, 2024

image

depends on
fyne-io/fyne#4244
#85 ( cherry-picked into this )

@andydotxyz
Copy link
Member

I had a glance through this, I'm not sure about the weight of the renderer on this - it seems like a lot of TextGrid is copied in, but I'm not sure why.

@mgazza
Copy link
Contributor Author

mgazza commented Jun 17, 2024

I can't encapsulate it because the renderer isn't exported. This a huge issue IMO. I don't know the best way to resolve it.

@mgazza
Copy link
Contributor Author

mgazza commented Jun 17, 2024

We could move the blinking down to the text grid render but I'm not sure what value that would give

@andydotxyz
Copy link
Member

I can't encapsulate it because the renderer isn't exported. This a huge issue IMO. I don't know the best way to resolve it.

But why do you need to tweak the renderer implementation? Can't it be delegated to?

@mgazza
Copy link
Contributor Author

mgazza commented Jun 17, 2024 via email

@andydotxyz
Copy link
Member

For blink I need to swap the fg and bg colours and I can either do that in the renderer or via the style.

Oh I see, this pattern was adopted earlier - I kinda missed how much was duplicated sorry.
Something between the two was in my head. The first was new public APIs which were not needed, and putting it all in the renderer is fine but we've got much more code to manage now.

What I had thought was happening before was that the style information was being used as the source, internally it was toggling when blinking and so the renderer had the updated model to get the visuals right. The TextGridStyle is an interface after all so it can return different colour values as it blinks. By delegating I meant that we encapsulate a TextGrid (along with its renderer) and provide a layer on top that manages complex things like toggling blink or handling hyperlink taps etc... the core rendering is still in the UI library...

But that leaves us with this PR. Is it right to pull in all the new code from Fyne TextGrid here to get the copy of the code working as it is upstream? I guess we kindof have to with what is in place now? Unless a simplification refactor could be done first?

@mgazza
Copy link
Contributor Author

mgazza commented Jun 19, 2024 via email

@andydotxyz
Copy link
Member

No, renderers cannot be made public. However is the BgColor and FgColor being methods not exactly the thing you need to be able to influence the colours on any particular render pass?

@mgazza
Copy link
Contributor Author

mgazza commented Jun 19, 2024 via email

@andydotxyz
Copy link
Member

In my mind that is where our "wrapping" widget comes in - we know the original state and we track a blink flag, toggling the state that is passed into the embedded TextGrid

@andydotxyz
Copy link
Member

Anything more I can do to help with the tidy-up here?

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