Create menuitem with custom Font - cocos2d-x

I am using the below code
MenuItemFont* supportMenuItem = MenuItemFont::create("Contact us for support",
CC_CALLBACK_1(TempLogoLayer::supportMenuClicked, this));
supportMenuItem->setPosition(Vec2(100,100));
supportMenuItem->setFontName("Arial");
supportMenuItem->setFontSize(16.0);
Menu *buttonsMenu = CCMenu::create(supportMenuItem, NULL);
buttonsMenu->setPosition(Vec2(0.0, 0.0));
this->addChild(buttonsMenu, 1)
But this menuitem is not taking font

for arial you can use Label instead
auto lbRate = Label::createWithSystemFont("4 Rate", "Arial", 35.0);
auto menuRate = MenuItemLabel::create(lbRate, CC_CALLBACK_1(PlayerSkin::onRate, this));
auto menu = Menu::create(menuRate, NULL);
this->addChild(menu, 10);

You could do this:
item = MenuItemFont::create("item 1");
item->retain();
auto back = MenuItemFont::create("go back", CC_CALLBACK_1(RemoveMenuItemWhenMove::goBack, this));
This is for cocos2d-x 3.2 you could check in the sample directory MenuTest.cpp and see how it works.

I realize this is really old, but someone else might probably stumble upon this post at some point:
For Cocos2dx 3.6 Try:
supportMenuItem->setFontNameObj("Arial");
Also make sure that a font called "Arial" is in the Fonts directory
This will actually do the trick. OP was close.

Related

'Pin To Start' custom tile

When a user 'Pins To Start' on their wp8 / wp8.1 phone, how can I change the image that is saved as the live tile? Can I modify this?
I am guessing there is some sort of meta-tag or something that I am not aware of.
EDIT Sorry, i really should have clarified, this is for when you pin to start a web-page and it appears in the start menu. I was sure there was a meta tag that went into the section that solved it. Or is it something to do with Favicon?
May be you can try this ,This is for pinning a secondary tile.I am unsure of the possibility for changing the image in primary tile
StandardTileData standardTileData = new StandardTileData();
standardTileData.BackgroundImage = new Uri("ApplicationIcon.png", UriKind.Relative);
standardTileData.Title = "Your title";
standardTileData.Count = 26;
standardTileData.BackTitle = "Pinned";
standardTileData.BackContent = "Tile";
standardTileData.BackBackgroundImage = "Your image URL";
ShellTile tiletopin = ShellTile.ActiveTiles.FirstOrDefault(x => x.NavigationUri.ToString().Contains("MainPage.xaml"));
if (tiletopin == null)
{
ShellTile.Create(new Uri("/MainPage.xaml", UriKind.Relative), standardTileData);
}
else
{
MessageBox.Show("Already Pinned");
}
To change the Images on the pinned tile you need to update the images in the WMAppManifest.xml file.
Open the WMAppManifest.xml file present in Properties in Solution Explorer:
Once you Open the file Go to Application UI Tab and update the icons for small, Medium and Large size. The Icon that comes up when you pin the Application icon is The Medium Icon. So that will come up:

AS3: Using embedded font

I embed font like this (FlashDevelop):
[ Embed( source = "Ubuntu-R.ttf", embedAsCFF = "false", fontFamily = "Ubuntu" ) ]
private static const Ubuntu : Class;
Then try to use like this:
var textField : TextField = new TextField;
textField.embedFonts = true;
textField.defaultTextFormat = new TextFormat( "Ubuntu", 22 );
textField = "免費旋轉 ПРИВЕТ HELLO";
addChild( textField );
Only russian and english parts of the text visible, but not japanese (my PC is russian). If to comment textField.embedFonts = true; line, then the whole text will be visible, but some other (seems like Arial) font used.
Call to Font.enumerateFonts( false ); returns array with one font called "Ubuntu".
Call to Font.registerFont( Ubuntu ); at any place doesn't help.
Adding parameters fontName, unicodeRange = "U+0000-U+FFFF", mimeType = "application/x-font-truetype", fontWeight, advancedAntiAliasing to the font embed directive with different attributes do not change the behavior.
Seems like dead end, but please help.
The font you use does not contain the required glyphs for Japanese. You might try another font, make sure though it has enough glyphs in there. A hint: if the font isn't as big as 1 megabyte, most likely it has neither japanese nor chinese glyphs, if it's bigger, then try embedding and check with hasGlyphs() if it has enough. Once you'll find the correct font, embed and enjoy. But, I'd say use a font that's widely distributed and has japanese glyphs by design, say Arial.

