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

Ability to Upload Fonts to Editor #2050

Closed
Scratchfangs opened this issue Apr 2, 2021 · 40 comments
Closed

Ability to Upload Fonts to Editor #2050

Scratchfangs opened this issue Apr 2, 2021 · 40 comments
Labels
new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons status: wontfix This won't be worked on type: enhancement New feature for the project

Comments

@Scratchfangs
Copy link

I think you should be able to add more fonts. There could be a button under all the fonts that says "upload new font". And once you upload the font, it would be saved to your storage for use in different projects. Why can't you just use Google Drawings or something? When you try editing that in Scratch, it would go back to default Sans Serif.

image

@Scratchfangs Scratchfangs added new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons type: enhancement New feature for the project labels Apr 2, 2021
@apple502j
Copy link
Member

We don't have storage to store uploaded fonts, rejected.

@Scratchfangs
Copy link
Author

We don't have storage to store uploaded fonts, rejected.

I said that it could be saved to the computer storage.

@mxmou
Copy link
Member

mxmou commented Apr 2, 2021

We don't have storage to store uploaded fonts, rejected.

I said that it could be saved to the computer storage.

Other users would not see it.

@TheColaber
Copy link
Member

You can store a link to the font in the svg? I think I've done this with Sora before...

@mxmou
Copy link
Member

mxmou commented Apr 2, 2021

@TheColaber This is only possible with fonts that are available online, not with uploaded fonts.

@Hans5958 Hans5958 reopened this Apr 2, 2021
@TheColaber
Copy link
Member

True, so why not do that? Why not use some API or something, so the user can input "Sora" and returns a URL to it's styles

@Hans5958
Copy link
Member

Hans5958 commented Apr 2, 2021

Reopening. Classic Apple closing stuff for reading only a portion of the text. Alternatives may exist in various form.

@Hans5958
Copy link
Member

Hans5958 commented Apr 2, 2021

@TheColaber This is only possible with fonts that are available online, not with uploaded fonts.

Well, he said to store "the link," not "the file".

I don't know, is it possible to embed fonts to .svgs?

@WorldLanguages
Copy link
Member

We could provide more fonts by converting SVG text into path (but somehow storing metadata that will still allow the user to edit the path as if it was text)

@TheColaber
Copy link
Member

We could provide more fonts by converting SVG text into path (but somehow storing metadata that will still allow the user to edit the path as if it was text)

In that case, there might as well be a scratch tool website to do this. Enter text, choose point, download svg. Then import to scratch

@Scratchfangs
Copy link
Author

Downloading is a little too much, I have more than 100 files just from doing that from Google Drawings

@CubeyTheCube
Copy link

We don't have storage to store uploaded fonts, rejected.

I said that it could be saved to the computer storage.

Other users would not see it.

I think this person wants it to be stored locally for personal use. Maybe the backpack can be abused so it can saved through the account.

@Secret-chest
Copy link
Contributor

Solution: use Google Fonts. A list of google fonts, like the google docs one.

@Secret-chest
Copy link
Contributor

For the Google Fonts suggestion, my idea is:
When you click the font dropdown, you see a button labeled More Fonts (above or under the normal ones). When you click that button, you see a search box, a Pinned Fonts list, and, below that, the list of all the Google fonts.

@cobaltt7
Copy link
Contributor

cobaltt7 commented Apr 5, 2021 via email

@Secret-chest
Copy link
Contributor

@Secret-chest there are waaaaaay too many google fonts for that to work.

@RedGuy12 It will only link to the font when you actually choose it

@SheepTester
Copy link
Contributor

Re Google Docs, I believe their TTF files are in google/fonts. They don't need to be included as part of the extension files; instead, perhaps they could be fetched when used, ideally from fonts.googleapis.com

To convert to SVG, one could use opentype.js; it only supports OTF and TTF formats, so a different library is needed to decompress WOFF/WOFF2 files.

AFAIK, Scratch already allows any arbitrary font family value in SVGs, and presumably if the font isn't supported, it reverts to a fallback
image
We could just load a font selected by a user (either by uploading or from Google Fonts) but remind the user to convert their text to a path or it won't show the same for other people. (This matches the behaviour of some vector editors like Adobe Illustrator, I think)

@CubeyTheCube
Copy link

Re Google Docs, I believe their TTF files are in google/fonts. They don't need to be included as part of the extension files; instead, perhaps they could be fetched when used, ideally from fonts.googleapis.com

To convert to SVG, one could use opentype.js; it only supports OTF and TTF formats, so a different library is needed to decompress WOFF/WOFF2 files.

AFAIK, Scratch already allows any arbitrary font family value in SVGs, and presumably if the font isn't supported, it reverts to a fallback
image
We could just load a font selected by a user (either by uploading or from Google Fonts) but remind the user to convert their text to a path or it won't show the same for other people. (This matches the behaviour of some vector editors like Adobe Illustrator, I think)

