pixijs / pixi-text-style

PIXI.TextStyle Generator
https://pixijs.io/pixi-text-style
32 stars 7 forks source link

add local fonts loader #17

Closed jonlepage closed 4 years ago

jonlepage commented 4 years ago

Allow local fonts loading, cool feature

image

Work fine but plz wait, need add more stuff like base64 to sessionStorage and clear for reset custom fonts cache. Maybe finish this tonight or tomorrow.

this will useful for me and i think some people also request this https://github.com/pixijs/pixi-text-style/issues/14#issue-430894862

jonlepage commented 4 years ago

textstyle extend tool

bigtimebuddy commented 4 years ago

This is awesome!

My only feedback is that: would you mind encapsulating the translation and font stuff into separate components? You're overloading the main TextStyleEditor class.

After this is merged, I'm going to upgrade to React, TypeScript, Bootstrap 4, and a more current toolchain. mithril is no longer serving us well if we are going to start making this tool more complex.

jonlepage commented 4 years ago

sure, am noob with this kind of environment project but i studying how you do from the other pr, i will try my best to refactoring this more clean soon as possible. I also want to refactoring de loader to get multi files instead of single files.

then there will remain a small detail which is piss me off since the beginning, is these colors selector window, my first attempt fail, but I think I understand better the architecture of the project now, i will try again the implementation of http://jscolor.com/ Tell me if is fine or you prefer use another kind of api ?

bigtimebuddy commented 4 years ago

I’m also happy to clean this up, if that’s easier.

As far as the color selector, moving to React will be helpful as there are more components in that ecosystem. Hold off on that for now, I can tackle it in the next iteration.

jonlepage commented 4 years ago

ok thank it almost done. i just found a bug, i will need fix this. image I trying import a big fonts (10mo) localStorage seem have limit. from what i reading, it seem have limitation https://johnresig.com/blog/dom-storage/

i didn't know that so Il will also need create a hashing logic.

jonlepage commented 4 years ago

ho ok forget me https://demo.agektmr.com/storage/ i just try fill the localstorage with this tool and it seem 9Mo for global limit

Am curious if we can up the limit of this from browser ? or i will avoid save big fonts

jonlepage commented 4 years ago

Done, I tried to do the best I could to do as you did for the other pr, but I didn't get there, I was get errors on errors and very difficult to debug without correct environment. So I cheated to make it functional by separate module.

everything works well and tested, but I think you will need make a clean pass, because I can not do better with my programming knowledge. sorry for this, but all work fine from my test despite my weird approach.

bigtimebuddy commented 4 years ago

Great work thanks

jonlepage commented 4 years ago

With regard to the translate tool, I am not a linguistic expert. But the idea was just to provide a fast character convertor that contain special characters for test fonts, so I don't know them all. I just take random language i know from most popular steam language. image But you can maybe refactoring this as you like , add more or less, if you know more popular languages with special characters...

bigtimebuddy commented 4 years ago

Closing this and replacing with #20, will do a follow-up with translation afterwards. Fonts seems more important to get in right away.