ScratchAddons icon indicating copy to clipboard operation
ScratchAddons copied to clipboard

Ability to Upload Fonts to Editor

Open Scratchfangs opened this issue 3 years ago • 37 comments

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 avatar Apr 02 '21 14:04 Scratchfangs

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

apple502j avatar Apr 02 '21 14:04 apple502j

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

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

Scratchfangs avatar Apr 02 '21 14:04 Scratchfangs

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.

mxmou avatar Apr 02 '21 14:04 mxmou

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

TheColaber avatar Apr 02 '21 14:04 TheColaber

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

mxmou avatar Apr 02 '21 14:04 mxmou

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

TheColaber avatar Apr 02 '21 14:04 TheColaber

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

Hans5958 avatar Apr 02 '21 14:04 Hans5958

@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?

Hans5958 avatar Apr 02 '21 14:04 Hans5958

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)

WorldLanguages avatar Apr 02 '21 15:04 WorldLanguages

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

TheColaber avatar Apr 02 '21 15:04 TheColaber

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

Scratchfangs avatar Apr 02 '21 15:04 Scratchfangs

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.

CubeyTheCube avatar Apr 03 '21 05:04 CubeyTheCube

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

Secret-chest avatar Apr 03 '21 06:04 Secret-chest

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.

Secret-chest avatar Apr 05 '21 06:04 Secret-chest

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

cobaltt7 avatar Apr 05 '21 13:04 cobaltt7

@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

Secret-chest avatar Apr 05 '21 15:04 Secret-chest

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)

SheepTester avatar Apr 06 '21 00:04 SheepTester

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?

CubeyTheCube avatar Apr 06 '21 05:04 CubeyTheCube

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 :eyes:)

SheepTester avatar Apr 06 '21 06:04 SheepTester

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

oh yes

WorldLanguages avatar Apr 06 '21 13:04 WorldLanguages

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 avatar Apr 06 '21 14:04 jeffalo

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

SheepTester avatar Apr 06 '21 17:04 SheepTester

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

xItzDiamondx avatar Apr 12 '21 18:04 xItzDiamondx

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 avatar Apr 13 '21 05:04 Secret-chest

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)

Secret-chest avatar Apr 13 '21 05:04 Secret-chest

Good idea.

xItzDiamondx avatar Apr 14 '21 12:04 xItzDiamondx

Bump?

Scratchfangs avatar Apr 25 '21 21:04 Scratchfangs

Bump?

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

TheColaber avatar Apr 25 '21 22:04 TheColaber

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?

nexensys avatar Apr 30 '21 14:04 nexensys

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

TheColaber avatar Jun 10 '21 21:06 TheColaber