Will the option to import fonts also be included?

@SheepTester
Copy link
Contributor

I'm only suggesting how this could be implemented, but I have no plans on actually implementing this

It should be possible to import fonts of a select few file formats; it would have the same issue as with Google Fonts where it won't work for others if they don't have Scratch Addons (until converted to an SVG path, which would be hard to edit as text unless, as W_L suggested, we kept track of the text paths in some metadata). Another concern might be that we won't have access to the font file on reload; it could be saved in the browser, which would be a bit redundant, or we could just have users reupload the font when they return to editing, displaying the fallback in the meantime

(though I suppose another option would be to upload fonts to Scratch's asset servers 👀)

@WorldLanguages
Copy link
Member

(though I suppose another option would be to upload fonts to Scratch's asset servers 👀)

oh yes

@jeffalo
Copy link
Contributor

jeffalo commented Apr 6, 2021

don't svgs have the ability to import fonts and stuff from a url? we could upload some nice fonts to assets.scratch.mit.edu and then automatically import them for the user

@SheepTester
Copy link
Contributor

don't svgs have the ability to import fonts and stuff from a url? we could upload some nice fonts to assets.scratch.mit.edu and then automatically import them for the user

IIRC if rendered as an embedded image as opposed to opened standalone in a new tab, SVGs won't fetch external resources. The assets server might also not return the correct MIME type for the font files, which might anger the browser

It's not out of the ordinary to have to manually and explicitly irreversibly convert text to a path IMO

@xItzDiamondx
Copy link

It would be better if we included some fonts, and then possibly as we update, add more fonts?

@Secret-chest
Copy link
Contributor

don't svgs have the ability to import fonts and stuff from a url? we could upload some nice fonts to assets.scratch.mit.edu and then automatically import them for the user

@jeffalo you will only add Sora

@Secret-chest
Copy link
Contributor

Okay, we cloud use only the most popular Google fonts:

  • Roboto
  • Lato
  • Montserrat
  • Source Sans Pro
  • Noto Sans is already included
  • Roboto Mono (we need a monospaced font)

@xItzDiamondx
Copy link

Good idea.

@Scratchfangs
Copy link
Author

Bump?

@TheColaber
Copy link
Member

Bump?

This is not the scratch forums. Bumping doesn't actually do anything. Someone will attempt to make this an addon, or you can.

@nexensys
Copy link
Contributor

We could provide more fonts by converting SVG text into path (but somehow storing metadata that will still allow the user to edit the path as if it was text)

In that case, there might as well be a scratch tool website to do this. Enter text, choose point, download svg. Then import to scratch

I use this to get the path I need, then copy and paste it into an empty .txt file and change the extension . . . maybe base the code off of this and allow a drag n' drop for a ttf file instead of saving the link? This is beyond my skillset, but I was thinking maybe make a little popup or use prompt to get the text, then insert it into the svg?

@TheColaber
Copy link
Member

It's been suggested to add back the "Scratch" font, which is apparently already loaded into scratch but just isn't an option.

@mxmou
Copy link
Member

mxmou commented Jun 11, 2021

@TheColaber See scratchfoundation/scratch-render-fonts#23

@williamhorning
Copy link
Contributor

isn't this a dupe of #1646

@mxmou
Copy link
Member

mxmou commented Jun 22, 2021

@wgyt #1646 is for changing the font in which the website is displayed, not adding more fonts to the paint editor.

@williamhorning
Copy link
Contributor

@wgyt #1646 is for changing the font in which the website is displayed, not adding more fonts to the paint editor.

my bad

@CST1229
Copy link
Member

CST1229 commented Jan 19, 2022

I think I already posted this before somewhere but "Helvetica Neue", "Helvetica", Arial, sans-serif (Scratch website font) and "Serif" (WITH quotation marks; fixed serif font) would be a good place to start.

@apple502j apple502j mentioned this issue Mar 7, 2022
@rimopa
Copy link

rimopa commented Jul 24, 2022

Is there no way to detect and use system fonts?

@mxmou
Copy link
Member

mxmou commented Jul 24, 2022

Is there no way to detect and use system fonts?

People that don't have the same fonts installed won't see them.

@apple502j
Copy link
Member

Rejected. No more reconsideration.

@apple502j apple502j closed this as not planned Won't fix, can't repro, duplicate, stale Sep 27, 2022
@Secret-chest
Copy link
Contributor

Rejected. No more reconsideration.

wait why? no explanation? what about google fonts? @apple502j

@mxmou
Copy link
Member

mxmou commented Sep 27, 2022

@Secret-chest Embedding fonts in a SVG or hoping that the user has them on their device is not practical. Using external resources in a Scratch SVG is not possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new addon Related to new addons to this extension. `scope: addons` should still be added. scope: addon Related to one or multiple addons status: wontfix This won't be worked on type: enhancement New feature for the project
Projects
None yet
Development

No branches or pull requests