SIFR 3 text resizing to fit width - sifr

I'm using sifr 3 and trying to fit h1's on a single line but within a set width of 400px. By default, if there's too much text, it drops onto the next line. I've used forceSingleLine: true but then the text just stretches across the 400px width. Is there a method which will resize the text to fit in the width AND stay on a single line?
Thanks

This was the behavior of sIFR 2, which resulted in inconsistent font sizes. This has been fixed in sIFR 3, so what you're trying to achieve is only possible in sIFR 2.

But what about the sIFR3 attribute "fitExactly", then?

Related

Align two UILabel texts

I would like to align the start of the text of two UILabels. I aligned the two UILabels (with the yellow and grey background) and used sizeToFit: to shrink the UILabels to the content but the text is not perfectly left aligned. There is a gap on the left. The gap is bigger or smaller depending on the first character. I would like to align the red lines in the following picture. There is even a small gap with the small font in the grey UILabel but it's barely visible.
With the Z character the gap is smaller but still visible by the yellow area left to the Z
A simple UILabel alignment does not help for my specific problem, because the text content is dynamic and not static. So there could be any combination depending on the data I get from the backend. Therefore I was hoping for a UIFont or UILabel attribute that could return the size of the gap based on the current rendering of the text.
I know that there are great UIFont related attributes like baseline, capHeight and ascender one can access to align text but there seems to be no attribute that would return the value of this gap on the left.
If this doesn’t need to be two UILabels, you could have one with attributed text. Then both lines would be subject to the same layout.
I haven't tried the GUI which people have been posting Screen Shots of, however... the behaviour is consistent with the very nature of typography.
The font sizes are completely different, therefore the width of an em is different, subsequently the letter-spacing is also different.
See this: http://www.w3.org/WAI/GL/css2em.htm for more information.
I know this answer doesn't give you what you have asked for, however it should explain why this is happening.
For customisation such as this (if HTML and CSS) I would use a negative / positive margin on the sub text, however seeing as you are using backgrounds use padding (or the equivalent in your GUI).
Use attributed text of UILabel
set indentation as per your requirement
ref screen shot
Select both the labels and add a constraint called align leading edges.

iOS: Modify a font height, width, and spacing independently when creating PDF

In an iOS app I need to use a specific font but each character needs to be taller, thinner, and the spacing closed up to fit correctly. Is it possible to stretch/squish a font programmatically?
When you're adding text to a PDF file there are multiple ways to influence how the text is going to appear. The most generic way (and the way that might actually be sufficient for you) is to scale the text matrix:
void CGContextSetTextMatrix ( CGContextRef c, CGAffineTransform t );
As mentioned in the comment by #mkl, you can provide a matrix that will scale up in the Y direction while scaling down in the X direction. The effect will be that the letters are stretched out vertically and squished horizontally.
Normally I would expect you don't have to touch the spacing in that case, as spacing will be "squished" together just as the other characters.
Just in case that isn't sufficient, PDF actually does provide a way to change the spacing between characters too:
void CGContextSetCharacterSpacing ( CGContextRef context, CGFloat spacing );
While Apple's description talks about "additional space" to add between characters, the PDF specification and I suspect Apple's implementation as a result allows the spacing value to be both positive and negative. A negative value would have the effect of moving the characters closer together.
Seems like the best option would be to create your own custom font.
You are able to change the kerning of your font (the space between the letters) and the thickness/thinness of the font, however you probably aren't able to edit the height of the font, unless you edit the bounding box the font is inside of to scale the letters differently.
You might also want to consider using a different font...or if you're REALLY hardcore you can edit the font yourself using photoshop/illustrator.

What is the optimal icon size for XPages Mobile Control line items in views?

I have been adding icons to my mobile control Line Item controls and haven't quite figured out what the preferred size of these icons should be. The CSS has max size settings of 35 by 35px.
The reason I ask this is because the icons don't seem to line up correctly. The CSS positions them at 0 0. If all else fails I may modify CSS and position them to something other than 0 0.
Still interested in hearing how you have dealt with this.
In the teamroom template, the mobile view for Recent Activity has icons that line up with the text. All these images are 16 X 16px.
There will never be 1 fit for all, the layout will be dependant on font size, row height and where you want it to line up. Some people may want it to align in the middle vertically and others will want it to align with the title in the row.
I would say 21px x 21px. but that depends on what font-size you are using.
Icon size can depends upon the applicaton. Normal size is 32x32 and an extended icon size is 64x64. If you want to line up the icons, you might have to change the icons to a standard size.

how to change jquerymobile ui-blocks height and width

am using jquerymobile for representing a two column radiobuttons in my project, the problem am facing is the contents of the block-a is lengther than the contents of the block-b so am getting a difference of div size the output is at (http://i40.tinypic.com/r0tt85.png) if u can lookat my out put the second question 6th option is small when compare to all the other ones the block size is based on the content how can i make same size for all the blocks without based on the content any help please needed
If you want all blocks to be the same height, you can set the height in CSS:
.ui-bar {
height: 100px !important;
}

How do i get sIFR 3 to align right and use the full width

Well like i stated in the title, i cant get sifr to align right and use the full width of the containing h3 tag. Aligning text to the right works well, but i want the text to be on 1 or 2 lines instead of 3 and how it looks the text should perectly fit on 1 or 2 lines :/.
Link: http://hendriks.adena.nl/preview/html/?p=kerst
Anyone got any thoughts on this problem?
Niels
The issue is that the width of the sifr elements is determined based on the width of the original text content that is in the a tags within the h3 tags (check your page with javascript off to see the difference in width).
So one simple solution should be to give these a and/or h3 an explicit width - my guess is that sifr will use that with. (Maybe you can also use 100%, I'm not sure about that)

Resources