{"id":17689730,"url":"https://github.com/vitovan/pango-cairo-wasm","last_synced_at":"2025-10-29T04:06:06.668Z","repository":{"id":154033358,"uuid":"631128909","full_name":"VitoVan/pango-cairo-wasm","owner":"VitoVan","description":"PangoCairo on the Web","archived":false,"fork":false,"pushed_at":"2024-11-10T02:06:22.000Z","size":2171,"stargazers_count":13,"open_issues_count":0,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-08-23T05:04:24.972Z","etag":null,"topics":["cairo","emscripten","pango","sdl2","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://vitovan.com/pango-cairo-wasm/","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"wtfpl","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/VitoVan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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,"zenodo":null},"funding":{"github":"VitoVan","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2023-04-22T02:54:23.000Z","updated_at":"2025-08-12T22:06:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"0462fa2a-1a7e-45f2-a4b5-9c4ae6d32943","html_url":"https://github.com/VitoVan/pango-cairo-wasm","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/VitoVan/pango-cairo-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitoVan%2Fpango-cairo-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitoVan%2Fpango-cairo-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitoVan%2Fpango-cairo-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitoVan%2Fpango-cairo-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/VitoVan","download_url":"https://codeload.github.com/VitoVan/pango-cairo-wasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/VitoVan%2Fpango-cairo-wasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271745472,"owners_count":24813499,"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","status":"online","status_checked_at":"2025-08-23T02:00:09.327Z","response_time":69,"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":["cairo","emscripten","pango","sdl2","wasm","webassembly"],"created_at":"2024-10-24T11:48:43.195Z","updated_at":"2025-10-29T04:06:01.636Z","avatar_url":"https://github.com/VitoVan.png","language":"Shell","funding_links":["https://github.com/sponsors/VitoVan"],"categories":[],"sub_categories":[],"readme":"# PangoCairo on the Web\n\n[![docker build](https://github.com/VitoVan/pango-cairo-wasm/actions/workflows/docker.yml/badge.svg)](https://github.com/VitoVan/pango-cairo-wasm/actions/workflows/docker.yml) [![Docker Pulls](https://img.shields.io/docker/pulls/vitovan/pango-cairo-wasm?logo=docker)](\u003chttps://hub.docker.com/r/vitovan/pango-cairo-wasm\u003e) [![gh-pages](https://github.com/VitoVan/pango-cairo-wasm/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/VitoVan/pango-cairo-wasm/actions/workflows/gh-pages.yml)\n\nCompile [Cairo](https://www.cairographics.org/) / [Pango](https://docs.gtk.org/Pango/index.html) / [PangoCairo](https://docs.gtk.org/PangoCairo) based applications from C to WebAssembly?\n\nTry it online (1.5 ~ 3.5 MB data transfer):\n\n**Cairo**: https://vitovan.com/pango-cairo-wasm/hello-cairo.html\n\n**PangoCairo**: The pthreads used by Pango requires Web Workers require extra [HTTP HEADERS](https://web.dev/coop-coep/), and the [workarounds](https://dev.to/stefnotch/enabling-coop-coep-without-touching-the-server-2d3n) would break other pages on my website. So, please [download](https://github.com/VitoVan/pango-cairo-wasm/archive/refs/heads/gh-pages.zip) the files and [serve](https://github.com/VitoVan/pango-cairo-wasm/blob/main/wasm-server) them locally.\n\nPreview:\n\n![Hello Cairo](hello-cairo.png)\n\n![Hello Pango](hello-pango.png)\n\n\n## Usage\n\n### Setup emcc \u0026 pkg-config\n\n#### with pre-built Docker\n\n```bash\nalias emcc=\"docker run --rm --name pcwa -v $(pwd):/app -w=/app vitovan/pango-cairo-wasm emcc\"\nalias pkg-config=\"docker run --rm --name pcwa -v $(pwd):/app -w=/app vitovan/pango-cairo-wasm pkg-config\"\n# give it a try\nemcc --help\npkg-config --libs --cflags pangocairo\n```\n\n#### build from source\n\nThis build.sh only compiles on **Fedora 38** (due to the good old [c2man](https://github.com/fribidi/c2man) dependency), if you can't get one, please use Docker to build.\n\n```bash\ngit clone https://github.com/VitoVan/pango-cairo-wasm.git\ncd pango-cairo-wasm\ngit submodule init\ngit submodule update\necho -e \"export magicdir=$(pwd)\\n$(cat env.sh)\" \u003e env.sh\nbash build.sh\n```\n\nWait for 20 minutes or more. If all went well, execute:\n\n```bash\n. env.sh\n# give it a try\nemcc --help\npkg-config --libs --cflags pangocairo\n```\n\n### Compile C Code\n\n#### Cairo with no pthread\n\n```bash\nexport CAIRO_FLAGS=\"$(pkg-config --libs --cflags glib-2.0, gobject-2.0, cairo, pixman-1, freetype2, fontconfig, cairo, expat, harfbuzz) -s USE_SDL=2 -s USE_PTHREADS=0 -s ASYNCIFY\"\n\ncurl -LO https://raw.githubusercontent.com/VitoVan/pango-cairo-wasm/main/hello-cairo.c\nemcc $CAIRO_FLAGS hello-cairo.c -o hello-cairo.html\n```\n\n#### PangoCairo with pthread\n\n```bash\nexport PANGOCAIRO_FLAGS=\"$(pkg-config --libs --cflags glib-2.0, gobject-2.0, cairo, pixman-1, freetype2, fontconfig, cairo, expat, harfbuzz, pangocairo) -s USE_SDL=2 -s EMULATE_FUNCTION_POINTER_CASTS -s PTHREAD_POOL_SIZE=10 -s USE_PTHREADS=1 -s ASYNCIFY\"\ncurl -LO https://raw.githubusercontent.com/VitoVan/pango-cairo-wasm/main/hello-pangocairo.c\n# get yourself the fonts\nmkdir ./fonts\ncd fonts\ncurl -LO https://raw.githubusercontent.com/VitoVan/pango-cairo-wasm/main/fonts/OpenSans-VariableFont_wdth,wght.ttf\ncurl -LO https://raw.githubusercontent.com/VitoVan/pango-cairo-wasm/main/fonts/OpenSans-Italic-VariableFont_wdth,wght.ttf\ncd ..\n# compile\nemcc $PANGOCAIRO_FLAGS --embed-file ./fonts@/usr/share/fonts/ hello-pangocairo.c -o hello-pangocairo.html\n```\n\n#### Start the debug server\n\n```bash\ncurl -LO https://raw.githubusercontent.com/VitoVan/pango-cairo-wasm/main/wasm-server\nchmod +x wasm-server\n./wasm-server\n```\n\nopen the following links in your browser:\n\n- http://localhost:4242/hello-cairo.html\n- http://localhost:4242/hello-pangocairo.html\n\n## TODO\n\n- upgrade dependencies to newer version\n- make this script working on modern system (\u003e Fedora 38)\n- make this script working on Debian-based system\n\n## License\n\nDO WHAT THE FUCK YOU WANT TO.\n\n## Contributing\n\nI don't have time to fix my shit, and I don't have time to read your shit.\n\nIf you want to add anything to this repo, make sure:\n\n1. don't break the old working code, no matter how ugly it is.\n2. don't change the sub-module remote url, unless the upstream repo changed.\n3. don't add binaries.\n4. make sure your modified version just work, don't add any switches/options unless it is super necessary and discussed before writing them down.\n\n    *just work* = no need to change this readme\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitovan%2Fpango-cairo-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitovan%2Fpango-cairo-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitovan%2Fpango-cairo-wasm/lists"}