private IRenderer CreateListSymbolRenderer(int index, IRenderer renderer) { Object defaultListSymbol = GetListItemOrListProperty(renderer, this, Property.LIST_SYMBOL); if (defaultListSymbol is Text) { return(SurroundTextBullet(new TextRenderer((Text)defaultListSymbol))); } else { if (defaultListSymbol is Image) { return(new ImageRenderer((Image)defaultListSymbol)); } else { if (defaultListSymbol is ListNumberingType) { ListNumberingType numberingType = (ListNumberingType)defaultListSymbol; String numberText; switch (numberingType) { case ListNumberingType.DECIMAL: { numberText = index.ToString(); break; } case ListNumberingType.DECIMAL_LEADING_ZERO: { numberText = (index < 10 ? "0" : "") + index.ToString(); break; } case ListNumberingType.ROMAN_LOWER: { numberText = RomanNumbering.ToRomanLowerCase(index); break; } case ListNumberingType.ROMAN_UPPER: { numberText = RomanNumbering.ToRomanUpperCase(index); break; } case ListNumberingType.ENGLISH_LOWER: { numberText = EnglishAlphabetNumbering.ToLatinAlphabetNumberLowerCase(index); break; } case ListNumberingType.ENGLISH_UPPER: { numberText = EnglishAlphabetNumbering.ToLatinAlphabetNumberUpperCase(index); break; } case ListNumberingType.GREEK_LOWER: { numberText = GreekAlphabetNumbering.ToGreekAlphabetNumber(index, false, true); break; } case ListNumberingType.GREEK_UPPER: { numberText = GreekAlphabetNumbering.ToGreekAlphabetNumber(index, true, true); break; } case ListNumberingType.ZAPF_DINGBATS_1: { numberText = JavaUtil.CharToString((char)(index + 171)); break; } case ListNumberingType.ZAPF_DINGBATS_2: { numberText = JavaUtil.CharToString((char)(index + 181)); break; } case ListNumberingType.ZAPF_DINGBATS_3: { numberText = JavaUtil.CharToString((char)(index + 191)); break; } case ListNumberingType.ZAPF_DINGBATS_4: { numberText = JavaUtil.CharToString((char)(index + 201)); break; } default: { throw new InvalidOperationException(); } } Text textElement = new Text(GetListItemOrListProperty(renderer, this, Property.LIST_SYMBOL_PRE_TEXT) + numberText + GetListItemOrListProperty(renderer, this, Property.LIST_SYMBOL_POST_TEXT)); IRenderer textRenderer; // Be careful. There is a workaround here. For Greek symbols we first set a dummy font with document=null // in order for the metrics to be taken into account correctly during layout. // Then on draw we set the correct font with actual document in order for the font objects to be created. if (numberingType == ListNumberingType.GREEK_LOWER || numberingType == ListNumberingType.GREEK_UPPER || numberingType == ListNumberingType.ZAPF_DINGBATS_1 || numberingType == ListNumberingType.ZAPF_DINGBATS_2 || numberingType == ListNumberingType.ZAPF_DINGBATS_3 || numberingType == ListNumberingType.ZAPF_DINGBATS_4) { String constantFont = (numberingType == ListNumberingType.GREEK_LOWER || numberingType == ListNumberingType .GREEK_UPPER) ? StandardFonts.SYMBOL : StandardFonts.ZAPFDINGBATS; textRenderer = new _TextRenderer_211(constantFont, textElement); try { textRenderer.SetProperty(Property.FONT, PdfFontFactory.CreateFont(constantFont)); } catch (System.IO.IOException) { } } else { textRenderer = new TextRenderer(textElement); } return(SurroundTextBullet(textRenderer)); } else { if (defaultListSymbol is IListSymbolFactory) { return(SurroundTextBullet(((IListSymbolFactory)defaultListSymbol).CreateSymbol(index, this, renderer).CreateRendererSubTree ())); } else { if (defaultListSymbol == null) { return(null); } else { throw new InvalidOperationException(); } } } } } }