Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to typeset multiple layers of text outlines (borders)? #692

Closed
fzh0627 opened this issue May 11, 2023 · 5 comments
Closed

How to typeset multiple layers of text outlines (borders)? #692

fzh0627 opened this issue May 11, 2023 · 5 comments
Labels

Comments

@fzh0627
Copy link

fzh0627 commented May 11, 2023

If I want to use libass to achieve the style of multi-layer subtitle outlines, how should I design the ass protocol?

I would like to ask what advice you have sincerely.

@TheOneric
Copy link
Member

Can you post an image of the desired effect?

Generally speaking, available options depend on your usecase. Are you authoring ASS subtitles for distribution, or are you using libass only internally within your program and any generated ASS is transient and never visible to the outside?

@fzh0627
Copy link
Author

fzh0627 commented May 15, 2023

Thanks for your reply~
image
This is what I expect to achieve. This part will only be used internally within our program.

@TheOneric
Copy link
Member

TheOneric commented May 15, 2023

The inner black outline in your image has a directional bias with it being thicker on the right and lower site than on the left or upper one (and non-zero everywhere). This doesn't have a direct equivalent in ASS, but you might be able to get a similar result by combining a small border and shadow of the same colour.

As for the general setup with an outer and inner border(+shadow), you can duplicate the same text into two events on different layers. For the back layer set border and primary colour to the same value, disable shadow and set a large border. For the top layer set border (and shadow) to a different colour than in the back layer and use a smaller border and/or shadow value.
If the events are implicitly positioned, add an extra glyph from the same font to both layers and apply the highest used border value and use {\fscx0} to hide it. This will make both layers behave the same in collisions. If an event has multiple lines of text, you need to do this for both the top and bottom line of the event.

This approach is also suitable for authoring ASS tracks for distribution.

E.g. here is an example with different settings for the inner black outline/shadow. From top to bottom it uses (a) only shadow, (b) only border and (c) a thin border and additionally a shadow:
grafik

[Script Info]
ScriptType: v4.00+
WrapStyle: 0
ScaledBorderAndShadow: yes
YCbCr Matrix: None
PlayResX: 1920
PlayResY: 1080

[V4+ Styles]
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding
Style: Default,IPAMincho,152,&H00FFFFFF,&H000000FF,&H00B3ECFF,&H00000000,0,0,0,0,100,100,0,0,1,0,0,5,10,10,10,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\bord30\1c&HB3ECFF&}東日本旅客鉄道株式会社{\fscx0}-
Dialogue: 1,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\xshad5\yshad5}東日本旅客鉄道株式会社{\fscx0\bord30}-

Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\bord30\1c&HB3ECFF&}東日本旅客鉄道株式会社{\fscx0\bord30}-
Dialogue: 1,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\3c&H000000&\bord4}東日本旅客鉄道株式会社{\fscx0\bord30}-

Dialogue: 0,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\bord30\1c&HB3ECFF&}東日本旅客鉄道株式会社{\fscx0\bord30}-
Dialogue: 1,0:00:00.00,0:00:05.00,Default,,0,0,0,,{\3c&H000000&\bord2\xshad3\yshad1}東日本旅客鉄道株式会社{\fscx0\bord30}-

@TheOneric
Copy link
Member

Since there was no further response, I’ll assume the method from my last post is sufficient and all questions were answered.

@TheOneric TheOneric changed the title If I want to use libass to achieve the style of multi-layer subtitle outlines, how should I design the ass protocol? How to typeset multiple layers of text outlines (borders)? May 25, 2023
@fzh0627
Copy link
Author

fzh0627 commented May 26, 2023

thanks for a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants