{"id":13620532,"url":"https://github.com/mobius3/font-chef","last_synced_at":"2025-04-14T01:24:44.930Z","repository":{"id":64004860,"uuid":"266662376","full_name":"mobius3/font-chef","owner":"mobius3","description":"A font cooking library","archived":false,"fork":false,"pushed_at":"2021-11-14T14:55:05.000Z","size":829,"stargazers_count":54,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-27T15:22:15.384Z","etag":null,"topics":["c","cpp","font-baking"],"latest_commit_sha":null,"homepage":"https://mobius3.github.io/font-chef","language":"C","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/mobius3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-25T02:10:42.000Z","updated_at":"2025-02-23T19:08:54.000Z","dependencies_parsed_at":"2023-01-14T18:30:39.670Z","dependency_job_id":null,"html_url":"https://github.com/mobius3/font-chef","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Ffont-chef","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Ffont-chef/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Ffont-chef/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mobius3%2Ffont-chef/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mobius3","download_url":"https://codeload.github.com/mobius3/font-chef/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248805759,"owners_count":21164385,"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":["c","cpp","font-baking"],"created_at":"2024-08-01T21:00:56.892Z","updated_at":"2025-04-14T01:24:44.906Z","avatar_url":"https://github.com/mobius3.png","language":"C","readme":"# Font Chef\n\n*Font Chef* is a cross-platform C99 and C++ library to create character atlas of pre-rasterized glyphs from a font at a specified size and color. It is mostly useful in situations where you cannot afford to rasterize a piece of text again whenever it changes.\n\nIt abstracts [stb_truetype](https://github.com/nothings/stb/blob/master/stb_truetype.h) to render glyphs to a pixmap and to produce appropriate clipping rects to later display those glyphs.\n\n**Hello world in C++**\n```c++\nfc::font font = fc::from(font_data, fc::px(30), fc_color_black).add(fc_basic_latin).cook();\nfc::render_result result = font.render(\"Hello, world!\");\n// use font.pixels() to make a texture\nfor (auto \u0026 map : result) {\n    render(texture, map.source, map.target);\n}\n```\n\n**Hello world in C**\n```c\nfc_font * font = fc_construct(font_data, fc_px(30), fc_color_black);\nfc_add(fc_basic_latin.start, fc_basic_latin.end);\nfc_cook(font);\n// use fc_get_pixels(font) to make a texture\n\nconst char hello[] = \"Hello, world!\";\nfc_character_mapping output[32];\nint count = fc_render(font, text, strlen(hello), \u0026output);\nfor (int i = 0; i \u003c count; i++) {\n    render(texture, output[i].source, output[i].target\n}\n```\n\n**Features**\n\n- Small, clean and easy-to-use API\n- Ships with C++ wrapper classes\n- Considers kerning when resolving rendering rects\n- Ships with many standard unicode blocks to choose from\n- Rendering API agnostic (it does not render anything directly, it returns pixels and clipping rects)\n- Fully documented with examples for each function\n- No external dependencies\n\n## Integrating with your code\n\n### Using pre-built releases\n\nDownload a pre-built release package suitable for your platform and\nuncompress it somewhere you'll remember later (usually where you put\nother development libraries). Let's assume you uncompressed font-chef to\n`/home/me/libs/font-chef`.\n\n**Using CMake**: If you're using CMake, specify the variable\n`CMAKE_PREFIX_PATH` to point to it before running CMake in your project:\n\n```shell script\ncmake -DCMAKE_PREFIX_PATH=/home/me/libs\n```\n\nAfterwards you can use `find_package(font-chef)` and\n`target_link_libraries(\u003cyour-executable\u003e PUBLIC font-chef)` to link\n`\u003cyour-executable\u003e` against font-chef.\n\n**Not using CMake**: Assuming you uncompressed font-chef to the same path as\nabove, you should configure your build system to look for include files\ninside `/home/me/libs/font-chef/include` and to look for shared objects to\nlink against inside `/home/me/libs/font-chef/lib`. In case of Windows, you\nshould also point your linker to `font-chef/bin` as well.\n\n### Using a source release and CMake\n\nUncompress font-chef in a folder inside your project (e.g,\n`your-project/third-party/font-chef`) and then use\n`add_subdirectory(third-party/font-chef EXCLUDE_FROM_ALL)` to add the\nlibrary target. Afterwards you can use `find_package(font-chef)` and\n`target_link_libraries(\u003cyour-executable\u003e PUBLIC font-chef)` to link\n`\u003cyour-executable\u003e` against font-chef.\n\nCompiling the `.c` files directly in your project is not recommended nor\nsupported.\n\n## Compile from source\n\nYou'll need CMake installed and in your path and also capable of finding\nyou compiler and linker. Then, after checking out this repository:\n\n```shell script\nmkdir build/\ncd build/\ncmake ..\nmake\n```\n\n## Examples\n\nExamples for C and C++ are in the [src/examples](src/examples) folder. To build them, when running cmake as in [Compile from source](#compile-from-source), add the following variable:\n\n```shell script\ncmake .. -DFONT_CHEF_BUILD_EXAMPLES=1\n```\n\nYou will need SDL2 available and CMake needs to be able to find it.\n\n## Documentation\n\nSee [here](https://mobius3.github.io/font-chef)\n\n","funding_links":[],"categories":["C","Libraries"],"sub_categories":["Misc"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Ffont-chef","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmobius3%2Ffont-chef","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmobius3%2Ffont-chef/lists"}