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

@font vertical writing is displayed wrong #695

Open
ch3ewb4cc4 opened this issue Jun 8, 2023 · 12 comments
Open

@font vertical writing is displayed wrong #695

ch3ewb4cc4 opened this issue Jun 8, 2023 · 12 comments

Comments

@ch3ewb4cc4
Copy link

Hi, I created Japanese vertical subtitles in aegisub.
But the symbols are displayed horizontally.
When I burn the subtitles with ffmpeg, they are displayed horizontally and burned. Does anyone know how to solve this problem?
Sorry for my poor English.

@astiob
Copy link
Member

astiob commented Jun 8, 2023

To render vertical Japanese in ASS, you must do the following:

  1. Specify a Japanese font that supports vertical writing.
  2. Prefix the font name with an @ symbol.
  3. Rotate the line by −90° around the 𝑧 axis.
  4. Most likely, reposition the line on screen by hand, because the default positioning may be wrong and cause part of the text to get cut off.

You can specify the font and rotation using override tags:

Dialogue: 0,0:00:00.00,0:00:10.00,Default,,0,0,0,,{\fn@Meiryo\frz-90}日本語もいい

or in a style definition:

[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: VerticalJapanese,@Meiryo,96,&H000000FF,&H000000FF,&H000000FF,&H000000FF,0,0,0,0,100,100,0,-90,1,0,0,3,0,196,0,1

[Events]
Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text
Dialogue: 0,0:00:00.00,0:00:10.00,VerticalJapanese,,0,0,0,,日本語もいい

For positioning, try changing the Alignment (or the \an override tag), MarginL/MarginR and either changing MarginV or adding a \pos(X,Y) override tag that sets explicit coordinates for the alignment point.

@ch3ewb4cc4
Copy link
Author

Thanks for the reply. I did as you advised. The symbols are displayed horizontally; in illustrator they are displayed correctly. Do you know of a solution to this?
4

@astiob
Copy link
Member

astiob commented Jun 21, 2023

I’m not sure which exact symbols you’re trying to use, but yes, some are unfortunately rotated incorrectly in current libass, and I’m afraid you don’t have any solution for this (other than manually positioning every glyph). You may get a better result using a Windows computer with VSFilter (instead of libass): for example, you could invoke VSFilter via AviSynth and use the AviSynth script as the input for FFmpeg.

This has previously been mentioned in #600 and https://code.google.com/archive/p/libass/issues/95 (and elsewhere), but we don’t seem to have a clearly dedicated GitHub issue for it. Maybe I should create one. My most recent idea was to have libass use HarfBuzz’s vertical-writing mode and hope that it solves this.

@rcombs
Copy link
Member

rcombs commented Jun 21, 2023

Yeah, if VSFilter/GDI handles this, I would assume it's by using vertical mode for @ fonts, and setting that in harfbuzz should be exactly what we want here.

@astiob
Copy link
Member

astiob commented Jun 21, 2023

The reason I have doubts is because vertical writing support in Windows is pretty old and I couldn’t find clear information on how fonts define it when I first tried (including by looking inside Microsoft’s older fonts). But yeah, it’s my best guess/hope that HarfBuzz should be able to handle it.

@rcombs
Copy link
Member

rcombs commented Jun 21, 2023

Well, the core of it's going to be alternate glyphs using an opentype feature or the like, right? So at worst, we might have to experiment with specific flags (vert/vrtr/vrt2).

@ch3ewb4cc4
Copy link
Author

Thank you for your advice.I have looked into Harfbuzz and it seems very difficult for me.But I'll try a little harder.

@TheOneric TheOneric changed the title Aegisub Japanese vertical subtitle issue @font vertical writing is displayed wrong Aug 3, 2023
@TheOneric
Copy link
Member

TheOneric commented Aug 3, 2023

Apparently there exists a libass downstream fork for displaying ISDB subtitles and one of its patches seems related to this and may be worth a closer look (at first glance it appears to also automatically rotate, which we don't want): 0p1pp1/libass@ca5cc11e1 + 0p1pp1@76704b5

@ch3ewb4cc4 if you’re only burning the subtitles into the video and not distributing the soft subtitles, you may want to use this fork until we have a proper, VSFilter-comaptible fix. (If you do distribute soft subs, do not use the downstream fork as whatever you author will be incompatible with any ASS real renderer, including both current and future fixed libass)
However, this fork breaks ABI (inserts a new element in the middle of the ASS_Style struct) so you will also need to relink the programs using libass against the fork.

@rcombs
Copy link
Member

rcombs commented Aug 5, 2023

Some previous investigation that may be relevant: waddou/libass#95

@astiob
Copy link
Member

astiob commented Aug 5, 2023

Oh, someone did archive the Google Code repo on GitHub! That’s good to know. Of course, Google still hosts its own archive, but it’s anonymized.

@rcombs
Copy link
Member

rcombs commented Aug 5, 2023

I can't reproduce the issue described here using the text て・ストー with \fn@MS Mincho\frz-90. Are we sure that this is still an issue? Could it be a case of outdated libass? Or maybe it happens in some fonts, but not others?

Please confirm what libass version you're using, and attach a sample ASS file and all associated fonts.

@astiob
Copy link
Member

astiob commented Aug 6, 2023

I don’t think that’s in the picture: it’s too long. (Of course, it’s not MS Mincho, either.) Certainly, an exact text sample would help for reproduction purposes.

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

No branches or pull requests

4 participants