iTextSharp.text.pdf.BaseFont.GetFontDescriptor C# (CSharp) Метод

GetFontDescriptor() публичный абстрактный Метод

public abstract GetFontDescriptor ( int key, float fontSize ) : float
key int
fontSize float
Результат float
        public abstract float GetFontDescriptor(int key, float fontSize);

Usage Example

Пример #1
0
     /**
     * Get the <code>PdfAppearance</code> of a list field
     * @throws IOException on error
     * @throws DocumentException on error
     * @return A <code>PdfAppearance</code>
     */
     internal PdfAppearance GetListAppearance() {
         PdfAppearance app = GetBorderAppearance();
         app.BeginVariableText();
         if (choices == null || choices.Length == 0) {
             app.EndVariableText();
             return app;
         }
         int topChoice = choiceSelection;
         if (topChoice >= choices.Length) {
             topChoice = choices.Length - 1;
         }
         if (topChoice < 0)
             topChoice = 0;
         BaseFont ufont = RealFont;
         float usize = fontSize;
         if (usize == 0)
             usize = 12;
         bool borderExtra = borderStyle == PdfBorderDictionary.STYLE_BEVELED || borderStyle == PdfBorderDictionary.STYLE_INSET;
         float h = box.Height - borderWidth * 2;
         float offsetX = borderWidth;
         if (borderExtra) {
             h -= borderWidth * 2;
             offsetX *= 2;
         }
         float leading = ufont.GetFontDescriptor(BaseFont.BBOXURY, usize) - ufont.GetFontDescriptor(BaseFont.BBOXLLY, usize);
         int maxFit = (int)(h / leading) + 1;
         int first = 0;
         int last = 0;
         last = topChoice + maxFit / 2 + 1;
         first = last - maxFit;
         if (first < 0) {
             last += first;
             first = 0;
         }
 //        first = topChoice;
         last = first + maxFit;
         if (last > choices.Length)
             last = choices.Length;
         topFirst = first;
         app.SaveState();
         app.Rectangle(offsetX, offsetX, box.Width - 2 * offsetX, box.Height - 2 * offsetX);
         app.Clip();
         app.NewPath();
         Color fcolor = (textColor == null) ? GrayColor.GRAYBLACK : textColor;
         app.SetColorFill(new Color(10, 36, 106));
         app.Rectangle(offsetX, offsetX + h - (topChoice - first + 1) * leading, box.Width - 2 * offsetX, leading);
         app.Fill();
         float xp = offsetX * 2;
         float yp = offsetX + h - ufont.GetFontDescriptor(BaseFont.BBOXURY, usize);
         for (int idx = first; idx < last; ++idx, yp -= leading) {
             String ptext = choices[idx];
             int rtl = CheckRTL(ptext) ? PdfWriter.RUN_DIRECTION_LTR : PdfWriter.RUN_DIRECTION_NO_BIDI;
             ptext = RemoveCRLF(ptext);
             Phrase phrase = ComposePhrase(ptext, ufont, (idx == topChoice) ? GrayColor.GRAYWHITE : fcolor, usize);
             ColumnText.ShowTextAligned(app, Element.ALIGN_LEFT, phrase, xp, yp, 0, rtl, 0);
         }
         app.RestoreState();
         app.EndVariableText();
         return app;
     }
All Usage Examples Of iTextSharp.text.pdf.BaseFont::GetFontDescriptor