Set characters count per line in Delphi code - delphi

I do code format with Ctrl+D which makes code lines shorter. I was expecting I can adjust line width with right margin:
But this not helped. How to adjust code line width?

Related

FPDF/FPDI: How to vertically align a cell or multi-cell?

I'm starting to think is not possible? (out of the box/default class)
I am using FPDF/FPDI PHP class to generate a .pdf
In this situation, I have some text that can be short, or be long (no telling)
So I set a width on my cell.. and change from Cell() to MultiCell()..
This allows long text to wrap.. however it seems to vertically align to the top?
Which is no good if the string is NOT long enough to wrap..
How can you force the text to the bottom of the cell regardless if it is a single line or a wrapped line?
Is there a default way to do this?
I saw mention of TCPDF (or whatever).. and some dead links to 'plug-ins'.. (but not sure if they were FPDI or not?)
This works and looks fine:
$pdf->MultiCell(185, 12, 'ABC-123-DEF-456 And-Last-Name-Here', 1, 'C', false);
However this way, does NOT have the (single line) text at the bottom.. so there is a cap between the string output and the 'underline' it shoudl match up with with (baseline)
$pdf->MultiCell(185, 12, 'ABC-123 DEF-456', 1, 'C', false);
How do you overcome this?
I think, I just found solution.
As default FPDF class I use this code: https://github.com/Setasign/tFPDF/blob/master/tfpdf.php (it supports UTF-8 chars)
Than have edited this class code: http://www.fpdf.org/en/script/script52.php
In Function drawRows() I have changed this row:
$l+=$cw[$c];
To this:
$l+=$this->GetStringWidth($c)/$this->FontSize*1000;
And than use drawTextBox() as is descripted in http://www.fpdf.org/en/script/script52.php
Now I will try to explain:
GetStringWidth() function supports utf-8 chars soo we can use it to calculate char width. And than we can get correct value with some multiplications and divisions for compability with that fpdf class.
I didnt test this code extensivly... only basic testing.
You can do it with a new line, "\n". But you need to keep in mind that cell height needs to be determined by number of "\n", as multi_cell will increase cell height automatically when required.
This is how I have done it:
spacing = " \n\n\n\n\n\n\n\n\n"
contents = "\n" + "hello" + spacing
pdf.multi_cell(10, 3, contents, border=1, align="R")
This will align "hello" to the top right corner.
When creating the spacing I added a space before the \n's otherwise it will be very close to the edge. I also added a \n before the "hello" as otherwise it will be too close to the top. I kept the multi_cell height to 3, but you can even put it to 1 or anything that makes sure your size of \n's is not smaller than the cell height.
I know this is very gimmicky, so if you have a better way please let me know.
This seems could be the answer:
http://www.fpdf.org/en/script/script52.php
Unfortunately, at least to me, it doesn't seem to work when using UTF-8 characters.

iOS: UILabel How to achieve TextAlignment.justified on one line

How to achieve TextAlignment.justified on one line of a label.
I have one UILabel of fixed width (200)
Number of lines of this Label is always 1
I want the text of this One Line to be justified on both edges
So far What I have seen the TextAlignment.justified is only applied on paragraph and also on paragraph it is not applied on last line or single line.

TRichEdit - How to add an empty line with size change?

I have array of strings and i want to add an empty line of lesser size between some of them.
So i have a code:
const _n=#13#10;
//...
r1.Lines.Clear;
r1.SelAttributes.Size:=18;
r1.SelText:='TEST';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+'............';
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test1';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+' ';
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test2';
and size change works for first line (with dots), but line between test1 and test2 has same size as they (18) somehow =\
Any suggestions?
I found some workaround: it's possible to use tab-symbol in place of space.
So the following code works fine:
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test1';
r1.SelAttributes.Size:=6;
r1.SelText:=_n+#9; // <- tab here
r1.SelAttributes.Size:=18;
r1.SelText:=_n+'test2';
Instead of inserting empty lines you could change the line spacing of individual lines by sending EM_SETPARAFORMAT messages to the Richedit. See this question
How to decrease line space of tRichEdit
for an example. To increase the line spacing change the value of "Para.dyLineSpacing". Use "500" to get an idea of the effect.

Line fill for UITextView?

Is there a property that will apply the proper character spacing to have all the text on each line in an NSAttributedString butt up against the bounds like in a book, (including the final line which I know isn't done in books)? I know kerning can be adjusted, but that won't dynamically adjust on a per line basis. Any help would be appreciated. Also NSTextAlignmentJustified and NSTextAlignmentNatural get close, but won't apply the effect to the last line of text.
The only option is to use NSTextAlignmentJustified. Last line is never justified, because NSTextAlignmentJustified refers to Left Justification mode, as it is the standard case.
For more information you can take a look at Typographic Alignment on wikipedia : http://en.wikipedia.org/wiki/Typographic_alignment

sifr3 line height issue

Why is it that the line height of the last line of text (in any quote with 3 or more lines) is greater than the line height of the above lines?
The issue is replicable at www.UXQuotes.com
Because Flash is weird. Now that doesn't help much, but Flash text rendering does have a few issues…

Resources