Changing text adjustment in UIView using swift - ios

I've been trying to create my app and something is bugging me very much,
I have images of what I am trying to achieve:
1)
2 )
number 1 shows what I am trying to do, the letters are "squeezed" together making the text appear tighter with a short width even though the letter sizing is big.
number 2 shows my attempt to achieve this, I tried multiple different ways to get that same look but failed for hours, does anyone have any suggestions or know how to make the text look like that in the first picture?
I appreciate any help, thank you!

The only way how to do it AFAIK is to use transform on UILabel, like this:
let widthTransform = 0.8 // Shrink label to 80% of its width
label.layer.transform = CATransform3DMakeScale(widthTransform, 1.0, 1.0);
Hope it helps!
Note* that transform work for about 30% of decrease (even less imo), then it just starts to look very bad. You can also change text spacing, but if you calculate it dynamically, you could end up with negative one and that looks terrible. The easiest way really is then just change of the design :)

Options:
You can decrease character spacing like in this answer
and increase font size.
Having fun with transformation on layer is really awful idea, as later you won't be able to get the height of text etc -> just everything will be working wrong.
You can also just use different font.

Related

How to change text size of TextMobject in Manim

I hope you are all doing great!
I am wondering how to make text smaller in manim.
I know you can do text.scale(0.8), but I want to know how to do it after it has been used.
For example,
text.scale(0.8)
self.play(Write(text))
makeSmaller(text) <-- what I'm looking for
So far, I've tried ApplyMethod(text.scale(0.8)) with no success.
Thank you so much
Edit:
Ideally, I do not want to create two different TextMobject's and then transition between two animations.
It is:
ApplyMethod(text.scale, 0.8)
or
self.play(text.scale, 0.8)
More info here

using excel to show Increase, Decrease and no change in Multiple colours

Looking for some help or to be pointed in the right direction. Been stuck on this for a while and the main issue is I don't even know where to start. I am sure there is a solution but my brain will not see it.
To use as an example I have a table that shows monthly results for multiple different areas:
What I want to do is in the gap along side each number is show an increase, decrease or no change, using up arrow down arrow and square. That I can do using conditional formatting my issue comes with the fact that I also want it to be multiple Colours. So it will take into account increase and decrease and whether they are in target.See below:
Atm I am copying and pasting each month. But having it automated would be amazing. The outcome would hopefully look like this:
I am hoping there is a way that I can do two things compare to the previous month and then check it against my table to see where it sits then display the appropriate symbol.
Thank you in advance for any help or a place to start.
So extremely easy to figure out once I looked at it in a simplistic way.
Firstly, I used: =IF(-SIGN(E26-G26)= 0, "n", IF(-SIGN(E26-G26)=1, "é", IF(-SIGN(E26-G26)=-1, "ê","")))
To compare the current number to the previous number and get a 1, 0 or -1 depending on if it had gone up down or stayed the same, using this it either displays é, n or ê. I then set the font on these cells to Wingdings. so they become up arrow, down arrow and a square.
Then I use conditional formatting to colour it based on the adjacent cells value.
No need for a long, complex formula
=IF(A2>A1,"t",IF(A2<A1,"u","v")) - set the font to Marlett

UILabel divides single word

Good day folks,
Actually I'm going crazy, I did everything I could in order to solve this simple problem.
As you see, a simple label in a narrow space causes the single word "Verification" to be separated into two lines which is not acceptable of course.
I know that I could make number of lines only 1 and this will decrease font size, I tried all wraps modules and all fails.
What can I do to display the label as "Verification Process" without any separation of a single word? (I accept even shrinking font size or clipping last word).
The first one is default setting
Does these two settings below meet your needs?
If you are ok with clipping of the words, then you can set the lines property of your label to 1. Or you want to reduce the font size that also can be done using storyboard property inspector. Hope this will help.
please try this.
my testLabel and number of lines equal to 2.
self.testLabel.lineBreakMode = NSLineBreakByWordWrapping;
self.testLabel.text = #"verificaton process";

howto draw a text with alignment centered in simpliest way. (ios , swift)

I would like to draw a text in my custom view at point X,Y with center allignment. In case the text would be "SUGUS", I expect to have the Character G at Point X,Y.
I tried several things with NSString.drawinRect(), where I have to provide the width of the text, which has to be measured first depending on the Fonttype. It worked, but for me thats not a straightforward solution.
I purposely did not add code here, because a first try with code was misleading and I hope someone can help me with a clean simple solution ?

How to adjust the width of a font using the Uniscribe API

Please bear with me, I am new to Uniscribe so I hope this isn't a dumb question but I have been unable to find the solution anywhere else. So, here goes...
I am trying to use the Uniscribe API to reduce the width of a font; that is, given a specific font of a particular height, I would like to be able to reduce the width of each character (and all the relevant spacings) by some user-defined percentage.
I have successfully achieved this without calling any Uniscribe functions by obtaining a LOGFONT structure for the current font and adjusting the lfWidth field to be a percentage of its original value. I realise that this is just an average character width but it seemed to have the desired result.
However, when I try to do the same thing using Uniscribe I've noticed that the lfWidth field gets reset to 0 following calls to ScriptShape(). As a result, all rendered text is output using its original width. I'm at a loss to explain why this is or what to do to get around it.
Does anybody have any idea if it's even possible to do what I am trying to do?
You might want to start here (look at the Generate Glyph Information Section), then lead to this.
Hope it helps!

Resources