コード例 #1
0
        public override double measureTextFn(HPDF_Font font, string text, uint len,
                                             double width, double fontSize, double charSpace, double wordSpace, bool wordwrap, C_NumberPointer realWidth)
        {
            LibLogger.Debug(this.GetType(), "HPDF_TTFont_MeasureText");
            return(0);

            //double w = 0;
            //uint tmpLen = 0;
            //uint i;

            //for (i = 0; i < len; i++)
            //{
            //    uint b = text.ToCharArray()[i];

            //    // use encoder
            //    if (encoder!=null)
            //        b = encoder.unicodeToByte(b);

            //    if (HPDF_Utils.HPDF_IS_WHITE_SPACE(b))
            //    {
            //        tmpLen = i + 1;

            //        if (realWidth!=null)
            //            realWidth.Value = w;

            //        w += wordSpace;
            //    }
            //    else if (!wordwrap)
            //    {
            //        tmpLen = i;

            //        if (realWidth != null)
            //            realWidth.Value = w;
            //    }

            //    w += font.CharWidth(b) * fontSize / 1000;

            //    /* 2006.08.04 break when it encountered  line feed */
            //    if (w > width || b == 0x0A)
            //        return tmpLen;

            //    if (i > 0)
            //        w += charSpace;
            //}

            ///* all of text can be put in the specified width */
            //if (realWidth != null)
            //    realWidth.Value = w;

            //return len;
        }
コード例 #2
0
ファイル: HPDF_FontAttr.cs プロジェクト: herbat73/CSharpPdf
 public virtual double measureTextFn(HPDF_Font font, string text, uint len,
                                     double width, double fontSize, double charSpace, double wordSpace, bool wordwrap, C_NumberPointer realWidth)
 {
     Error = new HPDF_Error("Function measure text not implemented by HPDF_FontAttr");
     return(0);
 }