Ejemplo n.º 1
0
void TestMoblet::testLoadWithName()
{
	mShowing = 2;

	maSetColor(0x000000);
	MAExtent size = maGetScrSize();
	maFillRect(0,0,EXTENT_X(size),EXTENT_Y(size) );

	maSetColor(0xCD5555);

	int top = 0;
	maDrawText(10,top,"--------- Test maFontLoadWithName(test each name from list) --------- ");
	top += 20;

	for (int i=0; i<fontNames.size(); i++)
	{
		top += 20;
		int handle = maFontLoadWithName(fontNames[i].c_str(), 15);
		if ( handle == RES_FONT_NAME_NONEXISTENT )
		{
			message = "Font nonexistent: " + fontNames[i];
			maDrawText(10,top, message.c_str());
		}
		else
		{
			maFontSetCurrent(handle);
			message =  "Font " + fontNames[i] + " has handle = " + MAUtil::integerToString(handle);
			maDrawText(10, top, message.c_str());
		}
	}

	maDrawText(10, top+40, "Tap screen to test maFontLoadDefault for some combinations");
	maUpdateScreen();
}
Ejemplo n.º 2
0
/*
 * @brief Sets the font
 * to display the sensors values.
 */
void setFont()
{
	int nrFonts = maFontGetCount();
	char fontName[BUFFER_SIZE];
	// get first font.
	maFontGetName(0, fontName, BUFFER_SIZE);
	// Load first font with size 20.
	int fontHandle = maFontLoadWithName(fontName, TEXT_SIZE);
	maFontSetCurrent(fontHandle);
}
Ejemplo n.º 3
0
/*
 * @brief Sets the font
 * to display the sensors values.
 */
void setFont()
{
	MAHandle defaultFont = maFontLoadDefault(FONT_TYPE_SANS_SERIF, 0, TEXT_SIZE);
	//Check if it's implemented on the current platform.
	if (0 > defaultFont)
	{
		maPanic(0, "Device fonts is only available on Android and iOS.");
	}
	maFontSetCurrent(defaultFont);
}
Ejemplo n.º 4
0
// reinit for new program run
void AnsiWidget::reset() {
  _back = _front = _screens[USER_SCREEN1];
  _back->reset(_fontSize);
  _back->clear();

  // reset user screens
  delete _screens[USER_SCREEN2];
  delete _screens[TEXT_SCREEN];
  _screens[USER_SCREEN2] = NULL;
  _screens[TEXT_SCREEN] = NULL;

  maFontSetCurrent(_back->_font);
  redraw();
}
Ejemplo n.º 5
0
void TestMoblet::testFont (int family, int style, int size, int top)
{
	MAHandle font = maFontLoadDefault(family,style,size);
	if ( font == RES_FONT_INVALID_SIZE)
	{
		maSetColor(0xCD3333);
		maDrawText(200,top,"Invalid size");
		maSetColor(0xC1FFC1);
	}
	else if( font == RES_FONT_NO_TYPE_STYLE_COMBINATION)
	{
		maSetColor(0xCD3333);
		maDrawText(200,top,"No type style combination");
		maSetColor(0xC1FFC1);
	}
	else
	{
		maFontSetCurrent(font);
		MAUtil::String message = "Ok, handle: " + MAUtil::integerToString(font);
		maDrawText(200, top, message.c_str());
	}
}