Gtk.Label line wrap not working as expected - gtk

when width is sufficient to hold all characters
when characters exceed width
i have used set_line_wrap(True).There are two labels in each row as shown in picture, right label in each row has set_line_wrap(True), why is the label in the second row not starting from the beginning? when characters exceeds, i expect it to start from same position where it started before when characters were not exceeding.
Code:
descriptionLabel=Gtk.Label(description)
descriptionLabel.set_line_wrap(True)

Try setting halign to Gtk.AlignSTART and xalign to 0. This should ensure that both the label as a whole and each individual line starts at the very left of the available space.

Related

Tableau: how to align text in dual axis-ed column labels

I am having trouble with label's text alignment. I used workaround to have rows coloured based on a value of certain row (featured in e.g. this tutorial); for example, if the Status is "Cancelled", it colours entire row red, otherwise it is green.
I created AGG(MAX(1)) columns for bar (with fixed range 0 to 1) and AGG(MAX(0)) columns for text (with fixed range 0 to 0), then paired them through dual axis.
However, I found out the text label is automatically aligned to the centre. I looked into text label options and set my alignment to the left (in both Edit Label window and Alignment setting) but it had no effect whatsoever. I changed Format... settings for column but once again, it had no effect.
I even tried changing fixed range on AGG(MAX(0)) columns or changing the zero in MAX(0) to some other number but this only moved centre-aligned text so it was of no use.
Here is a picture to illustrate my point:
I found out what was the issue and also arrived at better way to do it than the one I described in my question.
Here's the tutorial (using Tableau 2021.4):
Create a column MAX(-1). Right-click the column, go to Edit Axis..., set Range to fixed (start at -1, end at 0), delete the Title, and disable all Tick Marks (by setting them to 'None').
In Marks panel, set the Mark to 'Gantt Bar'.
Drop your condition for coloring (e.g. calculated field) on Color in Marks panel.
Create a calculated field MAX(1) and drop it on Size in Marks panel. This will fill out entire column width with a color bar. If needed, increase the bar width by moving the slider under Size to the right.
Drop the text value on Label in Marks panel. Now you should see text labels. If not, increase cell's height (Format > Cell Size > Taller or Ctrl+Up).
If you want a header (just like shown in my picture), create a column MAX(0), set its Range to fixed (start at 0, end at 0), disable all Tick Marks and change the Title.
Right-click the MAX(0) and tick 'Dual Axis'.
In case you'll encounter some challenges when formatting the end result, check formatting hierarchy (this tutorial may help).

Text component displaying lines in reverse order

Alright, I do not know how to fix this and only ran into this problem after trying to put in some longer text on a UI Text component. I have tried both pasting a value into its Text attribute through the Unity editor, and setting its value programmatically like this:
t.GetComponent<Text> ().text = "This is where meat, fish, and [...] (long text)"
Because Horizontal wrap is on, the text wraps when it reaches the edge of the available space.
However, the text displays backwards. Meaning, the start of the paragraph is at the bottom, and bottom at the top. Taking off wrap fixes this, but then the font size has to be really small (or it won't all be visible), and it can't form a normal paragraph because it has to... you know... wrap.
Is this a bug in Unity?
This is what happens - as you can see, it is displayed backwards:
The negative Line Spacing value is what is causing the issue here:
When the value of this field is less than 0, the lines will actually be arranged backwards, leading to the behaviour you're currently encountering. Just change the value to a positive number to have the text display correctly.

How to easily control spacing height between two paragraphs?

Currently, I am using
document.add( Chunk.NEWLINE );
after each paragraph to generate space between two paragraphs. What is the way to generate a spacing of any height I specify?
The space between two lines of the same Paragraph is called the leading. See Changing text line spacing
If you want to introduce extra spacing before or after a Paragraph, you can use the setSpacingBefore() or setSpacingAfter() method. See itext spacingBefore property applied to Paragraph causes new page
For instance:
Paragraph paragraph1 = new Paragraph("First paragraph");
paragraph1.setSpacingAfter(72f);
document.add(paragraph1);
Paragraph paragraph2 = new Paragraph("Second paragraph");
document.add(paragraph2);
This puts 72 user units of extra white space between paragraph1 and paragraph2. One user unit corresponds with one point, so by choosing 72, we've added an inch of white space.

How to increase the row height in sub-grid

I have a unique requirement where I need to display all the contents of an attribute in a sub-grid. This attribute stores multiple line of text i.e. a few paragraphs of text. The maximum column length of 300px is not enough to display such text without cutting off.
Is there a way I can increase the row height in sub-grids so that long text warps into multiple lines?
No I don't believe this is possible. The row height is fixed.

Display multiple lines in SKLabelNode

I checked there is no properties for multiline in SKLabelNode.
Is it possible to display multiple lines in SKLabelNode?
If no, Please give idea to display text in multilines.
I use this bit of code to get multi lines of code with SKLabelNode.
Multilines in a label-github
There is a way now to do multi-line SKLabelNodes.
Set the property numberOfLines to 0. From Apple's documentation:
The default value is 1 (a single line). A value of 0 in interpreted as an unlimited number of lines. If the height of the text reaches the number of lines, the text will be truncated using the line break mode.