{"id":27168367,"url":"https://github.com/inconvergent/gridfont","last_synced_at":"2026-03-07T03:03:40.929Z","repository":{"id":83601799,"uuid":"208850292","full_name":"inconvergent/gridfont","owner":"inconvergent","description":"grid-based system for designing simple symbols and fonts. including an example font. mainly intended for plotter drawings.","archived":false,"fork":false,"pushed_at":"2024-12-29T17:43:38.000Z","size":211,"stargazers_count":107,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-19T13:09:00.076Z","etag":null,"topics":["font","grid","plotter","svg","symbols"],"latest_commit_sha":null,"homepage":"https://inconvergent.net","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/inconvergent.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-16T16:46:17.000Z","updated_at":"2025-03-22T22:39:58.000Z","dependencies_parsed_at":"2023-07-07T22:31:11.389Z","dependency_job_id":null,"html_url":"https://github.com/inconvergent/gridfont","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/inconvergent/gridfont","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fgridfont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fgridfont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fgridfont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fgridfont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/inconvergent","download_url":"https://codeload.github.com/inconvergent/gridfont/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/inconvergent%2Fgridfont/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30206339,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-06T19:07:06.838Z","status":"online","status_checked_at":"2026-03-07T02:00:06.765Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["font","grid","plotter","svg","symbols"],"created_at":"2025-04-09T05:30:47.782Z","updated_at":"2026-03-07T03:03:40.921Z","avatar_url":"https://github.com/inconvergent.png","language":"Python","readme":"# Gridfont - Grid-based Font System\n\n\n![original](img/original.png)\n`original`\n\n![smooth](img/smooth.png)\n`smooth`\n\n\ngrid-based system for designing simple symbols and fonts. including an example\nfont. Mainly intended for plotter drawings.\n\nThe symbol descriptions look like this:\n\n    S4,9:DS6|S3DtRqS2eLp\n\nYou can use spaces to separate moves, so you can for instance write it like this:\n\n    S4,9: DS6| S3 DtRq S2 eLp\n\nThe first section (left of `:`) is the `info` section. Which currently contains\nthe size of the grid (as `integers`). Here the width is `4` and the height is\n`9`. That is, there are `4` and `9` grid points in the two directions. That\nmeans the width of the symbol will be `3` and `8`.\n\nIn time this section might contain other things. Such as a translate command.\n(this might be useful if you are only drawing within a certain section of the\ngrid.)\n\nThe next section is one or more paths, separated by the pipe symbol `|`.\nSpecifically, the above example should result in the two paths of the letter\n`b`:\n\n    |   \u003c-- p1\n    |\n    |/-\\   \u003c-- p2\n    |   |\n    |   |\n    |\\-/\n\nHere are a few examples of more complex symbol definitions:\n\n    asterisk: S3,9:M1,3DS|S3.75Dq1,0.25t1,0.25|M0.25,5Dt0.75,1q0.75,1\n    w:        S5,9:S2D q1,4 t1,4 q1,4 t1,4\n    y:        S4,9:S2Dq1.5,4|M3,2De1.5,4e0.5,1e\n\n\n## Paths\n\nWhen drawing a new path the cursor is always reset to the `origin`, which is in\nthe upper left corner. The coordinate system is rotated like this:\n\n        -\n        |\n    - --o-- x+\n        |\n        y+\n\nFrom there you can perform relative and absolute moves. Once the command `D` is\nentered the path will start being drawn. Which means you can move the cursor\ninto position before starting each path.\n\n\n### Relative Moves\n\nThe following commands are allowed:\n\n     p   N   t\n       \\ | /\n     L - o - R    \u003c-- o is the current position of the cursor\n       / | \\\n     e   S   q\n\nAny number (see below) after a direction command is interpreted as the length\nof the step, otherwise the step size is `1`. You can also use two numbers\nseparated by a comma. For instance `q2.5,3` will move the cursor two and a half\nsteps to the right, and three steps down. Similarly `p2,1/2` will move the\ncursor two steps left, and half a step up.\n\n\n### Numbers\n\nAccepted numbers are either integers: `1`, fractions: `1/2` or decimals: `3.5`.\nNote that all decimals are converted to fractions. Decimals are a convenience\nthat allows you to write `4.5` instead of `9/2`. However, you are better of\nusing `13/3` instead of `4.33...`. The latter will most likely not add up\ninside the limits of the grid. You can also use multiple commands in the same\ndirection, if you find that easier. For instance `R4 R1/2`.\n\nThat means that if you get out of bounds errors, it is either because you are\nusing a decimal that does not \"add up\" properly inside the grid. Or simply\nbecause the resulting number is outside the grid.\n\nNumbers are converted to float before being exported to `json` or `svg`\n\n\n### Absolute Moves\n\nThe following absolute moves are allowed\n\n  - `Mx,y` to move to position `x,y` relative to the `origin`.\n  - `Z` move to the first position of the drawn path. (defaults to `origin`)\n  - `W` to move to move out to the right hand side of the drawing.\n  - `w` to move to the left side of the drawing.\n  - `H` to move to the top of the drawing.\n  - `h` to move to the bottom of the drawing.\n\n### Groups\n\nYou can provide substitution groups in the `groups` property of the `json`\nspecification. Groups names should always start with a `(` and end with a `)`.\nAny `(group)` in a path definition will be replaced verbatim until there are no\nmore `(` or `)` left in the path specification. (Note: this means you can cause\ninfinite loops as well as memory leaks.)\n\n\n## Fonts\n\nThe font paths are included in `dat/*/res.json`, along with SVGs for each\nsymbol. The raw descriptions are in `dat/*.json`.\n\nAt the moment the included fonts are:\n\n - `original`: blocky letters\n - `smooth`: smoother version.\n\n\n## Using the Code\n\nIn order to use this library\n\n    python3 setup.py install --user\n\nYou can then use the library from your code. see `gridfont/__init__.py` or\n`gridfont/writer.py` to get an idea. More documentation **might** be added\nlater, if this seems useful to people.\n\nTo see other options use:\n\n    gridfont --help\n\n\n## Parsing your Own Symbol Definitions\n\nTo parse a symbol `.json` file such as `dat/font.json` run the following, to\noutput the results to the directory `out`\n\n    gridfont parse font.json out [--svg]\n\nIf you include the `--svg` flag, an svg will also be created for each symbol.\n\n\n## Writing\n\nWhen you have a parsed symbol file (such `dat/original/res.json`), you can\nwrite SVGs with it like this:\n\n    gridfont write res.json tmp.svg 'my text'\n\n\n## Contributing\n\nThis is a project I started because I wanted a simple \"font\" that would allow\nme to easily draw line-based glyphs while plotting. I don't know whether I will\nend up developing this much further, but I'm open to suggestions.\n\n\n## Todo\n\n - Improve smooth numerals `2` and `3`?\n - Capital letters, at least `A-Z`\n - shift origin (in info section)?\n - simple pair kerning instructions?\n - some ligatures?\n\n\n## References\n\n - This is very similar to the Hershey fonts:\n   https://en.wikipedia.org/wiki/Hershey_fonts. Which you probably should use,\n   as they have been around for some time\n\n - This method is also similar to drawing in Logo:\n   https://en.wikipedia.org/wiki/Logo_(programming_language)\n\n - The path definitions are also similar to the SVG format (but simpler):\n   https://en.wikipedia.org/wiki/Scalable_Vector_Graphics\n\n - If you find this interesting, you might also like Recursive Radical Packing\n   Language: https://github.com/LingDong-/rrpl\n\n - Metafont (LaTeX): https://en.wikipedia.org/wiki/Metafont\n\n - LeonSans: https://github.com/cmiscm/leonsans\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finconvergent%2Fgridfont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finconvergent%2Fgridfont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finconvergent%2Fgridfont/lists"}