public int fontSize() { return intf.app.g.textFont.getSize(); }
public float getFullHeight() { return bounds.h.getTarget() + pFont.getSize(); }
protected void textCharImpl(char ch, float x, float y) { //, float z) { PFont.Glyph glyph = textFont.getGlyph(ch); if (glyph != null) { if (textMode == MODEL) { float high = glyph.height / (float) textFont.getSize(); float bwidth = glyph.width / (float) textFont.getSize(); float lextent = glyph.leftExtent / (float) textFont.getSize(); float textent = glyph.topExtent / (float) textFont.getSize(); float x1 = x + lextent * textSize; float y1 = y - textent * textSize; float x2 = x1 + bwidth * textSize; float y2 = y1 + high * textSize; textCharModelImpl(glyph.image, x1, y1, x2, y2, glyph.width, glyph.height); } } else if (ch != ' ' && ch != 127) { showWarning("No glyph found for the " + ch + " (\\u" + PApplet.hex(ch, 4) + ") character"); } }
@Override protected void textCharImpl(char ch, float x, float y) { //, float z) { PFont.Glyph glyph = textFont.getGlyph(ch); if (glyph != null) { if (textMode == MODEL) { float high = glyph.height / (float) textFont.getSize(); float bwidth = glyph.width / (float) textFont.getSize(); float lextent = glyph.leftExtent / (float) textFont.getSize(); float textent = glyph.topExtent / (float) textFont.getSize(); float x1 = x + lextent * textSize; float y1 = y - textent * textSize; float x2 = x1 + bwidth * textSize; float y2 = y1 + high * textSize; PImage glyphImage = (fillColor == 0xFFFFFFFF) ? glyph.image : getTintedGlyphImage(glyph, fillColor); textCharModelImpl(glyphImage, x1, y1, x2, y2, glyph.width, glyph.height); } } else if (ch != ' ' && ch != 127) { showWarning("No glyph found for the " + ch + " (\\u" + PApplet.hex(ch, 4) + ") character"); } }
@Override protected void textCharImpl(char ch, float x, float y) { PFont.Glyph glyph = textFont.getGlyph(ch); if (glyph != null) { if (textMode == MODEL) { FontTexture.TextureInfo tinfo = textTex.getTexInfo(glyph); if (tinfo == null) { // Adding new glyph to the font texture. tinfo = textTex.addToTexture(this, glyph); } float high = glyph.height / (float) textFont.getSize(); float bwidth = glyph.width / (float) textFont.getSize(); float lextent = glyph.leftExtent / (float) textFont.getSize(); float textent = glyph.topExtent / (float) textFont.getSize(); float x1 = x + lextent * textSize; float y1 = y - textent * textSize; float x2 = x1 + bwidth * textSize; float y2 = y1 + high * textSize; textCharModelImpl(tinfo, x1, y1, x2, y2); } else if (textMode == SHAPE) { textCharShapeImpl(ch, x, y); } } }
@Override protected void textCharImpl(char ch, float x, float y) { PFont.Glyph glyph = textFont.getGlyph(ch); if (glyph != null) { if (textMode == MODEL) { FontTexture.TextureInfo tinfo = textTex.getTexInfo(glyph); if (tinfo == null) { // Adding new glyph to the font texture. tinfo = textTex.addToTexture(this, glyph); } float high = glyph.height / (float) textFont.getSize(); float bwidth = glyph.width / (float) textFont.getSize(); float lextent = glyph.leftExtent / (float) textFont.getSize(); float textent = glyph.topExtent / (float) textFont.getSize(); float x1 = x + lextent * textSize; float y1 = y - textent * textSize; float x2 = x1 + bwidth * textSize; float y2 = y1 + high * textSize; textCharModelImpl(tinfo, x1, y1, x2, y2); } else if (textMode == SHAPE) { textCharShapeImpl(ch, x, y); } } }
SearchBox(float x, float y, float w, float h) { this.x = x; this.y = y; this.w = w; this.h = h; pFont = getStyleFont("InfoBar.SearchAdd.SearchBar.p", "font-family", "font-size"); pColor = getStyleColor("InfoBar.SearchAdd.SearchBar.p", "color"); sColor = getStyleColor("InfoBar.SearchAdd.SearchBar.SearchResult.p.seachedText", "color"); bColor = getStyleColor("InfoBar.SearchAdd.SearchBar", "background-color"); searchStr = new EditableText(SearchBar.this, "Search for a variable"); searchStr.clearInitial(); searchStr.setBound(w - pad5 - pFont.getSize()); }
public void draw() { fill(color, hoverAlpha.getFloor()); rect(0, 0, width, height); float center = (height - pFont.getSize()) / 2; fill(pColor); textFont(pFont); if (shiftLabel != null && hovered && keyPressed(ALT)) { text(shiftLabel, 5, height - center); } else { text(label, btnOffsetX, height - center); } }
protected void initTexture(PGraphicsOpenGL pg, PFont font) { currentTex = -1; lastTex = -1; int spow = PGL.nextPowerOfTwo(font.getSize()); minSize = PApplet.min(PGraphicsOpenGL.maxTextureSize, PApplet.max(PGL.MIN_FONT_TEX_SIZE, spow)); maxSize = PApplet.min(PGraphicsOpenGL.maxTextureSize, PApplet.max(PGL.MAX_FONT_TEX_SIZE, 2 * spow)); if (maxSize < spow) { PGraphics.showWarning("The font size is too large to be properly " + "displayed with OpenGL"); } addTexture(pg); offsetX = 0; offsetY = 0; lineHeight = 0; texinfoMap = new HashMap<PFont.Glyph, TextureInfo>(); glyphTexinfos = new TextureInfo[font.getGlyphCount()]; addAllGlyphsToTexture(pg, font); }
protected void initTexture(PGraphicsOpenGL pg, PFont font) { lastTex = -1; int spow = PGL.nextPowerOfTwo(font.getSize()); minSize = PApplet.min(PGraphicsOpenGL.maxTextureSize, PApplet.max(PGL.MIN_FONT_TEX_SIZE, spow)); maxSize = PApplet.min(PGraphicsOpenGL.maxTextureSize, PApplet.max(PGL.MAX_FONT_TEX_SIZE, 2 * spow)); if (maxSize < spow) { PGraphics.showWarning("The font size is too large to be properly " + "displayed with OpenGL"); } addTexture(pg); offsetX = 0; offsetY = 0; lineHeight = 0; texinfoMap = new HashMap<PFont.Glyph, TextureInfo>(); glyphTexinfos = new TextureInfo[font.getGlyphCount()]; addAllGlyphsToTexture(pg, font); }
void draw() { if (selected) { fill(sColor); } else { fill(bColor); } rect(x, y, w, h); float yc = (h - pFont.getSize()) / 2; fill(pColor); textFont(pFont); textAlign(pAlign); text(label, x, y + yc - pad3, w, h); textAlign(PConstants.LEFT); }
public void draw() { int maxa = data.sorting() ? 50 : 255; noStroke(); fill(bkColor, maxa); rect(0, 0, width, height); stroke(ptBrColor, maxa); fill(ptInColor, maxa); ellipse(20, height/2, 15, 15); fill(h2Color, maxa); textFont(h2Font); float yc = (height - h2Font.getSize()) / 2; text("Export selection", exportSelX, height - yc); }
void draw() { int alpha = maxAlpha.getCeil(); if (alpha < 1) return; float y = height - h - yoff; if (state == FULLY_SELECTED) { noStroke(); fill(slColor, alpha); } else if (state == PARTIALLY_SELECTED) { noStroke(); fill(smColor, alpha); } else if (state == DESELECTED) { stroke(nnColor, alpha); noFill(); } rect(x, y, w, h); fill(pColor, alpha); textFont(pFont); float yc = (h - pFont.getSize()) / 2; text(label, x + w + 5, y + h - yc - labelPad); }
void mousePressed() { if (setRange()) { textFont(pFont); float leftStrW = textWidth(leftStr); float xc = x + w/2; float yc = (h - pFont.getSize()) / 2; if (leftStr.inside(xc - toStrW/2 - leftStrW, y + h - yc, mouseX, mouseY)) { leftStr.setFocused(true); } else { leftStr.setFocused(false); } if (rightStr.inside(xc + toStrW/2, y + insidey, mouseX, mouseY)) { rightStr.setFocused(true); } else { rightStr.setFocused(false); } } else if (inside(mouseX, mouseY)) { if (mouseX - x < w/2) { leftStr.setFocused(true); } else { rightStr.setFocused(true); } } }
void draw() { float x0 = x.get() - visX0.get(); float y0 = y.get(); noStroke(); if (itemHeight < h.get()) { fill(oColor, maxAlpha.getCeil()); rect(x0 + padding, y0, w - 2 * padding, h.get()); fill(bColor, maxAlpha.getCeil()); rect(x0 + padding, y0, w - 2 * padding, itemHeight); } else { fill(bColor, maxAlpha.getCeil()); rect(x0 + padding, y0, w - 2 * padding, h.get()); } textFont(hFont); fill(hColor, maxAlpha.getCeil()); String label = var.getName(); String alias = var.getAlias(); if (!label.equals(alias)) label += ": " + alias; label = chopStringRight(label, w - padding - crossw - marginx*2); text(label, x0 + marginx, y0 + hFont.getSize() + htexty); textFont(pFont); String range = var.formatRange(mira.ranges.get(var)); range = chopStringRight(range, w - padding - crossw - 20); text(range, x0 + marginx, y0 + textLeading() + hFont.getSize() + ptexty); drawDismiss(); }
void draw() { boolean set = setRange(); strokeWeight(brWeight); // stroke(brColor); if (selected) { stroke(set ? sColor : uColor); fill(set ? sColor : uColor); rect(x, y.get(), w, h); } else { stroke(set ? sColor : uColor); noFill(); rect(x, y.get(), w, h); } float yc = (h - pFont.getSize()) / 2; fill(pColor); textFont(pFont); text(label, x + w + 5, y.get() + h - yc); // textFont(pFont); // float w1 = textWidth(label); // if (w1 < width/2 - w) { // w1 = PApplet.min(WIDTH_FACTOR * w1, width/2 - w); // } // fill(color(255, 0, 0, 100)); // rect(x, y.get(), w + 5 + w1, h); }
public void draw() { noStroke(); fill(bColor); rect(0, 0, width - padding, height); textFont(pFont); String label = currentCount + " of " + totalCount + " data points selected"; float tw = textWidth(label); float w0 = rxpad + tw + rxpad; if (currentCount < totalCount) w0 += rxinc; if (0 < rx.get()) { rx.setTarget(width - w0 - rxpad*2); } else { rx.set(width - w0 - rxpad*2); } fill(rColor); if (currentCount < totalCount) { tint(color(255), ia.getCeil()); shape(rIcon, tw + iconx, height/2 - icony, iconw, iconh); tint(color(255)); } fill(pColor); float yc = (height - pFont.getSize()) / 2; text(label, 10, height - yc); }
void draw() { noStroke(); fill(bColor); rect(x, y, w, h); // shadows beginShape(QUAD); fill(color(0), 20); vertex(x, y); vertex(x + w, y); fill(color(0), 0); vertex(x + w, y - pad10); vertex(x, y - pad10); endShape(); textFont(pFont); if (searchStr.isFocused()) { fill(sColor); stroke(sColor); } else { fill(pColor); stroke(pColor); } float yc = (h - pFont.getSize()) / 2; text(searchStr, x + pad10, y + h - yc); }