private double getCommentWidth(CommentText comment) { double commentWidth = worker.getStringWidth(comment.resolvedText, gdef.smallFont); if (comment.GetType() == typeof(LegendText)) { commentWidth += boxSpace; } return commentWidth; }
internal bool canAccomodate(CommentText comment) { // always accomodate if empty if (comments.Count == 0) { return true; } // cannot accomodate if the last marker was \j, \l, \r, \c, \s if (lastMarker.CompareTo(ALIGN_LEFT_MARKER) == 0 || lastMarker.CompareTo(ALIGN_CENTER_MARKER) == 0 || lastMarker.CompareTo(ALIGN_RIGHT_MARKER) == 0 || lastMarker.CompareTo(ALIGN_JUSTIFIED_MARKER) == 0 || lastMarker.CompareTo(VERTICAL_SPACING_MARKER) == 0) { return false; } // cannot accomodate if line would be too long double commentWidth = getCommentWidth(comment); if (lastMarker.CompareTo(GLUE_MARKER) != 0) { commentWidth += interlegendSpace; } return width + commentWidth <= legWidth; }
internal void add(CommentText comment) { double commentWidth = getCommentWidth(comment); if (comments.Count > 0 && lastMarker.CompareTo(GLUE_MARKER) != 0) { commentWidth += interlegendSpace; spaceCount++; } width += commentWidth; lastMarker = comment.marker; noJustification |= lastMarker.CompareTo(NO_JUSTIFICATION_MARKER) == 0; comments.Add(comment); }