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 inter as Base64 svg #63

Merged
merged 3 commits into from
Jul 8, 2024

Conversation

AryanGodara
Copy link
Contributor

@AryanGodara AryanGodara commented Mar 19, 2024

Resolves #62

To get the base64 encoding, I first downloaded the font, and then used the Inter-regular.ttf, (out of Thin, Bold, Italics, etc.)

Then

$ base64 -i ./file_name > Base64Encoding.txt

Then, run a python script to split it into chunks of size 31

def split_base64_into_chunks(file_path, output_path, chunk_size):
    # read base64encoded data
    with open(file_path, 'r') as file:
        base64_data = file.read()

    # check if base64_data is not empty
    if not base64_data:
        return

    # split  data into chunks of 31
    chunks = [base64_data[i:i+chunk_size] for i in range(0, len(base64_data), chunk_size)]
    print(f"Generated {len(chunks)} chunks.")

    # write chunks to file
    with open(output_path, 'w') as output_file:
        for chunk in chunks:
            output_file.write(f"data.append('{chunk}');\n")
    print("Success!")

Then, pasted the append(<byte64_chunk>) statements inside inter.cairo

@AryanGodara
Copy link
Contributor Author

@tekkac Can you please review if this implementation is correct :D

@tekkac
Copy link
Member

tekkac commented Mar 21, 2024

You need to add lines in lib.cairo to incorporate your changes.
If you have time to work on a quick test with a SVG showing it actually works that would be nice too.

@tekkac
Copy link
Member

tekkac commented Mar 27, 2024

Could you update the code so that it passes formatting?

@tekkac tekkac self-requested a review March 27, 2024 17:20
@AryanGodara
Copy link
Contributor Author

Could you update the code so that it passes formatting?

Yes, sorry. I'll do this asap!

Copy link
Member

@tekkac tekkac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closes #62

@tekkac tekkac merged commit aef9fd1 into Carbonable:main Jul 8, 2024
1 check passed
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

Successfully merging this pull request may close these issues.

Add font Inter as base64 SVG
2 participants