ch != CharacterIterator.DONE; ch = it.next()) { if (it.getAttribute(DateFormat.Field.MILLISECOND) != null) { if (!doneMillis) { Date dateObj = (Date) value; doneMillis = true; } else if (it.getAttribute(DateFormat.Field.AM_PM) != null) { if (!doneAm) { if (showAmPm) {
/** * If fields list is not null, find and add the fields of this format to * the fields list by iterating through its AttributedCharacterIterator * * @param format * the format to find fields for * @param arg * object to format * @param begin * the index where the string this format has formatted begins */ private void handleFormat(Format format, Object arg, int begin, List<FieldContainer> fields) { if (fields == null) { return; } AttributedCharacterIterator iterator = format.formatToCharacterIterator(arg); while (iterator.getIndex() != iterator.getEndIndex()) { int start = iterator.getRunStart(); int end = iterator.getRunLimit(); Iterator<?> it = iterator.getAttributes().keySet().iterator(); while (it.hasNext()) { AttributedCharacterIterator.Attribute attribute = (AttributedCharacterIterator.Attribute) it.next(); Object value = iterator.getAttribute(attribute); fields.add(new FieldContainer(begin + start, begin + end, attribute, value)); } iterator.setIndex(end); } }
iterator.setIndex(start); while (iterator.getIndex() < end) { Object value = iterator.getAttribute(attribute); int runStart = iterator.getRunStart(attribute); int limit = iterator.getRunLimit(attribute);
int start = iterator.getRunStart(attribute); int limit = iterator.getRunLimit(attribute); Object value = iterator.getAttribute(attribute); if (value != null) { addAttribute(attribute, value, start, limit);
Object direction = paragraph.getAttribute(TextAttribute.RUN_DIRECTION); if (direction != null && direction instanceof Boolean) { if (direction.equals(TextAttribute.RUN_DIRECTION_LTR)) { .getRunLimit(TextAttribute.BIDI_EMBEDDING) - begin + 1) { Object embedding = paragraph.getAttribute(TextAttribute.BIDI_EMBEDDING); if (embedding != null && embedding instanceof Integer) { int embLevel = ((Integer) embedding).intValue(); Object numericShaper = paragraph.getAttribute(TextAttribute.NUMERIC_SHAPING); if (numericShaper != null && numericShaper instanceof NumericShaper) { ((NumericShaper) numericShaper).shape(text, 0, length);
Paint fgPaint; if (fgPaintStyle == null) { fgPaint = (Paint)firstLineAttr.getAttribute(TextAttribute.FOREGROUND); } else { fgPaint = new DrawPaint(ps).getPaint(graphics, fgPaintStyle); float fontSize = (Float)firstLineAttr.getAttribute(TextAttribute.SIZE); Double buSz = bulletStyle.getBulletFontSize(); if (buSz == null) {
float calculateWidth(PDFont font, float fontSize) throws IOException { final float scale = fontSize/FONTSCALE; float calculatedWidth = 0f; for (Word word : words) { calculatedWidth = calculatedWidth + (Float) word.getAttributes().getIterator().getAttribute(TextAttribute.WIDTH); String text = word.getText(); if (words.indexOf(word) == words.size() -1 && Character.isWhitespace(text.charAt(text.length()-1))) { float whitespaceWidth = font.getStringWidth(text.substring(text.length()-1)) * scale; calculatedWidth = calculatedWidth - whitespaceWidth; } } return calculatedWidth; }
float calculateWidth(PDFont font, float fontSize) throws IOException { final float scale = fontSize/FONTSCALE; float calculatedWidth = 0f; for (Word word : words) { calculatedWidth = calculatedWidth + (Float) word.getAttributes().getIterator().getAttribute(TextAttribute.WIDTH); String text = word.getText(); if (words.indexOf(word) == words.size() -1 && Character.isWhitespace(text.charAt(text.length()-1))) { float whitespaceWidth = font.getStringWidth(text.substring(text.length()-1)) * scale; calculatedWidth = calculatedWidth - whitespaceWidth; } } return calculatedWidth; }
wordWidth = (Float) word.getAttributes().getIterator().getAttribute(TextAttribute.WIDTH); if (words.indexOf(word) != words.size() -1)
wordWidth = (Float) word.getAttributes().getIterator().getAttribute(TextAttribute.WIDTH); if (words.indexOf(word) != words.size() -1)
/** * Get the value of the named attribute for the current * character. */ public Object getAttribute(AttributedCharacterIterator.Attribute attribute) { return reorderedACI.getAttribute(attribute); }
/** * Get the value of the named attribute for the current * character. */ public Object getAttribute(AttributedCharacterIterator.Attribute attribute) { return aci.getAttribute(attribute); }
/** * Get the value of the named attribute for the current * character. */ public Object getAttribute(AttributedCharacterIterator.Attribute attribute) { return reorderedACI.getAttribute(attribute); }
/** * Get the value of the named attribute for the current * character. */ public Object getAttribute(AttributedCharacterIterator.Attribute attribute) { return aci.getAttribute(attribute); }
@Override public void draw(Graphics2D g2d, AttributedCharacterIterator arg1) { if (arg1.getAttribute(TextAttribute.PAINT_INFO) != null) { TextPaintInfo info = (TextPaintInfo) arg1.getAttribute(TextAttribute.PAINT_INFO); // TODO: Rest of stuff in info. g2d.setPaint(info.fillPaint); } g2d.fill(this.vec.getOutline()); }
/** * Returns true if the text direction in this layout is from left to right. */ public boolean isLeftToRight() { aci.first(); int bidiLevel = (Integer) aci.getAttribute (GVTAttributedCharacterIterator.TextAttribute.BIDI_LEVEL); // Check if low bit is set if not then we are left to right // (even bidi level). return ((bidiLevel&0x01) == 0); }
public boolean isPrinting() { if (aci.getAttribute(PREFORMATTED) == Boolean.TRUE) return true; return isPrinting(ch); }
public boolean isPrinting() { if (aci.getAttribute(PREFORMATTED) == Boolean.TRUE) return true; return isPrinting(ch); }
/** * Returns whether or not the vertical glyph orientation value is "auto". */ protected boolean isGlyphOrientationAuto() { if (!isVertical()) return false; aci.first(); Integer vOrient = (Integer)aci.getAttribute(VERTICAL_ORIENTATION); if (vOrient != null) { return (vOrient == ORIENTATION_AUTO); } return true; }
/** * Returns whether or not the vertical glyph orientation value is "auto". */ protected boolean isGlyphOrientationAuto() { if (!isVertical()) return false; aci.first(); Integer vOrient = (Integer)aci.getAttribute(VERTICAL_ORIENTATION); if (vOrient != null) { return (vOrient == ORIENTATION_AUTO); } return true; }