{"id":23845819,"url":"https://github.com/asmwarrior/svgpanel","last_synced_at":"2025-08-17T14:41:57.362Z","repository":{"id":152210757,"uuid":"481817135","full_name":"asmwarrior/SvgPanel","owner":"asmwarrior","description":"a wxPanel which can show svg image and simple text labels","archived":false,"fork":false,"pushed_at":"2025-02-25T14:56:17.000Z","size":300,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:55:21.702Z","etag":null,"topics":["nanosvg","svg","wxwidgets","wxwidgets-gui"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asmwarrior.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2022-04-15T02:52:18.000Z","updated_at":"2025-02-25T14:56:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"0e5f695e-873b-4a8f-8271-99f153c478b4","html_url":"https://github.com/asmwarrior/SvgPanel","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/asmwarrior%2FSvgPanel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmwarrior%2FSvgPanel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmwarrior%2FSvgPanel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asmwarrior%2FSvgPanel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asmwarrior","download_url":"https://codeload.github.com/asmwarrior/SvgPanel/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248804783,"owners_count":21164131,"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":["nanosvg","svg","wxwidgets","wxwidgets-gui"],"created_at":"2025-01-02T20:48:14.795Z","updated_at":"2025-04-14T00:53:32.767Z","avatar_url":"https://github.com/asmwarrior.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SvgPanel\nA wxPanel which can show svg image and simple text labels.\n\nThe code contains two parts:\n1, original file `nanosvg.h` and `nanosvgrast.h` are from [memononen/nanosvg: Simple stupid SVG parser](https://github.com/memononen/nanosvg)\n2, original file `svg_panel.h` and `svg_panel.cpp` are from doublemax's svg panel sources in [wxWidgets Discussion Forum - Index page](https://forums.wxwidgets.org/), see this post for details [Re: Use SVG Icons with wxDataViewCtrl (and others)](https://forums.wxwidgets.org/viewtopic.php?p=184852#p184852)\n\nNote that currently,  [memononen/nanosvg: Simple stupid SVG parser](https://github.com/memononen/nanosvg) does not support parsing the `Text` field in `svg` file. I have modifed `nanosvg.h` to support parsing the `Text` field in the SVG file. I mainly followed commits in this pull request: [Adds basic text parsing by jamislike · Pull Request #94 · memononen/nanosvg](https://github.com/memononen/nanosvg/pull/94), but with some extra code changes, Also, I have merged from the latest master code of nanosvg.\n\nThe `svg_panel.h` and `svg_panel.cpp` files are modifed to extract the `Text` field and show them by wxWidgets' `DrawText` function. So, basically, the rasterizer from nanosvg is used to generated the background wxBitmap image, and later text labels were drawn on top of the wxBitmap image.\n\nHere is the screen shot of a svg file `drawing.svg` shown in the panel compared with shown in the [Inkscape editor](https://inkscape.org/). You can also open the svg file in the web browser directly for a comparsion.\n\n ![svg image shown in panel vs Inkscape](./svg_show_panel_vs_inkscape.png \"svg image shown in panel vs Inkscape\")\n\n# How to use the code\n\nJust copy/drag the 4 source files(`nanosvg.h`, `nanosvgrast.h`, `svg_panel.h` and `svg_panel.cpp`) to your project file, and construct a `SVGPanel` window where you needed.\n\n# Note\n\n## anchor position of the text\n\n```\n    \u003ctext\n       xml:space=\"preserve\"\n       style=\"font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05556px;line-height:1.25;font-family:Arial;-inkscape-font-specification:'Arial, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;text-align:center;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;stroke-width:0.264583\"\n       x=\"32.977989\"\n       y=\"11.358852\"\n       id=\"text1-7\"\u003e\u003ctspan\n         sodipodi:role=\"line\"\n         id=\"tspan1-7\"\n         style=\"font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:7.05556px;font-family:Arial;-inkscape-font-specification:'Arial, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#ff00ff;stroke-width:0.264583\"\n         x=\"32.977989\"\n         y=\"11.358852\"\u003ewxWidgets SVG Panel demo\u003c/tspan\u003e\u003c/text\u003e\n```\n\nIn the above section of svg file, you can see that `text-anchor:start` is used, currently, the text parser can't handle the `text-anchor:middle`, if you have `text-anchor:middle` in your svg file, the text is rendered as `text-anchor:start`.\n\n## tspan section inside tspan\n\nCurrently, the parser can't handle the `tspan` section inside another `tspan` section(This usually happens you have different colors for a single `text` section. Normally, it can handle a `tspan` section inside a `text` section.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmwarrior%2Fsvgpanel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasmwarrior%2Fsvgpanel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasmwarrior%2Fsvgpanel/lists"}