
CHAPTER 3 Layout
Glyphs define their origins by specifying "alignments" relative to their span in a given dimension. The upper-case G, for example, has a vertical alignment of roughly 0.1, because its vertical origin falls near the bottom of its span. The lower-case g has a vertical aligment of 0.4, since its origin is four tenths of the way between the lower and upper edges of the span. The quotation mark has a negative alignment (of approximately -1.0). This is because its origin is well below the bottom edge of its span.
Figure 3-5 illustrates how a rectangle positions with alignments of 0.0 and 1.0 in both dimensions. 
Let's examine how alignment came into play for composing the panner and scrollbars above. As shown in figure 3-6 below, the top of the vbox (which is also the top of the panner) aligns with the top of the vsrcollbar. This happens to be just the right effect. Since the tops are aligned, we can apply our new knowledge of alignment and infer that both the vbox and vscrollbar have vertical alignments of 1.0. Perhaps you can imagine how the composite would look had these two components instead requested alignments of 0.0. In this case the bottom of the vscrollbar would align with the bottom of the hscrollbar, and the layout would look all wrong. Clearly we are "lucky" that the vbox and vscrollbar both requested alignments of 1.0. But why is this so? (Wouldn't a more obvious choice for a requested alignment be zero?)
In fact most glyphs (such as panners and hboxes) do request zero as their alignment. The reason we got "lucky" is that vboxes (the vscrollbar happens to be built using a vbox) always request vertical alignments of 1.0. But this begs another question: why should vboxes request alignments of 1.0?
The answer to this second question can be seen if we look at boxes from a historical perspective. Fresco borrows boxes from Knuth's TeX document preparation system1 developed in the early 1980's. Since the beginning, then, boxes have been used to compose characters into lines. Since boxes can also be used to compose lines into columns, and columns into pages, figure 3-7 should give an understanding of why a vbox would want to request a 1.0 alignment--text columns want to be aligned along their tops.
Generated with CERN WebMaker