Label* Label::create(const std::string& text, const std::string& font, float fontSize, const Size& dimensions /* = Size::ZERO */, TextHAlignment hAlignment /* = TextHAlignment::LEFT */, TextVAlignment vAlignment /* = TextVAlignment::TOP */) { if (FileUtils::getInstance()->isFileExist(font)) { return createWithTTF(text,font,fontSize,dimensions,hAlignment,vAlignment); } else { return createWithSystemFont(text,font,fontSize,dimensions,hAlignment,vAlignment); } }
Label* Label::createWithTTF(const std::string& text, const std::string& fontFilePath, int fontSize, int maxLineWidth /* = 0 */, TextHAlignment alignment /* = TextHAlignment::CENTER */, GlyphCollection glyphs /* = GlyphCollection::NEHE */, const char *customGlyphs /* = 0 */, bool useDistanceField /* = false */) { TTFConfig ttfConfig(fontFilePath.c_str(),fontSize,glyphs,customGlyphs,useDistanceField); return createWithTTF(ttfConfig,text,alignment,maxLineWidth); }