本文整理汇总了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());
}
示例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());
}
示例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());
}
示例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);
}
}
示例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));
// }
}
}
示例6:
float
CairoPainter::stringWidth(const DOMString &s) const {
cairo_text_extents(m_painter, s.utf8(), &m_textsize);
return m_textsize.width;
}