/** * Initialize the paragraph-specific data. */ private void paragraphInit(byte aBaseline, CoreMetrics lm, Map<? extends Attribute, ?> paragraphAttrs, char[] text) { baseline = aBaseline; // normalize to current baseline baselineOffsets = TextLine.getNormalizedOffsets(lm.baselineOffsets, baseline); justifyRatio = AttributeValues.getJustification(paragraphAttrs); NumericShaper shaper = AttributeValues.getNumericShaping(paragraphAttrs); if (shaper != null) { shaper.shape(text, 0, text.length); } }
private void fastInit(char[] chars, Font font, Map<? extends Attribute, ?> attrs, FontRenderContext frc) { // Object vf = attrs.get(TextAttribute.ORIENTATION); // isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf); isVerticalLine = false; LineMetrics lm = font.getLineMetrics(chars, 0, chars.length, frc); CoreMetrics cm = CoreMetrics.get(lm); byte glyphBaseline = (byte) cm.baselineIndex; if (attrs == null) { baseline = glyphBaseline; baselineOffsets = cm.baselineOffsets; justifyRatio = 1.0f; } else { paragraphInit(glyphBaseline, cm, attrs, chars); } characterCount = chars.length; textLine = TextLine.fastCreateTextLine(frc, chars, font, cm, attrs); }
public CoreMetrics getCoreMetricsAt(int logicalIndex) { if (logicalIndex < 0) { throw new IllegalArgumentException("Negative logicalIndex."); } if (logicalIndex > fCharsLimit - fCharsStart) { throw new IllegalArgumentException("logicalIndex too large."); } int currentTlc = 0; int tlcStart = 0; int tlcLimit = 0; do { tlcLimit += fComponents[currentTlc].getNumCharacters(); if (tlcLimit > logicalIndex) { break; } ++currentTlc; tlcStart = tlcLimit; } while(currentTlc < fComponents.length); return fComponents[currentTlc].getCoreMetrics(); }
private void fastInit(char[] chars, Font font, Map attrs, FontRenderContext frc) { // Object vf = attrs.get(TextAttribute.ORIENTATION); // isVerticalLine = TextAttribute.ORIENTATION_VERTICAL.equals(vf); isVerticalLine = false; LineMetrics lm = font.getLineMetrics(chars, 0, chars.length, frc); CoreMetrics cm = CoreMetrics.get(lm); byte glyphBaseline = (byte) cm.baselineIndex; if (attrs == null) { baseline = glyphBaseline; baselineOffsets = cm.baselineOffsets; justifyRatio = 1.0f; } else { paragraphInit(glyphBaseline, cm, attrs, chars); } characterCount = chars.length; textLine = TextLine.fastCreateTextLine(frc, chars, font, cm, attrs); }