프로젝트

일반

사용자정보

개정판 27878b35

ID27878b35116827946dcfaa97e00750fb8c7454e8
상위 b1ec47cb
하위 7a8e5af2

백흠경이(가) 5년 이상 전에 추가함

issue 937: fixed text location

Change-Id: I6cb0b69522da5833547d378d960d89066843956c

차이점 보기:

FinalService/KCOM_FinalService/MarkupToPDF/Controls_PDF/HoneyPDFLib_DrawSet_DrawString.cs
12 12
{
13 13
    public partial class HoneyPDFLib_DrawSet_Text
14 14
    {
15
        /// <summary>
16
        /// create a font with given parameters
17
        /// </summary>
18
        /// <param name="fontstyle"></param>
19
        /// <param name="fontweight"></param>
20
        /// <param name="isUnderline"></param>
21
        /// <param name="rect"></param>
22
        /// <param name="text"></param>
23
        /// <returns></returns>
15 24
        private static iTextSharp.text.Font CreateFont(FontStyle fontstyle, FontWeight fontweight, TextDecorationCollection isUnderline, Rectangle rect, string text)
16 25
        {
17 26
            string ARIALUNI_TFF = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Fonts), "Arial Unicode MS.TTF");
......
28 37
            }
29 38

  
30 39
            iTextSharp.text.Font itextFont = new iTextSharp.text.Font(bf, (float)(dFontSize));
40

  
31 41
            itextFont.SetStyle(0);
32 42
            if (fontstyle == FontStyles.Italic)
33 43
            {
......
152 162
            string[] tokens = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
153 163
            ct.Canvas.Transform(mat);
154 164
            ct.Canvas.SetGState(gs3);
155
            ct.SetText(new Phrase(new Chunk(text, itextFont)));
156
            ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER;
157 165
            float fLeadingSize = (calRect.Height / (float)tokens.Length);
158
            float spacing = ((float)calRect.Height - tokens.Length*itextFont.CalculatedSize)/tokens.Length;
166
            float spacing = ((float)calRect.Height - tokens.Length*itextFont.CalculatedSize)/(tokens.Length+2);
159 167
            /// add paddings
160 168
            calRect.Right += (float)(lineSize * 0.5);
161 169
            if (calRect.Top > calRect.Bottom)
162
                calRect.Top += (float)(lineSize * 0.5);
170
                calRect.Bottom -= (float)(lineSize * 0.5);
163 171
            else
164
                calRect.Bottom += (float)(lineSize * 0.5);
172
                calRect.Top -= (float)(lineSize * 0.5);
165 173
            /// up to here
166
            ct.SetLeading(itextFont.CalculatedSize + spacing, ct.MultipliedLeading);
174
            ct.SetLeading(itextFont.CalculatedSize + (float)((tokens.Length > 1) ? spacing : 0), ct.MultipliedLeading);
167 175
            ct.SetSimpleColumn(calRect);
176
            ct.SetText(new Phrase(new Chunk(text, itextFont)));
177
            ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER;
168 178
            ct.Go();
169 179

  
170 180
            contentByte.RestoreState();
......
278 288
            string[] tokens = text.Split(new[]{Environment.NewLine}, StringSplitOptions.None);
279 289
            ct.Canvas.Transform(mat);
280 290
            ct.Canvas.SetGState(gs3);
281
            ct.SetText(new Phrase(new Chunk(text, itextFont)));
282
            ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER;
283
            float spacing = ((float)calRect.Height - tokens.Length * itextFont.CalculatedSize) / tokens.Length;
291
            float spacing = ((float)calRect.Height - tokens.Length * itextFont.CalculatedSize) / (tokens.Length+2);
284 292
            /// add paddings
285 293
            calRect.Right += (float)(lineSize * 0.5);
286 294
            if (calRect.Top > calRect.Bottom)
287
                calRect.Top += (float)(lineSize * 0.5);
295
                calRect.Bottom -= (float)(lineSize * 0.5);
288 296
            else
289
                calRect.Bottom += (float)(lineSize * 0.5);
297
                calRect.Top -= (float)(lineSize * 0.5);
290 298
            /// up to here
291
            ct.SetLeading(itextFont.CalculatedSize + spacing, ct.MultipliedLeading);
299
            ct.SetLeading(itextFont.CalculatedSize + (float)(tokens.Length > 1 ? spacing : 0), ct.MultipliedLeading);
292 300
            ct.SetSimpleColumn(calRect);
301
            ct.SetText(new Phrase(new Chunk(text, itextFont)));
302
            ct.Alignment = Element.ALIGN_MIDDLE | Element.ALIGN_CENTER;
293 303
            ct.Go();
294 304

  
295 305
            contentByte.RestoreState();
readme.txt
1
2019.07.03
2
#000:  TextBox ??????? ?????? ??????? ???? ????
3
#1120: Comment?? ??????? ???????? Commented Page?? ??????? ????
4
#923 : MarkupInfo ???? ?? ????? ????? ????? ????

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)