Changeset 1063

Show
Ignore:
Timestamp:
05/30/09 21:58:19 (9 months ago)
Author:
astrange
Message:

SSA:
- Support decimal \pos
- Support ".5" in decimal numbers
- Read the starting position of \move as \pos

Improves [gg]_Goku_Sayonara_Zetsubou_Sensei_-_02_[D284BF24].mkv

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Release/Changes.txt

    r1062 r1063  
    2525- Disabled vertical font support again to fix files wrongly using it for Latin text [r1027] 
    2626- Fixed subtitles in MKV wrongly displaying at the end of a video [r1036] 
     27- Fixed sub-pixel \pos and the starting position of \move [r1063] 
    2728 
    28291.1.3 
  • trunk/Subtitles/SubParsing.h

    r1046 r1063  
    3737        NSMutableArray *spans; 
    3838         
    39         int posX, posY; 
     39        float posX, posY; 
    4040        UInt8 alignH, alignV, wrapStyle, render_complexity; 
    4141        BOOL positioned; 
  • trunk/Subtitles/SubParsing.m.rl

    r1048 r1063  
    285285                        unsigned chars_deleted = 0; float floatnum = 0; 
    286286                        NSString *strval=NULL; 
    287                         unsigned curX, curY; 
     287                        float curX, curY; 
    288288                        int intnum = 0; 
    289289                        BOOL reachedEnd = NO, setWrapStyle = NO, setPosition = NO, setAlignForDiv = NO, dropThisSpan = NO; 
     
    323323                                action setstringval {strval = psend();} 
    324324                                action nullstring {strval = @"";} 
    325                                 action setxypos {curX=curY=-1; sscanf([psend() UTF8String], "(%d,%d)", &curX, &curY);} 
    326                                  
     325                                action setpos {curX=curY=0; sscanf([psend() UTF8String], "(%f,%f", &curX, &curY);} 
     326 
    327327                                action ssaalign { 
    328328                                        if (!setAlignForDiv) { 
     
    362362                                intnum = ("-"? [0-9]+) >paramset %setintnum; 
    363363                                flag = [01] >paramset %setintnum; 
    364                                 floatnum = ("-"? [0-9]+ ("." [0-9]*)?) >paramset %setfloatnum; 
     364                                floatn = ("-"? ([0-9]+ ("." [0-9]*)?) | ([0-9]* "." [0-9]+)); 
     365                                floatnum = floatn >paramset %setfloatnum; 
    365366                                string = (([^\\}]+) >paramset %setstringval | "" %nullstring ); 
    366367                                color = ("H"|"&"){,2} (xdigit+) >paramset %sethexnum "&"?; 
    367368                                parens = "(" [^)]* ")"; 
    368                                 xypos = ("(" "-"? [0-9]+ "," "-"? [0-9]+ ")") >paramset %setxypos; 
     369                                pos = ("(" floatn "," floatn ")") >paramset %setpos; 
     370                                move = ("(" (floatn ","){3,5} floatn ")") >paramset %setpos; 
    369371                                 
    370372                                cmd = "\\" ( 
     
    400402                                                        |"q" intnum %wrapstyle 
    401403                                                        |"r" string %stylerevert 
    402                                                         |"pos" xypos %position 
     404                                                        |"pos" pos %position 
     405                                                        |"move" move %position 
    403406                                                        |"t" parens 
    404407                                                        |"org" parens 
  • trunk/Subtitles/ssa2html.m

    r1046 r1063  
    193193                 
    194194                if (div->positioned) { 
    195                         [html appendFormat:@"<div style=\"top: %dpx; left: %dpx; position: absolute\">", div->posY, div->posX]; 
     195                        [html appendFormat:@"<div style=\"top: %fpx; left: %fpx; position: absolute\">", div->posY, div->posX]; 
    196196                        close_div = 1; 
    197197                } 
     
    227227                SubRenderDiv *div = [divs objectAtIndex:i]; 
    228228                 
    229                 if (div->posX > -1) [abs addObject:div]; else if (div->alignV == kSubAlignmentTop) [top addObject:div]; else [bot insertObject:div atIndex:0]; 
     229                if (div->positioned) [abs addObject:div]; else if (div->alignV == kSubAlignmentTop) [top addObject:div]; else [bot insertObject:div atIndex:0]; 
    230230        } 
    231231