/*!
    This method is just like drawChars() except it treats yoff as position of the font
    baseline. The default implementation simply subtracts the ascent of the current font
    from yoff and calls drawChars(), which should work on all platforms except for win32.

    On win32 because of the trickery we use to achieve wysiwyg layout the acent of the
    font we work with is slightly smaller than that of the actual font the system uses to
    draw on the screen. As a result, the characters end up positioned slightly higher than
    they should and this has proved a problem in the math plugin (see screen shots in #9500)
*/
void GR_Graphics::drawCharsRelativeToBaseline(const UT_UCSChar* pChars,
								 int iCharOffset,
								 int iLength,
								 UT_sint32 xoff,
								 UT_sint32 yoff,
								 int* pCharWidths)
{
	drawChars(pChars, iCharOffset, iLength, xoff, yoff - getFontAscent(), pCharWidths);
}
Beispiel #2
0
/**
 * Instantiates, configures, and returns label for scoreboard.
 */
GLabel initScoreboard(GWindow window)
{
    GLabel label = newGLabel("0");
    setFont(label, "SansSerif-24");
    double x = (getWidth(window) - getWidth(label)) / 2;
    double y = (getHeight(window) + getFontAscent(label)) / 2;
    setLocation(label, x, y);
    add(window, label);
    return label;
}
/**
 * Instantiates, configures, and returns label for scoreboard.
 */
GLabel initScoreboard(GWindow window)
{
  GLabel label = newGLabel("CLICK");
  double x = (WIDTH - getWidth(label)) / 2;
  double y = (HEIGHT + getFontAscent(label)) / 2;
  setFont(label, "Courier 10 Pitch-bold-50");
  setColor(label, "#cccccc");
  setLocation(label, x, y);
  sendToBack(label);
  return label;
}
Beispiel #4
0
/**
 * Updates scoreboard's label, keeping it centered in window.
 */
void updateScoreboard(GWindow window, GLabel label, int points)
{
    // update label
    char s[12];
    sprintf(s, "%i", points);
    setLabel(label, s);

    // center label in window
    double x = (getWidth(window) - getWidth(label)) / 2;
    double y = ((getHeight(window) + getFontAscent(label)) / 2) - 40;
    setLocation(label, x, y);
}
/**
 * Instantiates, configures, and returns label for scoreboard.
 */
GLabel initScoreboard(GWindow window)
{
    // initaes a scorebord and return type GLabel
        double x,y;
        GLabel label = newGLabel("0");
        setFont(label, "Arial-45");
        x = (getWidth(window) - getWidth(label)) / 2;
        y = (getHeight(window) + getFontAscent(label)) / 2;
        setLocation(label, x, y-50);
        add(window, label);
        sendBackward(label);    //send label backwords

    return label;
}
Beispiel #6
0
/**
 * Instantiates, configures, and returns lives.
 */
GLabel initLivesBoard(GWindow window)
{
    GLabel label;
    double x, y;
    
    label = newGLabel("Lives: 3");
    setFont(label, "SansSerif-18");
    x = (getWidth(window) - getWidth(label)) / 2;
    y = ((getHeight(window) - getFontAscent(label)) / 2) -18;
    setLocation(label, x, y);
    add(window, label);
    
    return label;
}