Znovupoužití tvarů: rohové kom­po­nenty

Tutoriál
by Rainer Erich Scheichelbauer
cz fr zh

8 July 2023 Publikováno 23 February 2016

Rohová komponentas are pretty much like magic for creating serifs. And not only serifs.

Rohová komponentas are shapelets you can attach to ostrý uzels. Perfect for serifs, they also lend themselves for rounded corners or inktraps, and are a great way to keep these partial shapes in sync across many glyphs. Best of all, they interpolate and export in variabilní písmos. Take this n, například:

All of the serifs are rohová komponentas, which, in Glyphs 3 and later, are represented as blue particles:

Build rohová komponentas

All we need for this is two new glyphs with special naming: A rohová komponenta must start with _corner and have an arbitrary dot suffix. The underscore at the beginning of the name ensures that the glyph will be created as non-exporting. Add two new glyphs, and call them, například, _corner.leftSerif for the left serif, and _corner.rightSerif for the right serif. The best way to do this is invoking the menu command Glyph > Add Glyphs (Cmd-Shift-G), typing _corner.leftSerif _corner.rightSerif, and pressing the Generate button.

But let’s begin with drawing a serif. Our left serif could look like this:

As you can see, the serif is an open path that start vertically, winds counter-clockwise (just like your closed paths), and the last part is on the účaří. The final point in the bottom right needs to be a bit to the right in respect to the first point. The initial vertical movement and the final horizontal movement complement each other to a perpendicular shape corner.

There are also three anchors. You can add the default anchors left, right and origin with Glyph > Set Anchors (Cmd-U) or Set Anchors for all Masters (Cmd-Opt-U):

The origin anchor represents the corner of the host path (onto which the rohová komponenta will be injected later). If you do not have this anchor, you need to move the serif over the left boční přístup, and ujistěte se it winds around the origin point (x=0, y=0), where the účaří meets the left boční přístup.

The left and right anchors are the pivotal points for optical adjustments on non-perpendicular corners. More about that later.

Add rohová komponentas

Now, how do we get our serifs to stick to our glyphs? Easy. Go to your glyph, made of paths and select a ostrý uzel, then klikněte pravým tlačítkem on it to open the drop-down menu, and select Add Corner Component:

In the dialog that follows, select _corner.leftSerif, and voilà, your serif gets injected into the path! Coolio.

For the other corners you can select and copy the corner, select the target node, and paste. Or add again through kontextové menu.

But, oops, what happened here:

Well, it is a left serif, and that is how a left serif fits on a right corner. But don’t despair, because you can select the malrotated serifs and mirror them with one of the mirror buttons in the Transformations panel:

Of course, that is only an option if the design of your serif lends itself to mirroring in the first place. If that is not the case, you may need a _corner.rightSerif, and arrange the anchors like this:

The right anchor is close to the end of the path, the left anchor on the initial segment. Again, take note of the směr cest: counter-clockwise, like most other paths.

Diagonal stems

Corner on diagonal stems are adjusted automatically, by slanting the outermost segment of the rohová komponenta into the angle of the stem:

Your rohová komponenta was drawn perpendicularly, but the two segments in the corner of the v are not perpendicular. So the question is, which segment will the rohová komponenta align to, and which segment will it distort into. Glyphs often guesses right, but not always. V takovém případě, you can adjust the alignment manually, with the four little buttons in the grey info box (Cmd-Shift-I):

  • left arrow: alignment for left serifs or mirrored right serifs. The beginning of the rohová komponenta path gets slanted into the angle of the host path, the end of the path stays straight.
  • right arrow: alignment for right serifs or mirrored left serifs. The end of the rohová komponenta path gets slanted into the angle of the host path, the beginning of the path stays straight
  • double arrow: the rohová komponenta is fitted half way between incoming and outgoing path segment; best for inktraps. Bending will be done along both, the beginning and the end of the rohová komponenta path, along the three anchors, with the origin anchor as pivot.
  • x: no alignment, the rohová komponenta is forced in as is. For special cases only, will typically give you funny results.

So, one side of the rohová komponenta will be aligned, the other will be bent into the diagonal. Can we control how? Yes, we can! With the position of the left or right anchor, respectively:

The anchor serves as pivotal point. Effectively, you get more optical correction the more you move the anchor away from the origin anchor. Your mileage may vary.

Scale rohová komponentas

