{"id":13490313,"url":"https://github.com/mcufont/mcufont","last_synced_at":"2025-03-28T06:30:44.533Z","repository":{"id":34695951,"uuid":"38671116","full_name":"mcufont/mcufont","owner":"mcufont","description":"A font rendering library for microcontrollers.","archived":false,"fork":false,"pushed_at":"2024-09-18T18:50:34.000Z","size":1193,"stargazers_count":326,"open_issues_count":4,"forks_count":72,"subscribers_count":20,"default_branch":"master","last_synced_at":"2024-10-31T03:35:33.958Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mcufont.png","metadata":{"files":{"readme":"README.rst","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":"2015-07-07T07:26:52.000Z","updated_at":"2024-10-24T00:59:11.000Z","dependencies_parsed_at":"2024-10-31T03:41:51.331Z","dependency_job_id":null,"html_url":"https://github.com/mcufont/mcufont","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcufont%2Fmcufont","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcufont%2Fmcufont/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcufont%2Fmcufont/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mcufont%2Fmcufont/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mcufont","download_url":"https://codeload.github.com/mcufont/mcufont/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245984244,"owners_count":20704787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":[],"created_at":"2024-07-31T19:00:44.624Z","updated_at":"2025-03-28T06:30:43.726Z","avatar_url":"https://github.com/mcufont.png","language":"C","funding_links":[],"categories":["C","GUI"],"sub_categories":["Font utils"],"readme":"=================\nMCUFont: Overview\n=================\n\n.. include :: menu.rst\n\nMCUFont is a font compression, decompression and rendering library for use with\nmicrocontroller systems. Its main purpose is to allow high-quality anti-aliased\ntext rendering, while having small enough footprint to fit in the typical flash\nmemories.\n\nHistorically, there are many simple font rendering routines available. They are\nusually ad-hoc implementations inside various graphics libraries, and\nconsequently they \"take the easy way out\". Usually this means monochrome only,\nno kerning, sometimes only monospace and very basic algorithms for word wrap.\nThe goal of this library is to become a standard solution for this problem, so\nthat also microcontroller based systems can enjoy high quality text. On the\nother hand, the purpose is not to compete with libfreetype and similar vector\nfont rendering libraries, because they already exist.\n\n\nExample \n=======\n.. image:: docs/images/example.png\n\n\nOverall structure\n=================\nThe library consists of the encoder program, written in C++, and the decoder\nlibrary, written in ANSI C. The encoder runs on your PC and is used to import\nand compress font files. The decoder runs on the target microcontroller and\ndecompresses and renders the characters.\n\n\nGetting started\n===============\nIn order to get started, download the library and install the following\ndependencies:\n\n- libfreetype\n- cxxtest\n\nNext, run *make* in the root folder. This will build the encoder, encode a few\nexample fonts and build a *render_bmp* example program for testing the decoder\nand renderer.\n\nThe example fonts will be built in the *fonts* subfolder, and consist of two\nfiles each. For example, *DejaVuSans12.c* and *DejaVuSans12.h* are the\nDejaVu Sans font rendered at 12 pixels height. To render text using this\nfont, you could do this:\n\n.. code-block:: C\n\n    #include \"fonts.h\"\n    #include \u003cmcufont.h\u003e\n\n    static void pixel_callback(int16_t x, int16_t y, uint8_t count, uint8_t alpha, void *state)\n        {\n        while (count--)\n            {\n                /* your code goes here, ex: drawPixel(x, y, alpha, color::black); */\n                x++;\n            }\n        }\n\n    static uint8_t char_callback(int16_t x0, int16_t y0, mf_char character, void *state)\n        {\n            return mf_render_character(\u0026mf_rlefont_DejaVuSans12.font, x0, y0, character, \u0026pixel_callback, state);\n        }\n\n    void main()\n        {\n            mf_render_aligned(\n                \u0026mf_rlefont_DejaVuSans12.font,\n                0, 0,\n                MF_ALIGN_LEFT,\n                \"Hello, World!\", 13,\n                \u0026char_callback, NULL);\n        }\n\n\nWhat happens here is that *mf_render_aligned* takes each character of the\nstring \"Hello, world!\" in turn, and calls *mf_render_character* for them.\nThe character rendering function will then decompress the glyph data and call\n*pixel_callback* for each consecutive run of pixels. The callback function\nprovided by you will then finally draw the pixels to the screen.\n\n\nFeatures and limitations\n========================\n*Features*\n\n- Pure C runtime\n- Support for importing .ttf and .bdf fonts\n- Small code size of the decoder library (1-5 kB depending on used features)\n- Abstract callback interface for writing to any kind of display\n- 16-level antialiased fonts\n- Uses libfreetype's high-quality hinting when importing .ttf fonts\n- Advanced kerning, justification and word wrapping algorithms\n- Fast decoding and high compression ratio\n\n*Limitations*\n\n- No support for runtime scaling of fonts\n- No subpixel antialiasing (could be added in the future)\n\n\nSystem requirements\n===================\nThe decoder side has minimal system requirements. The following header files\nare only required for the declaration of the standard types, and can be easily\nreplaced if not available on the target platform:\n\n- *stdbool.h* for declaration of *bool* datatype\n- *stdint.h* for declaration of *uint32_t* etc. datatypes\n- *stddef.h* for *wchar_t* if enabled (optional)\n\nThe encoder also should compile on many kinds of platforms.\n\n\nDebugging and testing\n=====================\nThe encoder includes basic unit tests which are run before building. The\ndecoder side is tested using the *render_bmp* example applications. All tests\nare run automatically by executing *make* in the top directory.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcufont%2Fmcufont","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmcufont%2Fmcufont","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmcufont%2Fmcufont/lists"}