- // int hght = (int) (ht + (newAsc - newDec - lm.getBaselineOffsets()[lm.getBaselineIndex()]));
-
- // original:
-
- if (/** @j2sNative false && */ true) {
- int hght = (int) (ht + (newAsc - newDec)); // Q: why " - newDec " ? (0,0) is on the font baseline, I think
- Font font = ofont.deriveFont(AffineTransform.getScaleInstance(sx, sy));
- g.setFont(font);
- g.drawChars(dc, 0, dc.length, x * charWidth, hght);
- ht += newHeight;
- } else {
- // SwingJS does not implement font.deriveFont()
- // this is off by a very small amount.
- int hght2 = (int) (ht2 + newAsc);
- Graphics2D gg = (Graphics2D) g.create();
- gg.setFont(ofont);
+ // int hght = (int) (ht + (newAsc - newDec);
+ // - lm.getBaselineOffsets()[lm.getBaselineIndex()]));
+
+ if (Jalview.isJS())
+ {
+ /*
+ * SwingJS does not implement font.deriveFont()
+ * so use a scaling transform to draw instead,
+ * this is off by a very small amount
+ */
+ final int hght = (int) (ht2 + (newAsc - newDec));
+ Graphics2D gg = (Graphics2D) g;
+ int xShift = (int) Math.round(x * charWidth / sx);
+ int yShift = (int) Math.round(hght / sy);