46 |
* XXX Should glues also be virtual and have scale? |
* XXX Should glues also be virtual and have scale? |
47 |
* fonts scale non-uniformly, so should glue? |
* fonts scale non-uniformly, so should glue? |
48 |
*/ |
*/ |
49 |
protected int[] glues; |
protected float[] glues; |
|
|
|
50 |
|
|
51 |
public void addBox(HBox box) { |
public void addBox(HBox box) { |
52 |
ensureBoxes(nboxes+1, false); |
ensureBoxes(nboxes+1, false); |
56 |
box.setPrev(boxes[ind-1]); |
box.setPrev(boxes[ind-1]); |
57 |
} |
} |
58 |
|
|
59 |
public void addGlue(int len, int str, int shr) { |
public void addGlue(float len, float str, float shr) { |
60 |
glues[nboxes*3 + GLUE_LENGTH] += len; |
glues[nboxes*3 + GLUE_LENGTH] += len; |
61 |
glues[nboxes*3 + GLUE_STRETCH] += str; |
glues[nboxes*3 + GLUE_STRETCH] += str; |
62 |
glues[nboxes*3 + GLUE_SHRINK] += shr; |
glues[nboxes*3 + GLUE_SHRINK] += shr; |
70 |
return boxes[n]; |
return boxes[n]; |
71 |
} |
} |
72 |
|
|
73 |
public int getGlue(int n, int property) { |
public float getGlue(int n, int property) { |
74 |
if(property < 0 || property > 2) |
if(property < 0 || property > 2) |
75 |
throw new IllegalArgumentException("illegal property: "+property); |
throw new IllegalArgumentException("illegal property: "+property); |
76 |
return glues[(n * 3) + property]; |
return glues[(n * 3) + property]; |
87 |
*/ |
*/ |
88 |
void allocCopy(int n) { |
void allocCopy(int n) { |
89 |
HBox[] nboxes = new HBox[n]; |
HBox[] nboxes = new HBox[n]; |
90 |
int[] nglues = new int[3*(n+1)]; |
float[] nglues = new float[3*(n+1)]; |
91 |
if(boxes != null) { |
if(boxes != null) { |
92 |
System.arraycopy(boxes, 0, nboxes, 0, boxes.length); |
System.arraycopy(boxes, 0, nboxes, 0, boxes.length); |
93 |
System.arraycopy(glues, 0, nglues, 0, glues.length); |
System.arraycopy(glues, 0, nglues, 0, glues.length); |