IsStrikeout() public method

public IsStrikeout ( ) : bool
return bool
コード例 #1
0
ファイル: MetaDo.cs プロジェクト: miroslavmatysek/itextsharp
 public void OutputText(int x, int y, int flag, int x1, int y1, int x2, int y2, string text) {
     MetaFont font = state.CurrentFont;
     float refX = state.TransformX(x);
     float refY = state.TransformY(y);
     float angle = state.TransformAngle(font.Angle);
     float sin = (float)Math.Sin(angle);
     float cos = (float)Math.Cos(angle);
     float fontSize = font.GetFontSize(state);
     BaseFont bf = font.Font;
     int align = state.TextAlign;
     float textWidth = bf.GetWidthPoint(text, fontSize);
     float tx = 0;
     float ty = 0;
     float descender = bf.GetFontDescriptor(BaseFont.DESCENT, fontSize);
     float ury = bf.GetFontDescriptor(BaseFont.BBOXURY, fontSize);
     cb.SaveState();
     cb.ConcatCTM(cos, sin, -sin, cos, refX, refY);
     if ((align & MetaState.TA_CENTER) == MetaState.TA_CENTER)
         tx = -textWidth / 2;
     else if ((align & MetaState.TA_RIGHT) == MetaState.TA_RIGHT)
         tx = -textWidth;
     if ((align & MetaState.TA_BASELINE) == MetaState.TA_BASELINE)
         ty = 0;
     else if ((align & MetaState.TA_BOTTOM) == MetaState.TA_BOTTOM)
         ty = -descender;
     else
         ty = -ury;
     Color textColor;
     if (state.BackgroundMode == MetaState.OPAQUE) {
         textColor = state.CurrentBackgroundColor;
         cb.SetColorFill(textColor);
         cb.Rectangle(tx, ty + descender, textWidth, ury - descender);
         cb.Fill();
     }
     textColor = state.CurrentTextColor;
     cb.SetColorFill(textColor);
     cb.BeginText();
     cb.SetFontAndSize(bf, fontSize);
     cb.SetTextMatrix(tx, ty);
     cb.ShowText(text);
     cb.EndText();
     if (font.IsUnderline()) {
         cb.Rectangle(tx, ty - fontSize / 4, textWidth, fontSize / 15);
         cb.Fill();
     }
     if (font.IsStrikeout()) {
         cb.Rectangle(tx, ty + fontSize / 3, textWidth, fontSize / 15);
         cb.Fill();
     }
     cb.RestoreState();
 }
コード例 #2
0
        public void OutputText(int x, int y, int flag, int x1, int y1, int x2, int y2, string text)
        {
            MetaFont font      = _state.CurrentFont;
            float    refX      = _state.TransformX(x);
            float    refY      = _state.TransformY(y);
            float    angle     = _state.TransformAngle(font.Angle);
            float    sin       = (float)Math.Sin(angle);
            float    cos       = (float)Math.Cos(angle);
            float    fontSize  = font.GetFontSize(_state);
            BaseFont bf        = font.Font;
            int      align     = _state.TextAlign;
            float    textWidth = bf.GetWidthPoint(text, fontSize);
            float    tx        = 0;
            float    ty        = 0;
            float    descender = bf.GetFontDescriptor(BaseFont.DESCENT, fontSize);
            float    ury       = bf.GetFontDescriptor(BaseFont.BBOXURY, fontSize);

            Cb.SaveState();
            Cb.ConcatCtm(cos, sin, -sin, cos, refX, refY);
            if ((align & MetaState.TaCenter) == MetaState.TaCenter)
            {
                tx = -textWidth / 2;
            }
            else if ((align & MetaState.TaRight) == MetaState.TaRight)
            {
                tx = -textWidth;
            }
            if ((align & MetaState.TaBaseline) == MetaState.TaBaseline)
            {
                ty = 0;
            }
            else if ((align & MetaState.TaBottom) == MetaState.TaBottom)
            {
                ty = -descender;
            }
            else
            {
                ty = -ury;
            }
            BaseColor textColor;

            if (_state.BackgroundMode == MetaState.Opaque)
            {
                textColor = _state.CurrentBackgroundColor;
                Cb.SetColorFill(textColor);
                Cb.Rectangle(tx, ty + descender, textWidth, ury - descender);
                Cb.Fill();
            }
            textColor = _state.CurrentTextColor;
            Cb.SetColorFill(textColor);
            Cb.BeginText();
            Cb.SetFontAndSize(bf, fontSize);
            Cb.SetTextMatrix(tx, ty);
            Cb.ShowText(text);
            Cb.EndText();
            if (font.IsUnderline())
            {
                Cb.Rectangle(tx, ty - fontSize / 4, textWidth, fontSize / 15);
                Cb.Fill();
            }
            if (font.IsStrikeout())
            {
                Cb.Rectangle(tx, ty + fontSize / 3, textWidth, fontSize / 15);
                Cb.Fill();
            }
            Cb.RestoreState();
        }