With slab serifs, you can easily change the scale. Simply write another percentage for the horizontal or vertical scale. Or even better, place your cursor in the scale field, and use the up and down arrows on your keyboard to change the value. Add Shift for increments of 10, Cmd for increments of 100:

But you also see the problem we have here: the rohová komponenta gets distorted with a simple scale. The rounding changes its character, and bracketed serifs will suffer when you scale them. Bummer. We would need something like interpolation for a better result… wait… we can actually do just that. Read on.

Go back to your rohová komponenta. In the Layers panel, duplicate the vrstva masteru, then right click on the layer copy to bring up its context menu, and redefine it as Intermediate. Assuming that the vrstva masteru has a scale of 100% horizontally and 100% vertically, define the mezivrstva as 150% width and 100% height:

And now draw a widened serif, the way it is supposed to look like. Adjust the curvature accordingly, perhaps you want to keep a certain angle the same, whatever is required for your design. In my case, it is a bit more simple:

So now, when you enter a different scale percentage, the serif gets interpolated properly:

Or, add an Intermediate at 150% height, 100% width, and you can scale your serifs vertically without losing the serif thickness, e.g., in the classic example of the right serifs of a high-contrast V:

Inktraps

For inktraps, ujistěte se that end points, handles and left & right anchors are aligned towards the origin anchor. Sounds complicated? Fair enough, here is a picture that says more than a thousand words:

I added guides for clarity. If you leave out left and right anchors, then the origin anchor will be the pivot. Experiment with the positions of points and anchors along the guides. Again, take note of the směr cest. You see, the arrangement of points and anchors does not necessarily need to be vertical and horizontal. The relation between points and anchors is what counts.

For the next step, mějte na paměti that rohová komponentas also work on ‘extra nodes’, the predicted intersection points between two paths. This makes inktraps possible without removing overlaps. To do that, first ujistěte se you turn on View > Show Nodes > Show Extra Nodes:

Select them by Shift-clicking each one of them. Then, again, add rohová komponentas from kontextové menu. Then, experiment with alignments and scales for each rohová komponenta:

And the best thing: you can still move the crossbar up and down, and keep your inktraps aligned properly!

Complex rohová komponentas

You can add any number of closed paths in a _corner glyph to compliment the open corner path. Finally, time for the long overdue return of the page curl:

Směr cests of closed paths will be preserved when mirrored.

Tipy

Sometimes, even rohová komponentas hit a ceiling in their flexibility. Then you need to decompose aby bylo možné make individual adjustments. Select one or more rohová komponentas by (Shift-)clicking on their blue line, then choose Decompose Corner Component from kontextové menu, and you are all set. See the Decompose Corner Components script below for batch decomposition.

You can navigate between _corner glyphs and the glyphs that contain them. Select a placed rohová komponenta and click on the little circled arrow in the grey info box, next to the name of the rohová komponenta, to open the _corner component:

While we’re here, click on the name directly to replace the rohová komponenta. Just like you would do with a regular component.

Inside a _corner glyph, you can choose Show all glyphs that use this glyph as a component from kontextové menu:

Access all rohová komponentas at once by repeatedly pressing Cmd-A for selecting all:

V tomto případě, Select All cycles through: all paths, all paths and anchors, all rohová komponentas, all anchors. Once you reach all rohová komponentas, you can convenietly get rid of all of them at once by pressing the Delete key.

In a _cornerglyph, you do not necessarily need to keep your first or final path point beyond the pivot anchors. Například, this is how you can do the top serif in the n:

Once inserted, the missing segment will be completed automatically:

Useful scripts

In the mekkablue scripts, there are a few scripts for corner (and cap) components:

  • Propagate Corner Components: will apply the rohová komponenta setup of the current master to all other compatible layers in selected glyphs. This way you only have to set up your components once, then run the script. Also useful for keeping a glyph with rohová komponentas compatible for interpolation.
  • Remove Detached Corners: sometimes it happens that a rohová komponenta is not attached to a node anymore. This script finds those situations, reports them in the macro window, and removes orphaned rohová komponentas.
  • Find and Replace Corner and Cap Components and Find and Replace Corner and Cap Components at Certain Angles: will give you a user interface for batch-replacing rohová komponentas.
  • Decompose Corner and Cap Components allows you to batch-decompose rohová komponentas in many glyphs at once.


Update 2022-07-26: updated title, related articles, minor formatting.
Update 2023-07-07: rewrite for Glyphs 3.2.