Giter Site home page Giter Site logo

Include font metadata about googlefontdirectory HOT 5 CLOSED

w0ng avatar w0ng commented on May 30, 2024
Include font metadata

from googlefontdirectory.

Comments (5)

judgej avatar judgej commented on May 30, 2024

Putting all the metadata files into a single JSON array is the easy bit:

cat ofl/*/METADATA.json | awk 'BEGIN {print "["} {if (p=="}" && $0=="{") {print ",{"; next;}} {p=$0} {print} END {print "]"}'

That produces a single JSON file containing all the metadata records.

from googlefontdirectory.

judgej avatar judgej commented on May 30, 2024

Passsing that combined metadata through a few lines of PHP to extract just the font names and categories, we end up with this, which is not currently available through any Google API:

[excessively long text snipped out - see below]

from googlefontdirectory.

Ivoz avatar Ivoz commented on May 30, 2024

@judgej gists are useful for chucking a document like that json file into without making a long comment.

from googlefontdirectory.

judgej avatar judgej commented on May 30, 2024

Good point. gists are one of the many things on my list of "more stuff I need to know how to use".

Here is the file (not in a gist) in a WP plugin:

https://github.com/academe/google-webfonts-for-woo-framework/blob/master/google-fonts-for-woo-framework/category-groups.json

My aim there will be to allow fonts to be filtered by category within the plugin, so a way to keep up-to-date with the font/category lists would be required for that. I'm sure Google will add it to their APIs one day, but it's no there yet.

For now I'm updating a local copy of the massive hg repo, using awk to combine all the metadata files, then PHP to pull out the font names and categories. Will probably put that all up on a website at some point.

But anyway - I can see many other uses for the meatadata, and it does all squeeze into a single 500kbyte JSON file, and I think it would be very useful here without getting in the way. If you don't want to add it, then I do have my own scripts running, so I'll leave it with you :-)

from googlefontdirectory.

w0ng avatar w0ng commented on May 30, 2024

Retaining original directory structure as the hg repo from now on, so metadata files and licenses are together with their fonts.

from googlefontdirectory.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.