The Bounding Box and Glyph Design Rules

Before asking a question on FontCreator look here for possible solutions and tutorials. Please do not post support requests here.
Post Reply
Dave Crosby
Typographer
Typographer
Posts: 793
Joined: Mon Feb 23, 2004 1:13 pm
Location: Enoch, Utah

The Bounding Box and Glyph Design Rules

Post by Dave Crosby »

For your font to function, computers have to:
  • 1. Load the font and feed it to the rasterizer.
    2. Scale each glyph outline to the correct point size for the correct resolution of the screen or printer.

    For the Screen, the computer must then:

    3. Build a grid fitted bit-map outline for each glyph.
    4. Fill the grid-fitted outline with pixels, creating a raster bitmap.
    5. Apply grayscale or hints (directions to shift contours to get a better grid fit) to the outline
    6. Scan for dropouts (Pixels that fail to turn on. -optional).
    7. Cache the raster bitmap for the next time the font is used.
    8. Transfer the raster bitmap to the screen when that character is encountered.
Different steps must be taken for the printer and not interfere with the above screen instructions.
The things that can go wrong in a font can easily be counted on the fingers of ten thousand people.

Confusing yes, but thankfully not your problem.

Back to the Small Picture, your glyph.
Font Creator has already taken care of all the Big Problems like Glyph I. D. -Unless you mess with the Mapping.
All you have to do is design the glyph so people and computers (screens, and printers) can recognize it.

Therefore you should be aware of the fact that The TrueType Scan Converter takes the outline description of a glyph that you make and produces a bitmap image for that glyph.
If half or more of a pixel falls within the Clockwise Contour, That pixel is turned on.
If half or more of a turned on pixel falls within a Counter- Clockwise Contour, that pixel is turned back off.
Special rules are applied for either Gray Scaling or Hinting.



Image

Microsoft states the rules this way:
Bitmap Rule 1. If a pixel's center falls within the glyph outline, that pixel is turned on and becomes part of that glyph.

Bitmap Rule 2. If a contour falls exactly on a pixel's center, that pixel is turned on.

To prevent dropouts (failure of pixels to turn on -DC), type manufacturers can choose to have the scan converter use two additional rules:

Bitmap Rule 3. If a scan line between two adjacent pixel centers (either vertical or horizontal) is intersected by both an on-Transition (Clockwise) contour and an off-Transition (Counter-Clockwise) contour and neither of the pixels was already turned on by rules 1 and 2, turn on the left-most pixel (horizontal scan line) or the bottom-most pixel (vertical scan line)

Bitmap Rule 4. Apply Rule 3 only if the two contours continue to intersect other scan lines in both directions. That is do not turn on pixels for 'stubs'. The scanline segments that form a square with the intersected scan line segment are examined to verify that they are intersected by two contours. It is possible that these could be different contours than the ones intersecting the dropout scan line segment. This is very unlikely but may have to be controlled with grid-fitting in some exotic glyphs.

The type manufacturer can choose to use the simple scan converter employing rules 1 and 2 only or may optionally invoke either rule 3 or rule 4. The decision about which scan converter to use can be made on a font wide basis or a different choice can be specified for each glyph. The selection made in the preProgram will be the default for the entire font. A change made to the default in the instructions for an individual glyph will apply only to that glyph.
The Only Problems you have to watch out for are:

Global off-curve extreme points. Intersecting contours. Contours with confusing (knots or back-tracking points) or incorrect directions. Contours starting (First Point) with an off curve point. Contours that (partially) lay outside the visible glyph area.

Erwin Denissen suggests:
Make sure all off-curve points are inside the global bounding box. I shouldn't worry about local off-curve extreme coordinates, but in my opinion a professional font should be without those as well.

Most software searches for and locates the four extreme on-curve points of the outside contour and identifies them as being the left and right sides, top, and bottom of the glyph.

Well some software just take 4 extreme points, and doesn't bother to check if they are on curve. Then a glyph is positioned too much to the left or right, ... or better explained, the left and right side bearing are offset to the left or right."
Think of your computer as being a blind person trying to discern your glyph.

The software searches for and locates the four extreme on-curve points of the outside contour Erwin mentioned and identifies them as being the left and right sides, top, and bottom of the glyph.

The rectangle they form is known as “The Bounding Box” or b-box.
That is the basic structure from which your glyph will be carved by the on and off-curve points you add.

To see the b-box, open any glyph editing window in contour mode and press W.
That’s it, the dashed line that appears around the glyph.
Continuing to press W (or Q to go the opposite way) will advance through all of the contour bounding boxes in glyphs containing more than one contour.

Sometimes during construction, contours get out of order. Check to see if the outer contour is number 0 -shown at the bottom of the screen. If not, Right-Click in the contour and select Order from the pop-up.

Image Image

Or select “Add Bounding Guidelines” if you want to see the guidelines in Point Mode.
This also works for inner contours.

To get rid of them you may drag them off one at a time or select Tools > Guideline Options > Clear > OK.

Image Image

Making glyph adjustments by moving those on-curve points will change the bounding box, even perhaps switching to a different point if the old point is moved toward the center of the glyph.

