{"id":13643094,"url":"https://github.com/facebook/TextLayoutBuilder","last_synced_at":"2025-04-20T21:32:46.198Z","repository":{"id":38715945,"uuid":"72580689","full_name":"facebook/TextLayoutBuilder","owner":"facebook","description":"An Android library that allows you to build text layouts more easily.","archived":false,"fork":false,"pushed_at":"2024-12-30T18:11:53.000Z","size":511,"stargazers_count":1476,"open_issues_count":2,"forks_count":131,"subscribers_count":47,"default_branch":"main","last_synced_at":"2025-04-10T19:53:18.827Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://facebook.github.io/TextLayoutBuilder","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/facebook.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","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":"2016-11-01T22:04:45.000Z","updated_at":"2025-03-18T21:49:02.000Z","dependencies_parsed_at":"2024-01-16T17:31:25.956Z","dependency_job_id":"178899d4-a414-44b9-bee0-7d7b27347569","html_url":"https://github.com/facebook/TextLayoutBuilder","commit_stats":{"total_commits":104,"total_committers":34,"mean_commits":"3.0588235294117645","dds":0.6057692307692308,"last_synced_commit":"52bbff60f8c1ce6ea01245e25185618c6163cc55"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FTextLayoutBuilder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FTextLayoutBuilder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FTextLayoutBuilder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/facebook%2FTextLayoutBuilder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/facebook","download_url":"https://codeload.github.com/facebook/TextLayoutBuilder/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249965547,"owners_count":21352925,"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-08-02T01:01:41.502Z","updated_at":"2025-04-20T21:32:45.836Z","avatar_url":"https://github.com/facebook.png","language":"Java","readme":"\u003cimg src=\"/docs/logo.png\" width=\"128\" align=\"right\"/\u003e\n\n# TextLayoutBuilder\n\nBuild text [Layout](https://developer.android.com/reference/android/text/Layout.html)s easily on Android.\n\n## Features\n- Create text `Layout`s easily.\n- Reuse builders to create similarly styled `Layout`s.\n- Cache `Layout`s of commonly used strings.\n- Improve performance by warming up the FreeType cache.\n\n## Download\nIf using Gradle, add this to your `build.gradle`:\n\n```groovy\ncompile 'com.facebook.fbui.textlayoutbuilder:textlayoutbuilder:1.7.0'\n```\n\nor, if using Maven:\n\n```xml\n\u003cdependency\u003e\n  \u003cgroupId\u003ecom.facebook.fbui.textlayoutbuilder\u003c/groupId\u003e\n  \u003cartifactId\u003etextlayoutbuilder\u003c/artifactId\u003e\n  \u003cversion\u003e1.7.0\u003c/version\u003e\n  \u003ctype\u003eaar\u003c/type\u003e\n\u003c/dependency\u003e\n```\n\n## Usage\n1. Set the properties on the `TextLayoutBuilder`:\n  ```java\n  TextLayoutBuilder builder = new TextLayoutBuilder()\n      .setText(\"TextLayoutBuilder makes life easy\")\n      .setTextColor(Color.BLUE)\n      .setWidth(400 /*, MEASURE_MODE_EXACTLY */);\n  ```\n\n2. Call `build()` on the builder to get a `Layout`:\n  ```java\n  Layout layout = builder.build();\n  ```\n\n3. Use the `Layout` in your code:\n  ```java\n  public class CustomView extends View {\n      private Layout layout;\n\n      public CustomView(Context context) {\n          super(context);\n      }\n\n      public void setLayout(Layout layout) {\n          this.layout = layout;\n      }\n\n      @Override\n      protected void onDraw(Canvas canvas) {\n          super.onDraw(canvas);\n\n          // Draw the layout.\n          layout.draw(canvas);\n      }\n  }\n  ```\n\n## Additional Usage\n1. Cache the layouts for commonly used strings by turning on caching in the `TextLayoutBuilder`.\n  ```java\n  textLayoutBuilder.setShouldCacheLayout(true);\n  ```\n\n2. Glyph warming provides significant performance boost for large blurbs of text.\nTurn this on and pass in a `GlyphWarmer` for the `TextLayoutBuilder`.\n  ```java\n  textLayoutBuilder\n      .setShouldWarmText(true)\n      .setGlyphWarmer(new GlyphWarmerImpl());\n  ```\n\n3. Import a style defined in XML into a `TextLayoutBuilder` object.\n  ```java\n  ResourceTextLayoutHelper.updateFromStyleResource(\n      textLayoutBuilder, // builder object\n      context,           // Activity context\n      resId);            // style resource id\n  ```\n\n## License\n\nTextLayoutBuilder is Apache-2-licensed.\n","funding_links":[],"categories":["TextView","Java","Kotlin"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FTextLayoutBuilder","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffacebook%2FTextLayoutBuilder","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffacebook%2FTextLayoutBuilder/lists"}