bool Label::setTTFConfig(const TTFConfig& ttfConfig) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig); if (!newAtlas) return false; if (initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true)) { _fontConfig = ttfConfig; if (ttfConfig.outlineSize > 0) { _fontConfig.distanceFieldEnabled = false; _useDistanceField = false; _useA8Shader = false; _currLabelEffect = LabelEffect::OUTLINE; initProgram(); } else if(ttfConfig.distanceFieldEnabled) { this->setFontScale(1.0f * ttfConfig.fontSize / DefultFontSize); } _currentLabelType = LabelType::TTF; return true; } else { return false; } }
bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset /* = Point::ZERO */) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset); if (!newAtlas) return false; return initWithFontAtlas(newAtlas); }
bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(charMapFile,itemWidth,itemHeight,startCharMap); if (!newAtlas) return false; return initWithFontAtlas(newAtlas); }
bool Label::setCharMap(Texture2D* texture, int itemWidth, int itemHeight, int startCharMap) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(texture,itemWidth,itemHeight,startCharMap); if (!newAtlas) return false; return initWithFontAtlas(newAtlas); }
bool Label::setCharMap(const std::string& plistFile) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(plistFile); if (!newAtlas) return false; return initWithFontAtlas(newAtlas); }
bool Label::setTTFConfig(const TTFConfig& ttfConfig) { FontAtlas *newAtlas = nullptr; if(ttfConfig.distanceFieldEnabled) newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig.fontFilePath, DISTANCEFIELD_ATLAS_FONTSIZE, ttfConfig.glyphs, ttfConfig.customGlyphs,true); else newAtlas = FontAtlasCache::getFontAtlasTTF(ttfConfig.fontFilePath, ttfConfig.fontSize, ttfConfig.glyphs, ttfConfig.customGlyphs,false); if (!newAtlas) return false; return initWithFontAtlas(newAtlas,ttfConfig.distanceFieldEnabled,true); }
bool Label::setBMFontFilePath(const std::string& bmfontFilePath, const Point& imageOffset /* = Point::ZERO */) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasFNT(bmfontFilePath,imageOffset); if (!newAtlas) return false; if (initWithFontAtlas(newAtlas)) { _currentLabelType = LabelType::BMFONT; return true; } return false; }
bool Label::setCharMap(const std::string& charMapFile, int itemWidth, int itemHeight, int startCharMap) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(charMapFile,itemWidth,itemHeight,startCharMap); if (!newAtlas) return false; if (initWithFontAtlas(newAtlas)) { _currentLabelType = LabelType::CHARMAP; return true; } return false; }
bool Label::setCharMap(const std::string& plistFile) { FontAtlas *newAtlas = FontAtlasCache::getFontAtlasCharMap(plistFile); if (!newAtlas) return false; if (initWithFontAtlas(newAtlas)) { _currentLabelType = LabelType::CHARMAP; return true; } return false; }