@@ -144,7 +144,11 @@ private static class JSTextMetrics {
144144 float actualBoundingBoxAscent ;
145145 float actualBoundingBoxRight ;
146146 float actualBoundingBoxDescent ;
147+ float fontBoundingBoxAscent ;
148+ float fontBoundingBoxDescent ;
149+ float offsetX , offsetY ;
147150 private String text ;
151+ private float logicalWidth ;
148152
149153
150154 public JSTextMetrics (String text , JSTextMetrics tm ) {
@@ -154,6 +158,11 @@ public JSTextMetrics(String text, JSTextMetrics tm) {
154158 this .actualBoundingBoxDescent = tm .actualBoundingBoxDescent ;
155159 this .actualBoundingBoxLeft = tm .actualBoundingBoxLeft ;
156160 this .actualBoundingBoxRight = tm .actualBoundingBoxRight ;
161+ this .fontBoundingBoxAscent = tm .fontBoundingBoxAscent ;
162+ this .fontBoundingBoxDescent = tm .fontBoundingBoxDescent ;
163+ this .logicalWidth = actualBoundingBoxRight - actualBoundingBoxLeft ;
164+ this .offsetX = -actualBoundingBoxLeft ;
165+ this .offsetY = actualBoundingBoxAscent + fontBoundingBoxDescent ;
157166// System. intln("jstxtm"
158167// + " " + this.actualBoundingBoxLeft
159168// + " " + this.actualBoundingBoxRight
@@ -169,8 +178,9 @@ protected Rectangle2D.Float getActualBounds(float x0, float y0) {
169178 }
170179
171180 protected float getLogicalWidth () {
172- return actualBoundingBoxRight - actualBoundingBoxLeft ;
181+ return logicalWidth ;
173182 }
183+
174184 }
175185
176186
0 commit comments