| 639 | |
| 640 | |
| 641 | def WriteASSHead(f, width, height, fontface, fontsize, alpha, styleid): |
| 642 | f.write( |
| 643 | ''' |
| 644 | [Script Info] |
| 645 | ; Script generated by Danmaku2ASS |
| 646 | ; https://github.com/m13253/danmaku2ass |
| 647 | Script Updated By: Danmaku2ASS (https://github.com/m13253/danmaku2ass) |
| 648 | ScriptType: v4.00+ |
| 649 | WrapStyle: 2 |
| 650 | Collisions: Normal |
| 651 | PlayResX: %(width)s |
| 652 | PlayResY: %(height)s |
| 653 | ScaledBorderAndShadow: yes |
| 654 | [V4+ Styles] |
| 655 | Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, OutlineColour, BackColour, Bold, Italic, Underline, StrikeOut, ScaleX, ScaleY, Spacing, Angle, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, Encoding |
| 656 | Style: %(styleid)s, %(fontface)s, %(fontsize)s, &H%(alpha)02XFFFFFF, &H%(alpha)02XFFFFFF, &H%(alpha)02X000000, &H%(alpha)02X000000, 0, 0, 0, 0, 100, 100, 0.00, 0.00, 1, %(outline)s, 0, 7, 0, 0, 0, 0 |
| 657 | [Events] |
| 658 | Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text |
| 659 | ''' % {'width': width, 'height': height, 'fontface': fontface, 'fontsize': round(fontsize), 'alpha': 255-round(alpha*255), 'outline': round(fontsize/25), 'styleid': styleid} |
| 660 | ) |
| 661 | |
| 662 | |
| 663 | def WriteComment(f, c, row, width, height, bottomReserved, fontsize, lifetime, styleid): |