I'm filling a table with different size text (left column Helvetica 6pt, right column Times 8pt), but the baselines of the texts do not align - the left text is visibly higher than the one in the right column. How do I get it nice? Using FOP 2.1.
One way would be to add line-height=... but then what value would I have to set line-height to in order to get the same vertical spacing that I have now?
Isn't there a more generic way?
<fo:block-container position="absolute" top="27mm" left="125mm" width="75mm" font-family="Times" font-size="8pt">
<fo:table table-layout="fixed">
<fo:table-column column-width="2.7cm"/>
<fo:table-column column-width="4cm"/>
<fo:table-body>
<fo:table-row>
<fo:table-cell>
<fo:block margin-top="12pt" font-size="6pt" font-family="Helvetica">Contact:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block margin-top="12pt">Normally me</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="6pt"> </fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>Manager</fo:block>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
<fo:table-cell>
<fo:block font-size="6pt" font-family="Helvetica">email:</fo:block>
</fo:table-cell>
<fo:table-cell>
<fo:block>dings#bums</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
</fo:block-container>
Speaking typographically and for the situation you're describing, if you want both columns to share the same baseline, your larger typeface, the 8-point Times Roman, should be the one to set your line spacing (or leading), not your smaller one.
8-point Times expects a default leading of 8 points from one baseline down to the next one. Any less than that and its descenders from an upper line risk crashing into ascenders on a lower line; thus you can't reduce its linespacing to match the 6-point Helvetica next door.
If the left text comes out higher than the right, it's presumably because the glyphs are positioned by dropping down to a baseline first, then placing the text. Thus the 6-point Helvetica drops 6 points before setting; the 8-point Times drops 8 points before setting, and you're looking at a misalignment. Determine which of your columns will have the largest leading value, set your other column(s) to match it by adding the appropriate amount of inter-line leading, and that should keep things in alignment with each other. (Your smaller faces are still going to look rather whitespacey, however; you might consider just boosting them to match the largest point size in that table row.)
More research and a comment putting more light: line-height="inherit"
<fo:block font-size="6pt" font-family="Helvetica" line-height="inherit">
in all the blocks of the left column
does it in this case without specifying an explicit line-size anywhere.
Related
I've been searching around for how to understand how to generate a bar code and haven't found any useful information.
Basically, a bar code has these features:
Black bars of different widths.
White bars of different widths.
I would like to know what the specification is for the widths of the bars. That's it. I can find information regarding the data to put into a bar code. I just haven't found any information on how you translate some arbitrary data into the different black and white bars of different widths. I would like to know how many different widths there are as well (for each black and white bars).
The USPS supports both Code 128B and Code 39 barcodes. For international mail it is recommended that you use Code 39. The different symbologies (of which, Code 128 and Code 39 are but two examples) use very different encoding methods and so the answer for how a number "8" is made, for example, is dependent on the symbology selected.
In order to know what the widths of bars and spaces there are for each character, you need to know what symbology you are talking about first. After that point, Wikipedia is your friend. A good tip here is not to think of them in terms of widths, but as ratios.
The dark and light areas of a barcode are proportional to one another because it is impossible to know how far away the scanner will be from the printed code. So you don't want software that measures black bar widths or white spaces in terms of millimeters or even pixels. Instead you want to imagine the ability to print the tiniest barcode as dots and then use your printing mechanism to scale.
For example: the Code 39 representation of the number "8" is a thick bar followed by a thin space followed by a thin bar followed by a thick space followed by a thin bar followed by a thin space followed by a thick bar followed by a thin space followed by a thin bar followed by a thin space. That's almost as painful to read as it was to write.
So to avoid all that, I just think of the ratio between thin and thick for Code 39 to be 1:3 and use ones to represent bars (black dots) and zeroes to represent white spaces. In that context, a Code 39 number "8" looks like "1110100010111010". There is no sense trying to figure out widths in microns or millimeters or angstroms. You can put a barcode on a tardigrade or a corn field if you have the right equipment. The widths will change, but the ratios will not.
To illustrate I have used our Code 39 number "8" as an example:
<table><tr><td><span><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/AQD/AAAAAAAAAAAAAP8AAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAARVICA/z3WM0AAAAASUVORK5CYII=" width="30" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/Af//AAAAAAAAAAAAAAEAAAD/AAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAajEDAm49ReYAAAAASUVORK5CYII=" width="30" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/AQD/AAAAAAAAAAAAAP8AAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAARVICA/z3WM0AAAAASUVORK5CYII=" width="30" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/Af//AAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAUS0CAuSD38gAAAAASUVORK5CYII=" width="30" height="70"></span></td><td width=150px>
The barcode on the left is five times wider than the one on the right. (same code)</td><td>
<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/AQD/AAAAAAAAAAAAAP8AAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAARVICA/z3WM0AAAAASUVORK5CYII=" width="6" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/Af//AAAAAAAAAAAAAAEAAAD/AAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAajEDAm49ReYAAAAASUVORK5CYII=" width="6" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/AQD/AAAAAAAAAAAAAP8AAAABAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAARVICA/z3WM0AAAAASUVORK5CYII=" width="6" height="70"><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAACCAQAAADLaIVbAAAANUlEQVQIHQEqANX/Af//AAAAAAAAAAAAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAAAAAAAAAAUS0CAuSD38gAAAAASUVORK5CYII=" width="6" height="70"></td></tr></table>
i have a TableViewCell and i want it to contain 2 labels both centered vertically in the cell, one at the left border and one at the right border(with respective text alignment). Now the right one should remain 1 line(its only a number with max 6 digits), but if the left one gets too big and would overlap the right one, i want it to make line breaks.
Now i've tried different approaches, for example i first added the right one and gave it the constraint "trailing space to superview = 0" and "center vertically in container".
Then i added the other one, gave it the constraints "leading space to superview = 0", "trailing space to rightLabel = 0" and "center vertically in container" and set lines to 0.
But that didn't work, it didnt make line breaks and overlapped the right label.
How can i achieve that?
You need to set the correct content-hugging and compression-resistance priorities (by default they have the same value), that's why the system doesn't know which constraint to break.
Try changing the content-hugging and compression-resistance priorities so that they are no longer equal. The system breaks the constraint having the lowest priority first.
Select the label. Open the Size inspector, find the Content Hugging Priority and Compression Resistance Priority settings. Change priorities.
I'm trying to use Susy but I can not create a desirable grid. I want a fixed gutter grid with the gutters coming after the element, not before. I couldn't get that to work. It seems that no matter what I do the elements are too large and the last column falls to the next line.
See this gist:
http://sassmeister.com/gist/6ebf5ec14f697f8d137c
In this basic three column layout each 1/3 width column is over 35% wide. What am I missing?
I only see width: 28.57143%; in your sassmeister output. The problem is actually caused by your border on all the elements. That adds several extra pixels to the layout, forcing it to break. You can either remove the borders, or add box-sizing: border-box so that borders no longer add to the element width. Susy has a border-box-sizing mixin that will apply that globally, if you want.
I have 2 labels that are stacked and have a bottom space constraint to their common container. I want to hide the lower label if there's no value for it and move the upper label down to the lower label's position. I can do that easily with an outlet bound to the bottom space constraint for the upper label.
The problem here is that these labels have different font sizes. So, when I set the same value for the bottom space constraint for the upper label, like I have set for the lower one, the upper label does not end up at the same vertical position.
I assume this is because these labels have different descenders, due to different fontsizes. It would be easy to solve that if I could set the bottom space constraint not for the frame of the text, but its base line. I'd like to do this in IB, if possible.
I don't think it is possible to set a constraint to the strings baseline. Your comma is way bigger in your upper label, thats why the numbers don't sit at the bottom of the label. If you make the label smaller, you cut those commas of.
I see two solutions here:
Leave it that way.
Set the constant of your constraint to something lower than 0 (I guess -2 to -5) so that your numbers perfectly align with the smaller label.
This is the Line i'm using:
<s:Line x="25" y="22" width="42">
<s:stroke>
<s:SolidColorStroke color="black" weight="2" />
</s:stroke>
</s:Line>
The result is a black line with width 44 and two gray pixels on each end of the line (the top pixels of the two vertical are gray).
How can i make the line 42 pixels in width and without gray pixels?
The current solution i've found is to use two lines one over the other like the one above with weight="1" but i hope there is a better one :]
Thanks in advance,
Blaze
A friend of mine just told me the answer. He doesn't have an account here so i thought it would be helpful to post his answer here.
<s:stroke>
<s:SolidColorStroke color="black" weight="2" caps="square"/>
</s:stroke>
That caps property is round by default.
P.S. To the moderators: please remove the whole question if you think it has no value. It's not an attempt to get points by my own answers :]