MCPcopy Create free account
hub / github.com/Card-Forge/forge / drawText

Method drawText

forge-gui-mobile/src/forge/toolbox/FTextField.java:429–440  ·  view source on GitHub ↗
(Graphics g, float w, float h)

Source from the content-addressed store, hash-verified

427 }
428
429 private void drawText(Graphics g, float w, float h) {
430 float diff = h - renderedFont.getCapHeight();
431 if (diff > 0 && Math.round(diff) % 2 == 1) {
432 h++; //if odd difference between height and font height, increment height so text favors displaying closer to bottom
433 }
434 if (!text.isEmpty()) {
435 g.drawText(text, renderedFont, getForeColor(), getLeftPadding(), 0, w - getLeftPadding() - getRightPadding(), h, false, alignment, true);
436 }
437 else if (!ghostText.isEmpty()) {
438 g.drawText(ghostText, renderedFont, getGhostTextColor(), getLeftPadding(), 0, w - getLeftPadding() - getRightPadding(), h, false, alignment, true);
439 }
440 }
441
442 protected float getTextLeft() {
443 switch (alignment) {

Callers 1

drawMethod · 0.95

Calls 6

getForeColorMethod · 0.95
getLeftPaddingMethod · 0.95
getRightPaddingMethod · 0.95
getGhostTextColorMethod · 0.95
isEmptyMethod · 0.65
getCapHeightMethod · 0.45

Tested by

no test coverage detected