Problem #1. Sometimes an off-curve point appears beyond the bounding box.
Any off-curve point beyond the outer contour b-box can be a problem for software.
This problem exists in many fonts (even commercial) that seem to be functioning, so ...
How Bad of a problem is it?

The answer must depend on the software it is used in.
Some programs are fairly tolerant, others are not.
In Circle Secrets, I opined that it is probably worse for an off-curve point to be out of bounds in two directions.
This is still just an opinion.

Through early personal experiments with FC v3, I learned that moving them very far from the boundaries quickly produced “Out of Range” Errors.
Erwin has resolved that problem for FC, but it can’t be good for your font.

So How bad a Problem is it?
At best your character may not align properly with the rest of your font.
At worst your font could be rejected as defective by some applications (See Panose), and replaced by some other font.


Rule #1. Keep all off-curve points within the glyph bounding box.
Why tempt fate?
FC Real-Time Validation (F7 or View > Toolbars > Validation) turns them red and identifies them as “Off-Curve Extreme Points” so you can find and fix them as they appear.

A good design habit to honor is to always (except at terminations) center an on-curve point (the curve contact point) between two off-curve points perpendicular or parallel to each other when forming curves.
An amazing variety of curve shapes can be formed by changing the spacing between the points themselves and adjacent curve segments.

Did you ever notice that straight perpendicular and parallel lines NEVER have any pixel jags?
Moving an on-curve point on an angled line may ameliorate those (ugh!) necessary pixel jags to some extent.
Moving an off-curve point here and there may also help.

Be sure Grayscaling is turned on to feather the edges so they aren't so obvious.
If you are a glutton for punishment, learn how to do hinting.


Problem #2. Sometimes Contours Overlap, creating ambiguous areas. The Rasterizer may not be able to answer the question “Should these pixels be turned on or not?”

Rule #2. Do not permit Contour Overlap.
Especially when a point from one contour is exactly on top of a point from the other contour ... Which path should be followed?
In contour mode either move the contours apart, or select both contours and “Get Union of Contours.”

Problem 3. Sometimes the numbered points of a contour get out of order (often as the results of using Glyph transformer), back-tracking or forming knots. The Rasterizer can become confused. "Is this a clockwise or counterclockwise contour?"

Image

Rule #3. Correct all Contour ambiguities.
In Point Mode, press W or Q to step through the points to find and fix the problem.
In complicated glyphs use the Glyph Validator to quickly get to the problem point(s).

Problem 4. Sometimes the first point in a contour becomes an off-curve point.
This can be a big problem for some software.

Rule #4. Make sure the first point in a contour is an on-curve point.
Select the point you want, right-click, and chose “Make First Point” from the pop-up.
I prefer the nearest to the Origin on-curve point, but that is not necessary.

Problem 5. Sometimes parts of glyphs are cut off on the screen or printed page.
This does not bother printers or screens, but it may puzzle people trying to read them.

Rule #5. Be sure the glyph fits between Win ascent and Win descent.
Either make the glyph smaller, or change Win ascent and or Win Descent.

Problem 6. Sometimes glyph elements appear to merge with other elements or turn grey or even disappear completely.

Rule #6. Check for proper segment spacing before final approval of the glyph.
Press the Test Font button and look at the glyph at the smallest size you wish to read it. Remember, moving a few points one way or another turns on and off new pixels and may make a dramatic improvement in the readability of the glyph at that size. Only hinting will help at other small sizes, but if it looks good at that small size it will always look good at larger sizes.

Your Glyph is now good to go, :idea: but if you are a perfectionist ...

Remember Erwin wrote: "I shouldn't worry about local off-curve extreme coordinates, but in my opinion a professional font should be without those as well.”


A million years ago when I first wrote Circle Secrets, I mentioned that making circles with all off-curve points were not a problem "if you reversed the contour direction and placed it inside another contour," with the disclaimer “Why this is so, is way beyond my paygrade (Which didn't take much. My paygrade is Zero as I am retired).”

Well, I didn’t know about Local Validation Detection.
Select Tools > Options > Validation > Local Detection

Image

And now you can follow rules 1-6 all over again on all those internal contours and curve segments.

You may also wish to go to a good glossary
and get down into the nitty-gritty stuff and things.

Image

http://scripts.sil.org/cms/scripts/page ... d=Glossary
glyph ID — the unique number within a font identifying a single glyph.

glyph outline — a series of curves describing the shape of a glyph. The renderer will fill in this outline to make a solid glyph appear.

glyph — a shape that is the visual representation of a character. It is a graphic object stored within a font. Glyphs are objects that are recognizably related to particular characters and which are dependent on particular design (i.e. g, g and g -{from different fonts -DC}are all distinct glyphs). Glyphs may or may not correspond to characters in a one-to-one manner. For example, a single character may correspond to multiple glyphs that have complementary distributions based upon context (e.g. final and non-final sigma in Greek), or several characters may correspond to a single glyph known as a ligature (e.g. conjuncts in Devanagari script). (For more information on glyphs and their relationship to characters, see ISO/IEC TR 15285.)
Aut nunc aut nunquam
Post Reply