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

Implement font picker in desktop application #2605

Closed
laurent22 opened this issue Feb 28, 2020 · 32 comments
Closed

Implement font picker in desktop application #2605

laurent22 opened this issue Feb 28, 2020 · 32 comments
Labels
desktop All desktop platforms enhancement Feature requests and code enhancements stale An issue that hasn't been active for a while...

Comments

@laurent22
Copy link
Owner

It is already possible to set the font used in the editor from the config screen:

image

However, the user has to manually type the name of the font, which is not convenient.

We would like to add a font picker to make this process easier. It would work like so:

  • The existing text input field remains unchanged
  • Next to it, add a button "Pick font" which will open the font picker
  • The font picker will only display monospace fonts
  • Once a font is picked, the font name populates the text input field
  • It needs to work on Windows, macOS and Linux. If one or more of the OS cannot be supported, the button should be hidden.
@laurent22 laurent22 added enhancement Feature requests and code enhancements good first issue desktop All desktop platforms labels Feb 28, 2020
@daukadolt
Copy link
Contributor

Can I take the issue?

@Rishabh-malhotraa
Copy link
Contributor

Looks good I'd like to work on it!

@Rishabh-malhotraa
Copy link
Contributor

It is already possible to set the font used in the editor from the config screen:

image

However, the user has to manually type the name of the font, which is not convenient.

We would like to add a font picker to make this process easier. It would work like so:

  • The existing text input field remains unchanged
  • Next to it, add a button "Pick font" which will open the font picker
  • The font picker will only display monospace fonts
  • Once a font is picked, the font name populates the text input field
  • It needs to work on Windows, macOS and Linux. If one or more of the OS cannot be supported, the button should be hidden.

Suggestion rather than incorporating a button incorporate a drop-down button which has all the monospace fonts.


slider

What do you think about it?

@laurent22
Copy link
Owner Author

Dropdown lists with type-in introduce all kind of problems so I prefer a separate button for now.

@akshatsachan
Copy link

@laurent22 @PackElend , I would like to work on this issue.
Can you please assign it to me.

@rabeehrz
Copy link
Contributor

@akshatsachan Hey I think @Rishgod is working on this.

@akshatsachan
Copy link

Ok , thats fine I will look into some other issue.

@daukadolt
Copy link
Contributor

@Rishgod can you comment on your status? Because I'm halfway there, and I thought that you were working on this issue

@Rishabh-malhotraa
Copy link
Contributor

@Rishgod can you comment on your status? Because I'm halfway there, and I thought that you were working on this issue

@daukadolt you can go ahead with completing this, I'm just done 20% :)

@daukadolt
Copy link
Contributor

@Rishgod can you comment on your status? Because I'm halfway there, and I thought that you were working on this issue

@daukadolt you can go ahead with completing this, I'm just done 20% :)

thanks @Rishgod :)

@bedwardly-down
Copy link
Contributor

bedwardly-down commented Mar 2, 2020

I wonder if adding a font directory to where Joplin stores its config files and then reading the fonts from there would be a compromise that would work better long term? That's a pretty standard way of handling it for many other apps. Then Joplin would just read the fonts in that directory and give those as an option.

@Rishabh-malhotraa
Copy link
Contributor

@Rishgod can you comment on your status? Because I'm halfway there, and I thought that you were working on this issue

@daukadolt you can go ahead with completing this, I'm just done 20% :)

thanks @Rishgod :)

Hey, @daukadolt just let me know if you need any help or if you want to abandon the PR okay? :)

@daukadolt
Copy link
Contributor

@Rishgod can you comment on your status? Because I'm halfway there, and I thought that you were working on this issue

@daukadolt you can go ahead with completing this, I'm just done 20% :)

thanks @Rishgod :)

Hey, @daukadolt just let me know if you need any help or if you want to abandon the PR okay? :)

Last few days were very busy, but I'm finally more or less free. If you have any ideas or suggestions, I could possibly use some

@Chhekur
Copy link

Chhekur commented Mar 7, 2020

Is anybody currently working on this ?
if not then could I work on this one ?

@Rishgod @daukadolt

@Rishabh-malhotraa
Copy link
Contributor

you should ask @daukadolt I'm not working on it.

@daukadolt
Copy link
Contributor

@Chhekur I'm working on the issue, it's just that I'm kinda slow 😅

@rabeehrz
Copy link
Contributor

rabeehrz commented Apr 3, 2020

@daukadolt Are you still working on this? Can I take up this issue?

@rabeehrz
Copy link
Contributor

rabeehrz commented Apr 3, 2020

