View Full Version : DVobSub and ASS with embedded fonts.
SirElvis
10th January 2003, 13:55
Does DirectVobSub support ASS files with embedded fonts? If yes, how would I get a font into the script?
gabest
10th January 2003, 16:47
No, it doesn't. Is there a need? :)
SirElvis
10th January 2003, 17:29
I would prefer putting exotic fonts in the subtitle file. I wouldn't have to search for them after reinstalling my Windows. Also the subtitles would work right out of the box when sharing movies with friends and would look like they were intended to look.
After looking at the ass specifications I think I could write a small program to put the font into the script myself.
gabest
10th January 2003, 17:35
Ok, tell me when you are ready, I'm doing the other side of the job meanwhile.
gabest
10th January 2003, 20:42
Just figured out how to put uu encoded fonts into ssa using the sub station alpha editor... Everything is working now under 2k/xp, only win9x is missing the AddFontMemResourceEx call to confortably load fonts from the memory :confused:.
SirElvis
10th January 2003, 21:44
Oh... Substation Alpha can already do that :rolleyes: But I think I will still complete my small program... if I can figure out what to pass as HDC to the GetFontData function.
gabest
11th January 2003, 07:40
HDC hDC = ::GetDC(NULL);
GetFontData(hDC, ...)
::ReleaseDC(NULL, hDC);
Xombie
11th January 2003, 13:07
I hope you don't mind me butting in for a moment - how are the fonts being stored in the script? uuencode? And in what way? I mean, like:
[Font]
FontName=<uuencoded text>
FontName2=<uuencoded text>
Or how?
SirElvis
11th January 2003, 13:42
Form the ASS file specifications(form the 'Docs' subdir of VobSub):[Fonts]
This section contains text-encoded font files, if the user opted to embed non-standard fonts in the script. Only truetype fonts can be embedded in SSA scripts. Each font file is started with a single line in the format:
fontname: <name of file>
The word "fontname" must be in lower case (upper case will be interpretted as part of a text-encoded file).
<name of file> is the file name that SSA will use when saving the font file. It is:
the name of the original truetype font,
plus an underscore,
plus an optional "B" if Bold,
plus an optional "I" if Italic,
plus a number specifying the font encoding (character set),
plus ".ttf"
Eg.
fontname: chaucer_B0.ttf
fontname: comic_0.ttf
The fontname line is followed by lines of printable characters, representing the binary values which make up the font file. Each line is 80 characters long, except the last one which may be less.
And later about the encoding:It takes a binary file, three bytes at a time, and converts the 24bits of those bytes into four 6-bit numbers. 33 is added to each of these four numbers, and the corresponding ascii character for each number is written into the script file.
The offset of 33 means that lower-case characters cannot appear in the encoded output, and this is why the "filename" lines are always lower case.
Each line of an encoded file is 80 characters long, except the last one, which may be shorter.
If the length of the file being encoded is not an exact multiple of 3, then for odd-number filelengths, the last byte is multiplied by hexadecimal 100, and the most significant 12 bits are converted to two characters as above. For even-number filelengths, the last two bytes are multiplied by hexadecimal 10000, and the most significant 18 bits are converted to three characters as above.
There is no terminating code for the embedded files. If a new [section] starts in the script, or if another filename line is found, or the end of the script file is reached then the file is considered complete.
gabest
11th January 2003, 16:14
Something like this:[Fonts]
fontname: Comic Sans MS_B0.ttf
!!%!!!!3!1!!"!!A2&.*2V3$UKU!!:^)!!!5,%R55UA'3O2D!!!9Z!!!!E*05S]S3*?4`!!!!;A!!!"7
...
...
SirElvis
11th January 2003, 19:46
The tool is working now. Not coded very clean, but working. ;) Also I'm using the registry to get the installed fonts and the part with the writing of a B or I is not there. For now it is just taking the name from the registry(for example 'Arial Bold Italic') and adding "_0.ttf".
gabest
11th January 2003, 22:09
No need to exactly write the name, I'm just loading the ttf data starting from the next line and then CreateFont(..) for the style with the embeded font will either fail or succeed.
The new dvobsub isn't fully working yet as it did before, there are a few minor things missing, but for testing it is ok: http://download.vobsub.edensrising.com/DVobSub.rar
This dll also includes all possible virtualdub/avisynth plugins.
SirElvis
11th January 2003, 22:53
I've downloaded the new version and just put the DVobSub.ax in WINNT\system32. This is right, isn't it?
First of all, the embedded fonts are not working. After adding the fonts to the script(I've tried both SSA and my own tool) and removing them from WINNT\Fonts it displays the subs in Arial.
Second, there seems to be a bug in it. It resizes the picture to about half of its original size and paints the lower half of the video window green(showing subtitles there). If I turn on 'Force RGB' in Preferences -> Colors it's back to normal.
Also one more thing. With the new version some fonts have stopped working. I'm using a font named 'GF Halda Smashed'. It worked well in DVobSub 2.23, but the new version is just displaying Arial. Others(like 'Brian Cary') still work, like they should.
My System:
Win2k with SP3
ffdshow for decoding
MediaPlayer Classic for viewing
The video I'm talking about was encoded with DivX 5.02, but I've also tried a XviD encoded one.
gabest
11th January 2003, 23:16
I've downloaded the new version and just put the DVobSub.ax in WINNT\system32. This is right, isn't it?You can put it anywhere, just run regsvr32 on it with full path.First of all, the embedded fonts are not working. After adding the fonts to the script(I've tried both SSA and my own tool) and removing them from WINNT\Fonts it displays the subs in Arial.Could you send a smaller file with embeded fonts to my email address?Second, there seems to be a bug in it. It resizes the picture to about half of its original size and paints the lower half of the video window green(showing subtitles there). If I turn on 'Force RGB' in Preferences -> Colors it's back to normal.What was the original video resolution? Also one more thing. With the new version some fonts have stopped working. I'm using a font named 'GF Halda Smashed'. It worked well in DVobSub 2.23, but the new version is just displaying Arial. Others(like 'Brian Cary') still work, like they should.Hm, I wonder why it is not showig correctly. If this font is not to big, send it to my email too, along with a sample ssa using it :)
gabest
11th January 2003, 23:55
Got the file. The prob was that I forgot about not applying the preset style of dvobsub to the "Default" one when loading. The best would be to leave "Default" player/user selectable and give each style with fixed settings a unique name.
Embeded fonts showed right at the first attempt, no idea why it doesn't work for you. If you can, test it on a few other machines too.
SirElvis
12th January 2003, 00:18
Got the file. The prob was that I forgot about not applying the preset style of dvobsub to the "Default" one when loading. The best would be to leave "Default" player/user selectable and give each style with fixed settings a unique name.That's it. After renaming the style 'Default' to something else, its working. Except for the problem with the resizing + green bar. This one is still there.
If you can, test it on a few other machines too.Will do that tomorrow...
SirElvis
12th January 2003, 18:29
I've tried the new VobSub on my brothers PC, same problem there. His system is pretty much the same as mine, except he hasn't installed a WIn2k service pack yet.
Since I've not been able to make a screenshot of MPC showing the problem(how do you do that again?), I've recreated it in Photoshop and mailed it to you.
SirElvis
17th January 2003, 17:37
My problem wih half of the video being green has got something to do with the colorspace. The video is encoded in YV12(AviSynth 2.5a), and ffdshow displays it as such. But as soon as the new DVobSub kicks in, it converts to YUY2(both ffdshow and DVobSub show that). DVobSub 2.23 didn't do that.
SirElvis
20th January 2003, 18:13
There's one more problem, I just came across.
As log as you are using a font that has its styles(bold, italic) in one file everything is ok. You can embed it and use it as if it was installed.
But there are also fonts that are distributed over several files. One file for the font without modification, one for bold, one for italic and one for bold and italic. If you want to use those fonts it's just logical to embed all the parts(files) in the script. But one problem arises.
Example:Style: DefText,SwitzerlandNarrow,15,&H00FFFFFF,&H00FFFFFF,&H00000000,&H77000000,1,0,0,0,100,100,0,0,1,1,2,2,30,30,2,0
Style: Italics,SwitzerlandNarrow,15,&H00FFFFFF,&H00FFFFFF,&H00000000,&H77000000,1,1,0,0,100,100,0,0,1,1,2,2,30,30,2,0The only difference is the italic flag. Later in the file I've embedded the both fonts:[Fonts]
fontname: SwitzerlandNarrow Bold Italic_BI0.ttf
...
fontname: SwitzerlandNarrow Bold_B0.ttf
...The problem is, that everything, is displayed in italics, order of the embedded fonts doesn't matter. Adding the 'base-font' also doesn't help
gabest
21st January 2003, 02:27
Could I have this sample file for testing?
Fresh new build at:
http://download.vobsub.edensrising.com/VSFilter.rar
(non-unicode, all-plugins-in-one, YV12/I420 enabled again, and to use just register as you did dvobsub.ax)
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.