Highlight SimpleMarkerSymbol when item on data grid is clicked (ArcGis - esri)

Ideally what I'd like to happen is when an item from the data grid is clicked, the corresponding map icon would get a "halo" around it making it stand out from the other markers.
This is what I have based on Esri's exmaples but I'm missing something...
var sms = new esri.symbol.SimpleMarkerSymbol(
esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE,
new esri.symbol.SimpleLineSymbol(
esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([111, 0, 255]),
2
),
new dojo.Color([111, 0, 255, 0.15])
);
this.map.graphics.add(new esri.Graphic(data.geometry, sms, { "type": "parcel-highlight" }));
I'm wondering if I'm using the wrong method here to accomplish what I'm trying to accomplish. There are no errors generated - the desired effect just isn't happening is all (well, nothing is happening actually).
I was able to speak to the original developer who pointed me to the Esri legacy samples which provided the syntax for what I was trying to do.
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,0,0]), 1),
new dojo.Color([0,255,0,0.25]));
App.map.graphics.add(new esri.Graphic(queryResults[0].feature.geometry, symbol));
App.vent.trigger('Search:ShowIdentifyResult', [queryResults.features[0]]);

p:lineChart - continuous line, without dots

how to remove the dots from p:lineChart and draw the chart as just the continuous line?
Thanks
For others with similar problem, I did:
<p:chart type="line" model="#{myController.model}"/>
and:
LineChartSeries serie = new LineChartSeries();
serie.setShowMarker(false);
and worked fine. I'm using PrimeFaces 5.1.
There is a showMarkers attribute that isn't working for me (I'm using PrimeFaces 3.4.2) but I found a way to hide them.
It's a bit hacky, I made it working on the showcase, you just need to replace widget_category by the widget of your chart. You can even test it online from the showcase using a javascript console if your web browser allows it (tested under chromium) :
// loop through the series
for (var i = 0; i < widget_category.cfg.series.length; ++i) {
// Hide markers
widget_category.cfg.series[i].showMarker = false;
// I'm not sure you want this when talking about 'continuous line'
// but you can make your chart smooth this way :
widget_category.cfg.series[i].rendererOptions = { smooth: true };
}
// Ask a refresh using the modified configuration object
widget_category.refresh(widget_category.cfg);

MediaWiki variant tabs

Anyone knows how to get the variant tabs to work as actual tabs and not as a drop down?
This is how sr.wikipedia.org has it:
and this is how I have it on my zablude.com/wiki/ page:
and I've tried everything I found and searched everywhere I could think of but I wasn't able to find a solution... anyone has any ideas how this works?
They hack it in JavaScript — see this piece of code at the bottom of Медијавики:Vector.js:
//to be able to switch the language variant (overrides the default buttons with more visible ones)
function tabWorkaround() {
if(mw.config.get('wgUserVariant') == 'sr') {
var tab_urls = {};
tab_urls[0] = document.getElementById('ca-varlang-0').getElementsByTagName('a')[0].href; //Ћирилица
tab_urls[1] = document.getElementById('ca-varlang-1').getElementsByTagName('a')[0].href; //Latinica
$('#p-variants').remove();
mw.util.addPortletLink('p-namespaces', tab_urls[0], 'Ћирилица');
mw.util.addPortletLink('p-namespaces', tab_urls[1], 'Latinica');
}
}
$(document).ready(tabWorkaround);
It would probably be cleaner to do it with a MediaWiki hook, though. The following code is untested, but should work if I haven't made any silly mistakes:
// show language variants as tabs in Vector skin
function tabWorkaround( &$skintemplate, &$links ) {
$links['namespaces'] += $links['variants'];
$links['variants'] = array();
return true;
}
$wgHooks['SkinTemplateNavigation::Universal'][] = 'tabWorkaround';
(In MW 1.17, this hook is only called from the Vector skin. In MW 1.18, it will affect all skins. If you don't want that, you could test whether $skintemplate->skinname == 'vector'.)
Try $wgVectorFeatures['collapsibletabs']['global'] = false;. That is intended for the dropdown on the other side, but might work for other dropdowns as well.