top of page

Line Spacing in SubStation Alpha

SubStation Alpha. This subtitle format, beloved by fansubbers and largely ignored by professionals, gives you full control of your subs’ presentation style. By adding special tags directly to subtitle text, you can customize its appearance in any way you like. The list of possibilities is truly endless, and proficient SSA users can create something as fancy as this:

A bit too flashy to be used outside of karaoke, but it’s a good example of how far you can go with this format.

Advanced SubStation Alpha (abbreviated, amusingly, ASS) is an update to SSA that offers even more flexibility in styling. It is the version used nowadays.

Now, the best thing about this format is it’s absolutely free to use. In the industry, we employ expensive subtitling software coupled with a keyer or an authoring tool to create nice-looking subtitles. With ASS, however, you only need a free program that supports the format and the technical knowledge of how to use the tags and how to encode your subtitles.

Even with such a powerhouse as EZTitles Enterprise at my fingertips, I still find use for SubStation Alpha in everyday work. Three of my direct corporate clients love neat captions in their promotional videos, and so I can oblige without resorting to tools like Adobe Premiere, Avid Media Composer or Final Cut Pro:

Yes, some businesses do care about the aesthetics — and I capitalize on that.

A note of caution

The ASS format has a whole host of problems, which is why it’s not standardized in the industry. Most importantly, its timing format uses centiseconds rather than frames or milliseconds, so when you import from or export to ASS, the round-off errors will sometimes push your timecodes over to the adjacent frame, spoiling your minimum intervals, shot change gaps, durations, etc. This can be avoided if you work around it carefully, but, unless you know exactly what you’re doing, it’s better to use something else for certain projects.

The Style Tags

 

As mentioned above, styles in Advanced SubStation Alpha are created via special tags, and there are a myriad of them to choose from. For example,

  • \b1 makes your text bold;

  • \fsp changes the letter spacing;

  • \fad produces a fade-in and fade-out effect;

  • \pos(x,y) positions your subtitle at the video’s x and y coordinates;

  • \frx, \fry, \frz rotate your text along the X, Y and Z axes correspondingly.

And so on and so forth — there are more than 50 tags in total. If you can’t achieve the desired result with just one tag, a combination of them, which you put inside a pair of curly brackets, will do the trick. For instance, the following line will produce a yellow subtitle in the Tiresias font size 24:

{\fnTiresias Infofont \fs24 \c&H00FFFF&} Subtitle text.

Also, there are two special characters in SubStation Alpha:

  • \h inserts a non-breaking space;

  • \N inserts a line break, so that the text that follows it goes to the next line.

Make sure to remember these, because they will be relevant later on.

Line Spacing

If you’re a subtitler who’s worked with ASS tags for a number of years, chances are, at some point you asked yourself this question:

“Um... How do I change the vertical gap between lines?”

That gap is called “line spacing”, and what you want to achieve looks like this:

It’s a simple transformation, but, unfortunately, SubStation Alpha does not have a dedicated tag for it. From brief research, I found that quite a few people struggle to find a simple way to adjust the line spacing — and that’s why I decided to write this article.

Why It Matters

Now, you can ask:

“But why change it? Does it matter that much?”

Well, yes, it does. Here are some of the reasons:

First, in some fonts and typefaces characters from different lines will occasionally touch each other due to the tight default spacing:

This, I imagine, makes your subtitles not only look bad but also read bad.

Second, even if the default gap is fine, style effects such as shadow or outline can still touch or even overlap:

Third, if you increase the size of transparent boxes, they also start to overlap:

And finally, in some cases the opposite is the problem: the gap is too wide to begin with, and you want to bring the lines closer:

These issues can be fixed by slightly adjusting the gap between the lines, which, as mentioned previously, is no trivial task.

Requirements For An Ideal Solution

 

The problem with finding an ideal solution for this puzzle is that of compatibility, and it is twofold:

 

First, the solution should be compatible with all kinds of subtitling and authoring tools, so that they can import your ASS subtitles with no issues. The import should work smoothly for various programs that

 

  • Remove all your tags from the subtitle text upon import;

  • Only retain the simple tags that they understand (e.g. \b1 for bold);

  • Retain all the tags.

 

Hence, the subtitle text should not be changed beyond adding tags. You can’t add characters; otherwise, the software that removes all tags will end up with corrupted subtitles.

Second, the solution must be compatible with various renderers — like LibASS and DirectVobSub — so that your subtitles look the same in all media players.​ The more complicated the solution is, the more likely it is that different renderers will treat it differently, so it should be as short and simple as possible.

