当前位置: 首页>>代码示例>>C++>>正文


C++ DOMString::utf8方法代码示例

本文整理汇总了C++中DOMString::utf8方法的典型用法代码示例。如果您正苦于以下问题:C++ DOMString::utf8方法的具体用法?C++ DOMString::utf8怎么用?C++ DOMString::utf8使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DOMString的用法示例。


在下文中一共展示了DOMString::utf8方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: width

/* draw the string s with current font, but stretch it to fit the given
   width (a+d). We haven't implemented stretching, so i just center the character. */
void
CairoPainter::drawText(const DOMString &s, float w) {
    float sw = stringWidth(s) + absx; // this can't be right
    float hdiff = w - sw;
    cairo_move_to(m_painter, hdiff/2+absx, absy);
    cairo_show_text(m_painter, s.utf8());
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:9,代码来源:cairopainter.cpp

示例2: drawOutline

void
CairoPainter::drawText(const DOMString &s) {
    if (debugdrawtext) {
        drawOutline(stringWidth(s));
    }
    cairo_move_to(m_painter, absx, absy);
    cairo_show_text(m_painter, s.utf8());
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:8,代码来源:cairopainter.cpp

示例3: stringWidth

void
CairoPainter::drawText(const DOMString &s, float w, float a, float d) {
    float sw = stringWidth(s);
    float hdiff = w-sw;
    float fa = fontAscent();
    float fd = fontDescent();
    float vdiff = d-fd - a+fa;
    cairo_move_to(m_painter, hdiff/2, vdiff/2);
    cairo_show_text(m_painter, s.utf8());
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:10,代码来源:cairopainter.cpp

示例4: createAttribute

/* this function sets an attribute in a dictionary entry */
void
MMLmo::setAttribute(const char *op, const std::string &name, const DOMString &v,
        const MMLAttribute **a) {
    int pos = createAttribute(name.c_str(), v, MML::MO, a);
    if (pos == -1) {
        cerr << "internal error in MMLmo::makedict: invalid attribute '"
            << name << "', value invalid: '" << v.utf8()
            << "' for operator '" << op << "'." << endl;
        exit(1);
    }
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:12,代码来源:mmlmo.cpp

示例5: strchr

// static functions for initializing the operator dictionary
void
MMLmo::makedict() {
    madedict = true;
    for (int i=0; i<351; ++i) {
        const char *end;
        const char *start = rawopdict[i];
        const char *send = start+strlen(start);
        end = strchr(start, ' ');
        DOMString op;
        for (const char *j=start; j!=end; ++j) {
            op += *j;
        }
        const MMLAttribute **a
            = new const MMLAttribute*[MML::moNumAtts];
        for (uint j=0; j<MML::moNumAtts; ++j) {
            a[j] = 0;
        }
        while (*end != '\0') {
            std::string name;
            start = end+1;
            end = strchr(start, '=');
            for (const char *j=start; j!=end; ++j) {
                name += *j;
            }
            start = end+1;
            end = strchr(start, ' ');
            if (!end) end = send;
            DOMString value;
            for (const char *j=start; j!=end; ++j) {
                value += *j;
            }
            setAttribute(op.utf8(), name, value, a);
        }
//        dict.insert(pair<DOMString, MMLAttribute **>(op, a));
//        DOMString uni = op;
        op.resolveEntities();
//        if (uni != op) {
            dict.insert(pair<DOMString, const MMLAttribute **>
                (op, a));
//        }
    }
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:43,代码来源:mmlmo.cpp

示例6:

float
CairoPainter::stringWidth(const DOMString &s) const {
    cairo_text_extents(m_painter, s.utf8(), &m_textsize);
    return m_textsize.width;
}
开发者ID:BackupTheBerlios,项目名称:libmathml-svn,代码行数:5,代码来源:cairopainter.cpp


注:本文中的DOMString::utf8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。