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

Test SSTORE reconstruction. #6

Open
VivaRado opened this issue Oct 12, 2022 · 6 comments
Open

Test SSTORE reconstruction. #6

VivaRado opened this issue Oct 12, 2022 · 6 comments

Comments

@VivaRado
Copy link
Owner

VivaRado commented Oct 12, 2022

@eliheuer @davelab6

The size of a font on SSTORE:

This is from FontRegistry codebase:

    // our font is 115KB
    // contract storage is < 24KB
    // we need to chunk our font into 5 partitions to store it fully

From the email, identified chunks:

  • SYFF instructions: 1 - 5 KB max
  • Initial Coordinates: 10 KB
  • Kerning: 20 KB (still needs compression but I got a few ideas like classes ontop of classes)

We get all that build the font on the client with Javascript like with fontkit and varLib models that exists in JS already with client-side code.

Or we provide an API service that builds the font with Python or whatnot, but this defeats the purpose cause KBs on the net, while it could be done on the client with no bandwidth. Hints at SYFF but in JS.

Cost $13.82/KB? Advise on GAS please.
The font would be about 35KB reconstructed a lot bigger but client side. 483.7$ per font. But keep in mind the alterations also cost in case we have to change the content.

@VivaRado VivaRado changed the title Test IPFS reconstruction. Test SSTORE reconstruction. Oct 13, 2022
@VivaRado
Copy link
Owner Author

VivaRado commented Oct 13, 2022

image

@ctrlcctrlv
Copy link

This is much smarter than the last proposal I saw. (0xBeans/FontRegistry#3)

Probably what you want to do is use Python via wasm:
https://testdriven.io/blog/python-webassembly/

This would benefit free fonts community as a whole as a working fontmake that runs in wasm is broadly useful.

Another thought is that what you are doing here is essentially just recreating METAFONT. You could instead use METAPOST (via, perhaps, wasm once again, this time made through e.g. emscripten).

@VivaRado
Copy link
Owner Author

VivaRado commented Oct 15, 2022

Rendering VS Assembling, Combining or Sýnthesi

As for metafont, I do notice what you mean, specifically that it includes drawing equations, like maybe:

A ["A_lpha"]{
   /* Setup Coordinates */
   coordinates : [1,2],[2,4] ...etc [1,3,4] ... JK just 2D for now )))
   /* Style */
   stroke-style  : 2em;
   cap-start : "some_partial";
   cap-end : "some_partial";
}

We do have considered the idea of adding initial shapes not from existing files but from lists of coordinates existing in the instructions themselves, and be able to manipulate some individual coordinates for minor fixes, but we have no capacity yet to do things like draw a variable stroke single line letter ( Metafont 😲), someday? maybe?

At the moment I try to keep it at "plumbing" level, just connecting the letter partials, modular stuff, and letting the user figure out the connections system. This allows me to also invest my time in a way that the team will not be overwhelmed.

Basically we try to remove duplication wherever we see it, without creating a very demanding rendering system, more of a recombining system.

Node Editor

I would also consider the idea of a node editor to help visualize the results and also make drag and drop adjustments.

PyGUI
Node Editor from PyGui

enSYFFying Existing Fonts

Then maybe, from our existing codebase, we could use the Similarity Extractor that checks for letters that are similar, funny enough it's the same used for kerning compression, and one could throw in an existing font, and the SMEX could suggest what letters could be removed as they are dups and add the SYFF code for their generation from other letters or partials.

Current Needs and Plan

I am trying to work on this while working on AEOLUM font, here is the plan and the needs of the font and how I am thinking of using SYFF to generate the letters.

On or Off

Truthfully whether this will be used #onchain or off, it is still a good method as it is a size reduction and also a design system, that could be beneficial as CSS is for the web.

@ctrlcctrlv thank you for your evaluation, and MFEK, and others who are interested, we will try to put some traction into this one, your help is appreciated. Have an awesome weekend!

#metafont #metapost #wasm #emscripten

@ctrlcctrlv
Copy link

METAFONT is a programming language. So you could very well write exactly what you've done here in it. Some METAFONT fonts are even written this way.

@ctrlcctrlv
Copy link

ctrlcctrlv commented Oct 16, 2022

Here's an example from file /usr/share/texlive/texmf-dist/fonts/source/public/cm/sym.mf on my system:

iff known o_plus: cmchar "Circle-plus operator";
beginarithchar(o_plus); pickup light_rule.nib; autorounded;
lft x6=hround u; x2=w-x6; y2=math_axis; top y8=h;
circle_points; draw_circle;  % circle
draw z2--z6; draw z4--z8;  % bar and stem
labels(1,2,3,4,5,6,7,8); endchar;

If I run...

mpost '&mfplain' "\\mode:=localfont; mag := 20.0; outputtemplate := \"%j-%c.svg\"; outputformat := \"svg\"; input /usr/share/texlive/texmf-dist/fonts/source/public/cm/cmsy10.mf;"

cmsy10-8.svg

cmsy10-8

@VivaRado
Copy link
Owner Author

VivaRado commented Nov 24, 2022

SYFF_Node_Editor_005.mp4

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

No branches or pull requests

2 participants