NewTextExtent:
   movem.l  d2-d6/a2,-(sp)
   move.l   a1,a4
   move.l   a0,a5
   move.l   d0,d3
   move.l   (52,a4),a3
    jsr _LVOTextLength(a6)
   move.w   d0,(a2)
   move.w   (20,a3),(2,a2)
   move.w   (26,a3),d1
   neg.w d1
   move.w   d1,(6,a2)
   move.w   (2,a2),d1
   subq.w   #1,d1
   sub.w (26,a3),d1
   move.w   d1,(10,a2)
   btst  #5,(23,a3)
   bne   .L4
   tst.l (48,a3)
   bne   .L4
   tst.l (44,a3)
   beq   .L3
.L4:
   clr.w d4
   move.b   (33,a3),d4
   clr.w d0
   move.b   (32,a3),d0
   sub.w d0,d4
   addq.w   #1,d4
   clr.w (4,a2)
   clr.w (8,a2)
   clr.w d2
   tst.l d3
   beq   .L21
   subq.l   #1,d3
   clr.w d6
   clr.w d5
   even
.L8:
   move.b   (a5)+,d0
   move.b   (32,a3),d1
   cmp.b d0,d1
   bhi   .L10
   cmp.b (33,a3),d0
   bls   .L9
.L10:
   move.w   d4,d0
   bra   .L11
   even
.L9:
   move.b   d0,d6
   move.b   d1,d5
   move.w   d6,d0
   sub.w d5,d0
.L11:
   move.w   d0,a1
   move.l   (48,a3),a0
   add.w (a0,a1.l*2),d2
   cmp.w (4,a2),d2
   bge   .L12
   move.w   d2,(4,a2)
.L12:
   cmp.w (8,a2),d2
   ble   .L13
   move.w   d2,(8,a2)
.L13:
   move.l   (40,a3),a0
   move.w   d2,d0
   add.w (2,a0,a1.l*4),d0
   cmp.w (4,a2),d0
   bge   .L14
   move.w   d0,(4,a2)
.L14:
   cmp.w (8,a2),d0
   ble   .L15
   move.w   d0,(8,a2)
.L15:
   move.l   (44,a3),a0
   add.w (a0,a1.l*2),d2
   cmp.w (4,a2),d2
   bge   .L16
   move.w   d2,(4,a2)
.L16:
   cmp.w (8,a2),d2
   ble   .L17
   move.w   d2,(8,a2)
.L17:
   add.w (64,a4),d2
   cmp.w (4,a2),d2
   bge   .L18
   move.w   d2,(4,a2)
.L18:
   cmp.w (8,a2),d2
   ble   .L6
   move.w   d2,(8,a2)
.L6:
   move.l   d3,d0
   subq.l   #1,d3
   tst.l d0
   bne   .L8
   subq.w   #1,(8,a2)
   bra   .L21
   even
.L3:
   clr.w (4,a2)
   subq.w   #1,d0
   move.w   d0,(8,a2)
.L21:
   btst  #1,(56,a4)
   beq  .L22
   move.w   (28,a3),d0
   add.w d0,(8,a2)
.L22:
   btst  #2,(56,a4)
   beq   .L23
   move.w   (26,a3),d0
   lsr.w #1,d0
   add.w d0,(8,a2)
   clr.l d0
   move.w   (20,a3),d0
   clr.l d1
   move.w   (26,a3),d1
   sub.l d1,d0
   move.l   d0,d0
   bpl   .L24
   addq.l   #1,d0
.L24:
   asr.l #1,d0
   sub.w d0,(4,a2)
.L23:
   movem.l  (sp)+,d2-d6/a2
   rts

