Пример #1
0
bool Font::serialize(const ConfigParserPtr& cfg) {
    if(cfg && !mGlyphs.empty()) {
        cfg->beginNode(L"font");
        cfg->setString(L"name", mFontName);
        cfg->setBool(L"shadow", mEnableShadow);
        cfg->setBool(L"stroke", mEnableStroke);
        cfg->setInt(L"shadow_offset_x", mShadowXOffset);
        cfg->setInt(L"shadow_offset_y", mShadowYOffset);
        cfg->setInt(L"stroke_width", mStrokeWidth);
        cfg->setInt(L"size", mFontSize);
        cfg->setBool(L"bold", (bool)(mFace->face->style_flags & FT_STYLE_FLAG_BOLD));
        cfg->setBool(L"italic", (bool)(mFace->face->style_flags & FT_STYLE_FLAG_ITALIC));

        cfg->endNode();

        return true;
    } else {
        log_error(L"ukn::Font::serialize: unable to serialize font "+mFontName);
    }
    return false;
}