Changeset 841

Show
Ignore:
Timestamp:
03/31/08 14:37:29 (4 months ago)
Author:
astrange
Message:

Redo r838 in a better way. Add anotther -description.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Subtitles/SubATSUIRenderer.m

    r839 r841  
    991991                ATSUTextMeasurement imageWidth, imageHeight; 
    992992 
    993                 if (div->posX != kSubPositionNone || div->alignV == kSubAlignmentMiddle) GetTypographicRectangleForLayout(layout, breaks, breakCount, FloatToFixed(div->styleLine->outlineRadius), NULL, NULL, &imageHeight, &imageWidth); 
    994  
    995                 if (div->posX == kSubPositionNone) { 
     993                if (div->positioned || div->alignV == kSubAlignmentMiddle) GetTypographicRectangleForLayout(layout, breaks, breakCount, FloatToFixed(div->styleLine->outlineRadius), NULL, NULL, &imageHeight, &imageWidth); 
     994 
     995                if (!div->positioned) { 
    996996                        penX = FloatToFixed(NSMinX(marginRect)); 
    997997 
  • trunk/Subtitles/SubContext.m

    r806 r841  
    141141} 
    142142 
     143static NSString *yes(int i) {return i ? @"yes" : @"no";} 
     144 
     145static NSString *ColorString(SubRGBAColor *c) 
     146{ 
     147        return [NSString stringWithFormat:@"{R: %d G: %d B: %d A: %d}", (int)(c->red * 255), 
     148                                         (int)(c->green * 255), (int)(c->blue * 255), (int)(c->alpha * 255)]; 
     149} 
     150 
     151-(NSString *)description 
     152{ 
     153        static const NSString *alignHStr[] = {@"left", @"center", @"right"}; 
     154        static const NSString *alignVStr[] = {@"bottom", @"middle", @"top"}; 
     155        static const NSString *bstyle[] = {@"normal", @"box"}; 
     156         
     157        return [NSString stringWithFormat:@"" 
     158                                         "SubStyle named \"%@\"\n" 
     159                                         "-Font: %f pt %@\n" 
     160                                         "-Primary color: %@\n" 
     161                                         "-Secondary color: %@\n" 
     162                                         "-Outline: %f px %@\n" 
     163                                         "-Shadow: %f px %@\n" 
     164                                         "-Margin: %d px left, %d px right, %d px vertical\n" 
     165                                         "-Bold: %@ Italic: %@ Underline: %@ Strikeout: %@\n" 
     166                                         "-Alignment: %@ %@\n" 
     167                                         "-Border style: %@\n" 
     168                                         "-Per-font scale: %f\n", 
     169                                         name, size, fontname, ColorString(&primaryColor), 
     170                                         ColorString(&secondaryColor), outlineRadius, ColorString(&outlineColor), 
     171                                         shadowDist, ColorString(&shadowColor), marginL, marginR, marginV, 
     172                                         yes(bold), yes(italic), yes(underline), yes(strikeout), alignHStr[alignH], 
     173                                         alignVStr[alignV], bstyle[borderStyle], platformSizeScale]; 
     174} 
     175 
    143176-(void)dealloc 
    144177{ 
  • trunk/Subtitles/SubParsing.h

    r806 r841  
    2727        int posX, posY; 
    2828        UInt8 alignH, alignV, wrapStyle, render_complexity; 
    29         BOOL is_shape
     29        BOOL is_shape, positioned
    3030         
    3131        unsigned layer; 
  • trunk/Subtitles/SubParsing.m.rl

    r838 r841  
    6262                spans = nil; 
    6363                 
    64                 posX = posY = kSubPositionNone
     64                posX = posY = 0
    6565                alignH = kSubAlignmentMiddle; alignV = kSubAlignmentBottom; 
    6666                 
    67                 is_shape = NO; 
     67                is_shape = positioned = NO; 
    6868                render_complexity = 0; 
    6969        } 
     
    9292   
    9393    div->is_shape = NO; 
     94        div->positioned = positioned; 
    9495        div->render_complexity = render_complexity; 
    9596         
     
    333334                                        div->posX = curX; 
    334335                                        div->posY = curY; 
     336                                        div->positioned = YES; 
    335337                                } 
    336338