public static Chunk GetChunk(Properties attributes) {
Chunk chunk = new Chunk();
chunk.Font = FontFactory.GetFont(attributes);
String value;
value = attributes[ElementTags.ITEXT];
if (value != null) {
chunk.Append(value);
}
value = attributes[ElementTags.LOCALGOTO];
if (value != null) {
chunk.SetLocalGoto(value);
}
value = attributes[ElementTags.REMOTEGOTO];
if (value != null) {
String page = attributes[ElementTags.PAGE];
if (page != null) {
chunk.SetRemoteGoto(value, int.Parse(page));
}
else {
String destination = attributes[ElementTags.DESTINATION];
if (destination != null) {
chunk.SetRemoteGoto(value, destination);
}
}
}
value = attributes[ElementTags.LOCALDESTINATION];
if (value != null) {
chunk.SetLocalDestination(value);
}
value = attributes[ElementTags.SUBSUPSCRIPT];
if (value != null) {
chunk.SetTextRise(float.Parse(value, System.Globalization.NumberFormatInfo.InvariantInfo));
}
value = attributes[Markup.CSS_KEY_VERTICALALIGN];
if (value != null && value.EndsWith("%")) {
float p = float.Parse(value.Substring(0, value.Length - 1), System.Globalization.NumberFormatInfo.InvariantInfo) / 100f;
chunk.SetTextRise(p * chunk.Font.Size);
}
value = attributes[ElementTags.GENERICTAG];
if (value != null) {
chunk.SetGenericTag(value);
}
value = attributes[ElementTags.BACKGROUNDCOLOR];
if (value != null) {
chunk.SetBackground(Markup.DecodeColor(value));
}
return chunk;
}