{"id":17454973,"url":"https://github.com/kapetan/text-width","last_synced_at":"2025-09-14T07:31:26.417Z","repository":{"id":23368886,"uuid":"26730164","full_name":"kapetan/text-width","owner":"kapetan","description":"Measure the text width in browsers","archived":false,"fork":false,"pushed_at":"2015-02-03T20:22:44.000Z","size":164,"stargazers_count":20,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T12:46:27.977Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/kapetan.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}},"created_at":"2014-11-16T22:22:17.000Z","updated_at":"2023-02-02T03:25:46.000Z","dependencies_parsed_at":"2022-08-05T22:16:15.814Z","dependency_job_id":null,"html_url":"https://github.com/kapetan/text-width","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/kapetan%2Ftext-width","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Ftext-width/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Ftext-width/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kapetan%2Ftext-width/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kapetan","download_url":"https://codeload.github.com/kapetan/text-width/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232958497,"owners_count":18602775,"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-10-18T01:56:09.690Z","updated_at":"2025-01-08T01:11:45.793Z","avatar_url":"https://github.com/kapetan.png","language":"JavaScript","readme":"# text-width\n\nA small utility for measuring the text width in browsers that support the canvas API.\n\n# Usage\n\nInstall through `npm` and require it with `browserify`. It uses the [ctx.measureText][mt] method for acquiring the text width.\n\n```javascript\nvar width = require('text-width');\n\nvar w = width('hello world', {\n\tfamily: 'Arial',\n\tsize: 10\n});\n```\n\nIt supports following font options, `style`, `variant`, `weight`, `size` and `family`. Each corresponding to a similarly named [CSS property][font]. The size option can either be a number (size in pixels) or a string, e.g. `10pt`.\n\n[mt]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Drawing_text\n[font]: https://developer.mozilla.org/en-US/docs/Web/CSS/font\n","funding_links":[],"categories":["Utilities"],"sub_categories":["React Components"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetan%2Ftext-width","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkapetan%2Ftext-width","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkapetan%2Ftext-width/lists"}