From ddc7898a78500c566e792881e038be73e6a3afc4 Mon Sep 17 00:00:00 2001 From: nedko Date: Fri, 12 Dec 2025 15:09:08 +0200 Subject: [PATCH] Fixed typo. Reordered widgets alphabetically. Reordered parameters logically. --- README.md | 76 +++++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 38 deletions(-) diff --git a/README.md b/README.md index 3f0b7c1..c915b3d 100644 --- a/README.md +++ b/README.md @@ -19,24 +19,6 @@ A utility which can be used to create custom images for TRMNL devices via code json.hpp from nlohmann/json v3.11.2 # List of special types -### TextFit -Controls automatic change the text size depending on contents. **String** type. Has several options: -* none - Text is not changed in any way -* shrink - Renders text with desired size and shrinks it to fit if contents are too large -* auto - Renders text with desired size and enlarges/shrinks it to fit if contents are too small/large - -### HAlign -Controls horizontal alignment of elements. **String** type. Has several options: -* left - Align objects to the left -* center - Align objects to be centered -* right - Align objects to the right - -### HAlign -Controls vertical alignment of elements. **String** type. Has several options: -* top - Align objects to the top -* center - Align objects to be centered -* bottom - Align objects to the bottom - ### color * **Object** type * Components - Red, Green, Blue, Alpha @@ -53,27 +35,25 @@ Controls vertical alignment of elements. **String** type. Has several options: ``` **NOTE**: If only some components are present in the config then only the present ones are overwritten from the default. +### HAlign +Controls horizontal alignment of elements. **String** type. Has several options: +* left - Align objects to the left +* center - Align objects to be centered +* right - Align objects to the right + +### VAlign +Controls vertical alignment of elements. **String** type. Has several options: +* top - Align objects to the top +* center - Align objects to be centered +* bottom - Align objects to the bottom + +### TextFit +Controls automatic change the text size depending on contents. **String** type. Has several options: +* none - Text is not changed in any way +* shrink - Renders text with desired size and shrinks it to fit if contents are too large +* auto - Renders text with desired size and enlarges/shrinks it to fit if contents are too small/large + # List of Widgets and their parameters -### text -Renders text within a specified box - -| Name | Type | Required | Default | Description | -| ---: | :--: | :------: | ------: | :---------- | -| x | int | | 0 | Horizontal position in pixels (from left to right) | -| y | int | | 0 | Vertical position in pixels (from top to bottom) | -| width | int | REQ | | Max width in pixels | -| height | int | REQ | | Max height in pixels | -| text | string | | | The text to be shown | -| fit | TextFit | | none | Controls automatic change the text size depending on contents | -| should_wrap | boolean | | false | Whether the text should automatically wrap | -| halign | HAlign | | center | Horizontal alignment of text | -| valign | VAlign | | center | Vertical alignment of text | -| halign_via_visible | boolean | | true | Whether to use visible pixels of the text for horizontal alignment. If false - uses text renderer hints | -| valign_via_visible | boolean | | true | Whether to use visible pixels of the text for vertical alignment. If false - uses text renderer hints | -| color | color | | 0, 0, 0, 255 (BLACK) | Color to use for text rendering | -| size | int | REQ | | Desired size of the text to use | -| font | string | | Global font key | Font file to use when rendering the text | - ### rect Renders a rectangle with optional rounded corners using either fill or internal stroke. | Name | Type | Required | Default | Description | @@ -85,3 +65,23 @@ Renders a rectangle with optional rounded corners using either fill or internal | radius | int | | 0 | Corner rounding radius in pixels | | stroke | int | | -1 | Internal stroke size in pixels. If <= 0 then the rectangle will be filled with the desired color | | color | color | | 0, 0, 0, 255 (BLACK) | Color to use for rectangle | + +### text +Renders text within a specified box + +| Name | Type | Required | Default | Description | +| ---: | :--: | :------: | ------: | :---------- | +| x | int | | 0 | Horizontal position in pixels (from left to right) | +| y | int | | 0 | Vertical position in pixels (from top to bottom) | +| width | int | REQ | | Max width in pixels | +| height | int | REQ | | Max height in pixels | +| text | string | | | The text to be shown | +| size | int | REQ | | Desired size of the text to use | +| font | string | | Global font key | Font file to use when rendering the text | +| color | color | | 0, 0, 0, 255 (BLACK) | Color to use for text rendering | +| should_wrap | boolean | | false | Whether the text should automatically wrap | +| fit | TextFit | | none | Controls automatic change the text size depending on contents | +| halign | HAlign | | center | Horizontal alignment of text | +| valign | VAlign | | center | Vertical alignment of text | +| halign_via_visible | boolean | | true | Whether to use visible pixels of the text for horizontal alignment. If false - uses text renderer hints | +| valign_via_visible | boolean | | true | Whether to use visible pixels of the text for vertical alignment. If false - uses text renderer hints |