本文整理汇总了C++中Glyph::Outline方法的典型用法代码示例。如果您正苦于以下问题:C++ Glyph::Outline方法的具体用法?C++ Glyph::Outline怎么用?C++ Glyph::Outline使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Glyph
的用法示例。
在下文中一共展示了Glyph::Outline方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProcessFace
static bool ProcessFace(FT_Face& face, const string& filename, u32 fontHeight)
{
string imageName;
string specsName;
if (!outputFileName.empty()) {
imageName = outputFileName + ".png";
specsName = outputFileName + ".lua";
}
else {
string basename = filename;
const string::size_type lastOf = filename.find_last_of('.');
if (lastOf != string::npos) {
basename = filename.substr(0, lastOf);
if (debugLevel >= 1) {
logOutput.Print("basename = %s\n", basename.c_str());
}
}
char heightText[64];
sprintf(heightText, "_%i", fontHeight);
char outlineText[64];
sprintf(outlineText, "_%i", outlineRadius);
imageName = basename + heightText + ".png";
specsName = basename + heightText + ".lua";
}
logOutput.Print("Processing %s @ %i\n", filename.c_str(), fontHeight);
if (debugLevel >= 1) {
PrintFaceInfo(face);
}
u32 maxPixelXsize = 0;
u32 maxPixelYsize = 0;
for (u32 g = minChar; g <= maxChar; g++) {
Glyph* glyph = new Glyph(face, g);
if (!glyph->valid) {
continue;
}
glyphs.push_back(glyph);
if (outlineRadius> 0) {
glyph->Outline(outlineRadius);
}
if (debugLevel >= 2) {
PrintGlyphInfo(face->glyph, g);
}
if (maxPixelXsize < glyph->xsize) {
maxPixelXsize = glyph->xsize;
}
if (maxPixelYsize < glyph->ysize) {
maxPixelYsize = glyph->ysize;
}
}
const u32 xskip = maxPixelXsize + (2 * (padding + stuffing));
const u32 yskip = maxPixelYsize + (2 * (padding + stuffing));
const u32 xdivs = (xTexSize / xskip);
const u32 ydivs = ((maxChar - minChar + 1) / xdivs) + 1;
yTexSize = ydivs * yskip;
u32 binSize = 1;
while (binSize < yTexSize) {
binSize = binSize << 1;
}
yTexSize = binSize;
if (debugLevel >= 1) {
logOutput.Print("xTexSize = %i\n", xTexSize);
logOutput.Print("yTexSize = %i\n", yTexSize);
logOutput.Print("xdivs = %i\n", xdivs);
logOutput.Print("ydivs = %i\n", ydivs);
logOutput.Print("maxPixelXsize = %i\n", maxPixelXsize);
logOutput.Print("maxPixelYsize = %i\n", maxPixelYsize);
}
FILE* specFile = fopen(specsName.c_str(), "wt");
if (specFile == NULL) {
logOutput.Print("%s: %s\n", specsName.c_str(), strerror(errno));
return false;
}
u32 yStep;
if (FT_IS_SCALABLE(face)) {
yStep = (fontHeight * face->height) / face->units_per_EM;
} else {
yStep = (face->height / 64);
if (yStep == 0) {
// some fonts do not provide a face->height, so make one up
yStep = (5 * fontHeight) / 4;
}
}
fprintf(specFile, "\n");
fprintf(specFile, "local fontSpecs = {\n");
fprintf(specFile, " srcFile = [[%s]],\n", filename.c_str());
fprintf(specFile, " family = [[%s]],\n", face->family_name);
fprintf(specFile, " style = [[%s]],\n", face->style_name);
fprintf(specFile, " yStep = %i,\n", yStep);
fprintf(specFile, " height = %i,\n", fontHeight);
fprintf(specFile, " xTexSize = %i,\n", xTexSize);
//.........这里部分代码省略.........