本文整理汇总了C++中shaping函数的典型用法代码示例。如果您正苦于以下问题:C++ shaping函数的具体用法?C++ shaping怎么用?C++ shaping使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shaping函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defined
void tst_QTextScriptEngine::linearB()
{
#if defined(Q_WS_X11)
{
if (QFontDatabase().families(QFontDatabase::Any).contains("Penuturesu")) {
QFont f("Penuturesu");
const ShapeTable shape_table [] = {
{ { 0xd800, 0xdc01, 0xd800, 0xdc02, 0xd800, 0xdc03, 0 },
{ 0x5, 0x6, 0x7, 0 } },
{ {0}, {0} }
};
const ShapeTable *s = shape_table;
while (s->unicode[0]) {
QVERIFY( shaping(f, s) );
++s;
}
} else {
QSKIP("couln't find Penuturesu", SkipAll);
}
}
#else
QSKIP("X11 specific test", SkipAll);
#endif
}
示例2: shaping
const Shaping FontStack::getShaping(const std::u32string &string, const float maxWidth,
const float lineHeight, const float horizontalAlign,
const float verticalAlign, const float justify,
const float spacing, const vec2<float> &translate) const {
Shaping shaping(translate.x * 24, translate.y * 24);
// the y offset *should* be part of the font metadata
const int32_t yOffset = -17;
int32_t x = std::round(translate.x * 24); // one em
const int32_t y = std::round(translate.y * 24) + yOffset; // one em
// Loop through all characters of this label and shape.
for (uint32_t chr : string) {
auto metric = metrics.find(chr);
if (metric != metrics.end()) {
shaping.positionedGlyphs.emplace_back(chr, x, y);
x += metric->second.advance + spacing;
}
}
if (!shaping.positionedGlyphs.size())
return shaping;
lineWrap(shaping, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify);
return shaping;
}
示例3: loadFace
void tst_QScriptEngine::nko()
{
{
FT_Face face = loadFace("DejaVuSans.ttf");
if (face) {
const ShapeTable shape_table [] = {
{ { 0x7ca, 0x0 },
{ 0x5c1, 0x0 } },
{ { 0x7ca, 0x7ca, 0x0 },
{ 0x14db, 0x14d9, 0x0 } },
{ { 0x7ca, 0x7fa, 0x7ca, 0x0 },
{ 0x14db, 0x5ec, 0x14d9, 0x0 } },
{ { 0x7ca, 0x7f3, 0x7ca, 0x0 },
{ 0x14db, 0x5e7, 0x14d9, 0x0 } },
{ { 0x7ca, 0x7f3, 0x7fa, 0x7ca, 0x0 },
{ 0x14db, 0x5e7, 0x5ec, 0x14d9, 0x0 } },
{ {0}, {0} }
};
const ShapeTable *s = shape_table;
while (s->unicode[0]) {
QVERIFY( shaping(face, s, HB_Script_Nko) );
++s;
}
FT_Done_Face(face);
} else {
QSKIP("couln't find DejaVuSans.ttf");
}
}
}
示例4: shaping
const Shaping GlyphSet::getShaping(const std::u32string &string, const float maxWidth,
const float lineHeight, const float horizontalAlign,
const float verticalAlign, const float justify,
const float spacing, const Point<float> &translate) const {
Shaping shaping(translate.x * 24, translate.y * 24, string);
// the y offset *should* be part of the font metadata
const int32_t yOffset = -17;
float x = 0;
const float y = yOffset;
// Loop through all characters of this label and shape.
for (uint32_t chr : string) {
auto it = sdfs.find(chr);
if (it != sdfs.end()) {
shaping.positionedGlyphs.emplace_back(chr, x, y);
x += it->second.metrics.advance + spacing;
}
}
if (shaping.positionedGlyphs.empty())
return shaping;
lineWrap(shaping, lineHeight, maxWidth, horizontalAlign, verticalAlign, justify, translate);
return shaping;
}