Changeset 764
- Timestamp:
- 01/13/08 19:00:12 (6 months ago)
- Files:
-
- branches/perian-1.1/Subtitles/SubATSUIRenderer.m (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/perian-1.1/Subtitles/SubATSUIRenderer.m
r762 r764 541 541 } 542 542 543 static void GetTypographicRectangleForLayout(ATSUTextLayout layout, UniCharArrayOffset *breaks, ItemCount breakCount, Fixed *lX, Fixed *lY, Fixed *height, Fixed *width)543 static void GetTypographicRectangleForLayout(ATSUTextLayout layout, UniCharArrayOffset *breaks, ItemCount breakCount, Fixed extraHeight, Fixed *lX, Fixed *lY, Fixed *height, Fixed *width) 544 544 { 545 545 ATSTrapezoid trap = {0}; … … 555 555 ATSUGetGlyphBounds(layout, 0, baseY, breaks[i], end-breaks[i], kATSUseDeviceOrigins, 1, &trap, &trapCount); 556 556 557 baseY += GetLineHeight(layout, breaks[i]) ;557 baseY += GetLineHeight(layout, breaks[i]) + extraHeight; 558 558 559 559 rect.bottom = MAX(trap.lowerLeft.y, trap.lowerRight.y); … … 575 575 *width = largeRect.right - largeRect.left; 576 576 } 577 578 #if 0 579 static void GetImageBoundingBoxForLayout(ATSUTextLayout layout, UniCharArrayOffset *breaks, ItemCount breakCount, Fixed extraHeight, Fixed *lX, Fixed *lY, Fixed *height, Fixed *width) 580 { 581 Rect largeRect = {0}; 582 ATSUTextMeasurement baseY = 0; 583 int i; 584 585 for (i = breakCount; i >= 0; i--) { 586 UniCharArrayOffset end = breaks[i+1]; 587 Rect rect; 588 589 ATSUMeasureTextImage(layout, breaks[i], end-breaks[i], 0, baseY, &rect); 590 591 baseY += GetLineHeight(layout, breaks[i]) + extraHeight; 592 593 if (i == breakCount) largeRect = rect; 594 595 largeRect.bottom = MAX(largeRect.bottom, rect.bottom); 596 largeRect.left = MIN(largeRect.left, rect.left); 597 largeRect.top = MIN(largeRect.top, rect.top); 598 largeRect.right = MAX(largeRect.right, rect.right); 599 } 600 601 602 if (lX) *lX = IntToFixed(largeRect.left); 603 if (lY) *lY = IntToFixed(largeRect.bottom); 604 *height = IntToFixed(largeRect.bottom - largeRect.top); 605 *width = IntToFixed(largeRect.right - largeRect.left); 606 } 607 #endif 577 608 578 609 enum {fillc, strokec}; … … 806 837 ATSUTextMeasurement lineWidth, lineHeight, lineX, lineY; 807 838 UniCharArrayOffset breaks[2] = {thisBreak, thisBreak + lineLen}; 808 GetTypographicRectangleForLayout(layout, breaks, 0, &lineX, &lineY, &lineHeight, &lineWidth);839 GetTypographicRectangleForLayout(layout, breaks, 0, FloatToFixed(spanEx->outlineRadius), &lineX, &lineY, &lineHeight, &lineWidth); 809 840 810 841 CGRect borderRect = CGRectMake(FixedToFloat(lineX + penX), FixedToFloat(penY - lineY), FixedToFloat(lineWidth), FixedToFloat(lineHeight)); … … 954 985 ATSUTextMeasurement imageWidth, imageHeight; 955 986 956 if (div->posX != -1 || div->alignV == kSubAlignmentMiddle) GetTypographicRectangleForLayout(layout, breaks, breakCount, NULL, NULL, &imageHeight, &imageWidth);987 if (div->posX != -1 || div->alignV == kSubAlignmentMiddle) GetTypographicRectangleForLayout(layout, breaks, breakCount, FloatToFixed(div->styleLine->outlineRadius), NULL, NULL, &imageHeight, &imageWidth); 957 988 958 989 if (div->posX == -1) { … … 994 1025 } 995 1026 1027 ATSUGetLineControl(layout, kATSUFromTextBeginning, kATSULineDescentTag, sizeof(ATSUTextMeasurement), &descent, NULL); 1028 996 1029 switch (div->alignV) { 997 1030 case kSubAlignmentMiddle: penY -= imageHeight / 2; break; 998 case kSubAlignmentTop: penY -= imageHeight; 999 } 1000 1001 ATSUGetLineControl(layout, kATSUFromTextBeginning, kATSULineDescentTag, sizeof(ATSUTextMeasurement), &descent, NULL); 1031 case kSubAlignmentTop: penY -= imageHeight; break; 1032 } 1002 1033 1003 1034 penY += descent; 1004 1035 1005 1036 SetLayoutPositioning(layout, imageWidth, div->alignH); 1006 1037 storePen = NULL; breakc.lStart = breakCount; breakc.lEnd = -1; breakc.direction = 1;
