@@ -144,7 +144,11 @@ private static class JSTextMetrics {
144
144
float actualBoundingBoxAscent ;
145
145
float actualBoundingBoxRight ;
146
146
float actualBoundingBoxDescent ;
147
+ float fontBoundingBoxAscent ;
148
+ float fontBoundingBoxDescent ;
149
+ float offsetX , offsetY ;
147
150
private String text ;
151
+ private float logicalWidth ;
148
152
149
153
150
154
public JSTextMetrics (String text , JSTextMetrics tm ) {
@@ -154,6 +158,11 @@ public JSTextMetrics(String text, JSTextMetrics tm) {
154
158
this .actualBoundingBoxDescent = tm .actualBoundingBoxDescent ;
155
159
this .actualBoundingBoxLeft = tm .actualBoundingBoxLeft ;
156
160
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 ;
157
166
// System. intln("jstxtm"
158
167
// + " " + this.actualBoundingBoxLeft
159
168
// + " " + this.actualBoundingBoxRight
@@ -169,8 +178,9 @@ protected Rectangle2D.Float getActualBounds(float x0, float y0) {
169
178
}
170
179
171
180
protected float getLogicalWidth () {
172
- return actualBoundingBoxRight - actualBoundingBoxLeft ;
181
+ return logicalWidth ;
173
182
}
183
+
174
184
}
175
185
176
186
0 commit comments