The Journey to Ideal Solution

Now, let’s explore the existing solutions to this riddle. But before we do that, if you have worked with the tags, I want you to try and see if you can, on your own, find a method to change the gap.

...

Done? Okay, let’s go.

Method 1: Splitting

So, how would you tackle this problem? If you’re inexperienced in all things ASS, you would probably opt for the obvious solution — splitting each two-line subtitle into two one-liners and then moving the upper one with the \pos(x,y) tag:

This well-known approach is rather poor: not only do you butcher your subtitles, but you also make them unusable in the tools that can’t properly display multiple subtitles appearing at the same time. So, no import compatibility.

Method 2: A Third Line

If you’re a seasoned ASS user, you probably know of a better solution — inserting a new line between the original two and then changing its vertical size. How? You do it by adding the invisible character \h to the new line and adjusting its font size via the \fs tag:

Your subtitle text will look like this:

 

This is the first line,\N{\fs40} \h{\r} \Nand this is the second one.

Here, \r resets the style for the text that follows it, so that your second line does not have the huge font size.

A less disruptive solution, but it still adds a third line and a new character to your subs, which doesn’t work well with the programs that remove your tags. Again, no import compatibility.

Method 3: Double Whammy

 

Those who’ve mastered ASS take it a step further and do away with the additional line. The trick is to add non-breaking spaces before and after the first line and then change their font size. This will move the line upward and increase the spacing:

Here’s the subtitle text:

 

{\fs80} \h{\r}This is the first line,{\fs80} \h{\r} \Nand this is the second one.

Now, apart from the tags, we only add a couple of hard spaces. They’re invisible and can be removed in a couple of clicks by Replace All, so it’s an improvement to the previous method. The problem is, not all programs have this feature, and some don’t recognize the special character \h, treating it as regular subtitle text. Yeah, I’m looking at you, EZTitles. So, as far as full compatibility goes, still no cigar.

Method 4: Rocket Science

Now we’re entering uncharted territory, since I’ve not seen the following method used anywhere. After fooling around with ASS tags for some time, I stumbled upon a solution that doesn’t require any additional characters. It is rather technical and convoluted, so bear with me. Here’s how it works:

1. You move the point of rotation origin up and left, like this:

2. You rotate the first line 45 degrees around the point of origin:

3. You shear the rotated line 45 degrees along its X coordinate:

4. You shear the rotated line 45 degrees along its Y coordinate:

5. You multiply the first line’s original font size and outline size by 0.707 — which is cos(45°) — and voila:

You have your line gap. Phew! That’s geometry for you!

 

The subtitle text, then, goes like this:

 

{\org(A,B)\fr45\fax-1\fay1\fs20\bord4} This is the first line,

{\r} \Nand this is the second one.

This method, even though import-friendly, will surely give some renderers a hard time. Plus, the math behind calculating the correct \org coordinates for the desired line spacing is so difficult that we can consider this method entirely impractical.

However!

Method 5: The Ideal Solution

By sheer accident, I found a way to simplify the approach described above. While moving around the rotation origin point, I somehow tossed it outside the screen. And then, in a eureka moment, I thought, “Wait a minute... What if I move it really, really far away? Will that work?” — and, much to my delight, it did!

The logical chain runs as follows:

Origin point further away → larger rotation radius → smaller angle to rotate to get the desired line gap → less shearing required → less font size change required:

As the radius approaches infinity, the amount of shearing you’ll need approaches zero, which means we can throw away \fax, \fay and \fs altogether. Of course, we can’t make the radius infinite, but the thing is, we don’t really need to — due to the discrete nature of the computer screen, we only need the shearing to be less than a subpixel, and then our subtitle text will not be angled. For videos up to Full HD, using \org(-2000000,0) is a safe bet:

Going beyond 2 million pixels can make some renderers produce visual artifacts.

So, here’s the text for the subtitle above:

 

{\org(-2000000,0) \fr0.001} This is the first line, {\r} \Nand this is the second one.

I tested this method on multiple tools, renderers and configurations and didn’t encounter any issues. Success!

Conclusion

My final, fully compatible solution, therefore, is this:

 

{\org(-2000000,0)\fr<value>} Line one, {\r} \Nline two.

All you need to do to get the desired line spacing is adjust the \fr value. If you want to bring the lines closer, just make the value negative.

So, there you have it. If you know of other methods to change the line gap, please let me know in a comment below.

Cheers!

bottom of page