1 18 19 package org.apache.batik.gvt.flow; 20 21 import org.apache.batik.gvt.font.GVTFont; 22 import org.apache.batik.gvt.font.GVTLineMetrics; 23 24 32 class WordInfo { 33 int index = -1; 34 float ascent=-1, descent=-1, lineHeight=-1; 35 GlyphGroupInfo [] glyphGroups=null; 36 Object flowLine=null; 37 38 WordInfo(int index) { 39 this.index = index; 40 } 41 42 WordInfo(int index, 43 float ascent, float descent, float lineHeight, 44 GlyphGroupInfo [] glyphGroups) { 45 this.index = index; 46 this.ascent = ascent; 47 this.descent = descent; 48 this.lineHeight = lineHeight; 49 this.glyphGroups = glyphGroups; 50 } 51 52 public int getIndex() { return index; } 53 54 public float getAscent() { return ascent; } 55 public void setAscent(float ascent) { this.ascent = ascent; } 56 57 public float getDescent() { return descent; } 58 public void setDescent(float descent) { this.descent = descent; } 59 60 public void addLineMetrics(GVTFont font, GVTLineMetrics lm) { 61 if (ascent < lm.getAscent()) 62 ascent = lm.getAscent(); 63 if (descent < lm.getDescent()) 64 descent = lm.getDescent(); 65 } 66 67 68 public float getLineHeight() { return this.lineHeight; } 69 public void setLineHeight(float lineHeight) { 70 this.lineHeight = lineHeight; } 71 public void addLineHeight(float lineHeight) { 72 if (this.lineHeight < lineHeight) 73 this.lineHeight = lineHeight; 74 } 75 76 public Object getFlowLine() { return this.flowLine; } 77 public void setFlowLine(Object fl) { this.flowLine = fl; } 78 79 public int getNumGlyphGroups() { 80 if (glyphGroups == null) 81 return -1; 82 return glyphGroups.length; 83 } 84 public void setGlyphGroups(GlyphGroupInfo []glyphGroups) { 85 this.glyphGroups = glyphGroups; 86 } 87 public GlyphGroupInfo getGlyphGroup(int idx) { 88 if (glyphGroups == null) return null; 89 return glyphGroups[idx]; 90 } 91 } 92 | Popular Tags |