DrawParaMark 段落标志 回车符号 分析

procedure DrawParaMark(DrawItemNo: Integer; After: Boolean);
  var BiDiMode: TRVBiDiMode;
      Left, Top: Integer;
      s: TRVRawByteString;
      sz: TSize;
      ditem: TRVDrawLineInfo;
      ParaBreak: Boolean;
  begin
    if After then begin
      if (DrawItemNo+1<DrawItems.Count) and
         ((DrawItems[DrawItemNo].ItemNo=DrawItems[DrawItemNo+1].ItemNo) or
          not IsFromNewLineEx(DrawItems[DrawItemNo+1].ItemNo)) then
        exit
      end
    else begin
      if ((DrawItemNo>0) and (DrawItems[DrawItemNo].ItemNo=DrawItems[DrawItemNo-1].ItemNo)) or
          not IsFromNewLineEx(DrawItems[DrawItemNo].ItemNo) then
        exit;
    end;
    ditem := DrawItems[DrawItemNo];
    if LastDrawnStyle<0 then
      if GetItemStyle(DrawItems[DrawItemNo].ItemNo)>0 then
        LastDrawnStyle := GetItemStyle(DrawItems[DrawItemNo].ItemNo)
      else
        LastDrawnStyle := 0;
    BiDiMode := GetParaBiDiMode(GetItemParaEx(ditem.ItemNo));
    RVStyle.ApplyStyle(Canvas, LastDrawnStyle, BiDiMode, True, nil, False,
      False);
    if RVStyle.TextBackgroundKind<>rvtbkSimple then begin
      RVStyle.ApplyStyleTextColor(Canvas, LastDrawnStyle, [], False, rvcmColor);
      Canvas.Brush.Style := bsClear;
      end
    else
      RVStyle.ApplyStyleColor(Canvas, LastDrawnStyle, [], False, rvcmColor);
    if FormatCanvas<>Canvas then
      LastDrawnStyle := -1;
    if RVStyle.SpecialCharactersColor<>clNone then
      Canvas.Font.Color := RVStyle.SpecialCharactersColor;
    if {$IFDEF RICHVIEWCBDEF3}(Canvas.Font.Charset=SYMBOL_CHARSET) or{$ENDIF}
       (AnsiCompareText(Canvas.Font.Name, RVFONT_SYMBOL)=0) or
       (AnsiCompareText(Canvas.Font.Name, RVFONT_WINGDINGS)=0) then begin
      LastDrawnStyle := -1;
      Canvas.Font.Name := 'Arial';
      {$IFDEF RICHVIEWCBDEF3}
      Canvas.Font.CHARSET := DEFAULT_CHARSET;
      {$ENDIF}
    end;
    if After then
      ParaBreak := (DrawItemNo+1=DrawItems.Count) or IsParaStartEx(DrawItems[DrawItemNo+1].ItemNo)
    else
      ParaBreak := IsParaStartEx(DrawItems[DrawItemNo].ItemNo);
    if ParaBreak and (RVParagraphMarks=rvpmStandard) then
      s := #$B6
    else begin
      {$IFDEF RICHVIEWCBDEF3}
      Canvas.Font.Charset := SYMBOL_CHARSET;
      {$ENDIF}
      Canvas.Font.Name := RVFONT_SYMBOL;
      if ParaBreak or (RVParagraphMarks=rvpmStandard) then
        s := #$BF
      else
        s := #$AF;
      {
      Canvas.Font.Name := RVFONT_WINGDINGS;
      s := #$C3;
      }
      LastDrawnStyle := -1;
    end;
    RVStyle.GraphicInterface.GetTextExtentPoint32_A(Canvas,
      PRVAnsiChar(s), 1, sz);
    if (After and (BiDiMode<>rvbdRightToLeft)) or
       (not After and (BiDiMode=rvbdRightToLeft)) then
      Left := ditem.Left+ditem.Width
    else
      Left := ditem.Left-sz.cx;
    dec(Left, xshift);
    Top := ditem.Top+ditem.Height-yshift-sz.cy;
    RVStyle.GraphicInterface.TextOut_A(Canvas, Left, Top, PRVAnsiChar(s), Length(s));
    if rvscParagraphAttrs in RVVisibleSpecialCharacters then
      DrawParaAttrs(Left,Top, sz, RVStyle.ParaStyles[GetItemParaEx(ditem.ItemNo)],
        ParaBreak, BiDiMode, After);
  end;
 

DrawParaMark 段落标志 回车符号 分析


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值