I was thinking of using this package, font-manager.

It supports all the platforms.

@bedwardly-down
Copy link
Contributor

@rabeehrz, if you decide to use that, you’ll need to understand how to fix it if it breaks. It doesn’t have much active development on it with most of the latest commits being quite old. But super cool find, nonetheless

@rabeehrz
Copy link
Contributor

rabeehrz commented Apr 3, 2020

Well, that is the only way I found to get system fonts for Electron. Other way is adding a fonts directory to Joplin, like you suggested.

I wonder if adding a font directory to where Joplin stores its config files and then reading the fonts from there would be a compromise that would work better long term? That's a pretty standard way of handling it for many other apps. Then Joplin would just read the fonts in that directory and give those as an option.

@bedwardly-down
Copy link
Contributor

bedwardly-down commented Apr 3, 2020

Are React Native libraries only usable for mobile apps or could they be leveraged for Desktop also? I found a highly active one that could possibly be used to allow picking fonts on mobile but might be usable here, too.

It has web support too, so should be usable with Electron.

https://github.com/expo/expo

@roman-r-m
Copy link
Collaborator

Are React Native libraries only usable for mobile apps or could they be leveraged for Desktop also?

There's this: https://github.com/microsoft/react-native-windows but seems it's only Windows 10 and it's not yet stable

@bedwardly-down
Copy link
Contributor

Joplin is cross platform so it has to be a library that supports Windows, mac and Linux.

@roman-r-m
Copy link
Collaborator

roman-r-m commented Apr 3, 2020

Quick googling returned this: https://github.com/status-im/react-native-desktop
It seems actively developed.

@rabeehrz
Copy link
Contributor

rabeehrz commented Apr 4, 2020

Quick googling returned this: https://github.com/status-im/react-native-desktop
It seems actively developed.

But doesn't this mean that we'd have to convert Electron to React Native Desktop?

@roman-r-m
Copy link
Collaborator

I guess I misunderstood the original question.

@daukadolt
Copy link
Contributor

daukadolt commented Apr 13, 2020

I've had this picture in my mind, please correct me if I'm wrong.
Screen Shot 2020-04-13 at 21 06 17

  1. Selection button in the "Appearence" tab of the Configuration page.

Screen Shot 2020-04-13 at 21 06 24

2.1. Child BrowserWindow which opens a new React Component that utilizes library like the one @rabeehrz has mentioned.

Screen Shot 2020-04-13 at 21 07 02

2.2. Alternative, modal child BrowserWindow.

Looking forward for a feedback on the vision in screenshots.

The problem I've had was with opening a React component inside this very child BrowserWindow. I a little new to React, so I've been having issues with opening it inside Electron. The examples on screenshots use plain html page.
The exact procedure of how these components are mounted and navigated inside Electron app is what, unfortunately, I've failed to understand.

I looked through the gulp scripts but still am a little confused

@rabeehrz
Copy link
Contributor

rabeehrz commented Apr 14, 2020

I was thinking of implementing a dialog with a simple drop-down, like the note properties.

But Laurent had said we need to have a proper dialog framework in place before he accepts any more PR related to it. Also, there are a lot of bugs to fix and he's not going to accept any more new features as of now. That's why I've waited on this. I do plan to work on this.

@daukadolt
Copy link
Contributor

I was thinking of implementing a dialog with a simple drop-down, like the note properties.

But Laurent had said we need to have a proper dialog framework in place before he accepts any more PR related to it. Also, there are a lot of bugs to fix and he's not going to accept any more new features as of now. That's why I've waited on this. I do plan to work on this.

could you help me out with my problems above? If you want, I won't proceed any further with the feature request, but I'd like to learn how to integrate my custom React components.

@rabeehrz
Copy link
Contributor

I'd like to learn how to integrate my custom React components.

If you take a look at the folder gui inside ElectronClient, You can see a lot of .jsx files. Most of them (if not all) are custom components. Let us take ToolbarButton.jsx for example. It takes in some parameters and ultimately generates an anchor tag <a>. Then we just export it and use else where. This is somewhat basic.

I think it would really help if you create a Topic in the forums so that everyone can give their input.

@stale
Copy link

stale bot commented Apr 18, 2021

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may comment on the issue and I will leave it open. Thank you for your contributions.

@stale stale bot added the stale An issue that hasn't been active for a while... label Apr 18, 2021
@stale
Copy link

stale bot commented Jun 3, 2021

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop All desktop platforms enhancement Feature requests and code enhancements stale An issue that hasn't been active for a while...
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants