How to set CustomFont for a CCLabel in COCOS2d-Android - cocos2d-android

I need to Create Custom Font for CCLabel in COCOS2d-Android.
currentVideoLabel = CCLabel.makeLabel(VideosLabels[currentSelected], "Faraco_Hand.ttf", winSize.width/41);
currentVideoLabel.setPosition(CGPoint.make(winSize.width/2, 20));
addChild(currentVideoLabel);

download some ttf font , create a folder called Font in assets folder.then place the downloaded ttf file in fonts folder.You can use the font in cclabel like this
currentVideoLabel = CCLabel.makeLabel(VideosLabels[currentSelected], "Fonts/Faraco_Hand.ttf", winSize.width/41);
actually all fonts are not supported in android. but you may try some.

Related

How to get font name from a file?

I've been using GetFontResourceInfoW to get font name from font file, but turns out it's not robust and often fails. This function works most of time if font is in the system fonts folder.
I need to get the font name without installing it. If font file is a collection of styles then I need the names of fonts in this collection.
Arial, Arial Black, Arial Italic etc. ..
I've looked into PrivateCollection of GDI+ but it doesn't support font files like .fon and .fnt and DirectWrite is worse. The legacy GDI supports all formats, but I can't find a function capable doing what I looking for.
Is there any other API I could use to accomplish this?

Qt draws text with otf font outside the element

Today I switched the font of my application from one of the standard system fonts to Sinkin in the form of an otf file, I've added to my resource.qrc.
The following code sets the default font of the application object.
int id = QFontDatabase::addApplicationFont(":/fonts/font.otf");
QString family = QFontDatabase::applicationFontFamilies(id).at(0);
qapp.setFont(family);
QFont font = qapp.font();
font.setPointSize(opt_font_size);
qapp.setFont(font);
Now it seems, that the font is placed a bit too high in all elements. That means buttons, labels, input fields and tabs. Or Qt does not realize, that it has to adjust the size of the elements to fit the new font.
Changing the font size via setPointSize does not fix it. Everything just gets smaller or bigger.
Any ideas where I can dig into?

Marlett Font: Can I load it and use it in WinAPI

What functions do I use to load the Marlett font in Native WinAPI(if its possible)?
I am attempting to create my own transparent checkbox in Native WinAPI. I am at the stage where I need to draw the checkbox tick therefore it would be cool if I could just load the Marlett font then TextOut() - ie print - the checkbox tick.
Maybe I need to obtain a copy of the Marlett font as a file then I load it in at runtime, or is it on all Windows OS's from 2k upwards?
http://www.siao2.com/2006/01/26/517738.aspx
This is answered trivially by consulting Wikipedia:
Marlett is a TrueType font that has been used in Microsoft Windows since Windows 95.
Hence you can just load the font using the conventional CreateFont or CreateFontIndirect, if you prefer.

Cocos2D font rendering issue

Observed one serious Cocos2D Font related problem
Please see this image:
In above image, fonts are not rendered proper. I used CCLabelBMFont. How can I resolve this problem?
Code:
CCLabelBMFont *userName = [CCLabelBMFont labelWithString:PlayerNameStr fntFile:#"MyFont.fnt"];
You need to leave more space between the glyphs. You can change this setting in the bitmap font editor, Glyph Designer and Hiero both have it. In Glyph Designer the setting is called Spacing and set to 2. I'm guessing you're using Hiero which has this spacing set to 0 by default.

Qt- Where can I find the list of fonts I can use?

When setting a font in a Qt application, where can I find the list of fonts I can choose from?
Thanks.
You can use the QFontDatabase class to get information about available fonts in the underlying window system.