本文整理汇总了C++中ofTrueTypeFont::getLineHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ ofTrueTypeFont::getLineHeight方法的具体用法?C++ ofTrueTypeFont::getLineHeight怎么用?C++ ofTrueTypeFont::getLineHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ofTrueTypeFont
的用法示例。
在下文中一共展示了ofTrueTypeFont::getLineHeight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getFinalTarget
void gpuPictoChar::getFinalTarget(ofTrueTypeFont& font, float fontScale, float res, float rand, vector<float>& data){
firstIndex = gpuPicto::totalPicto;
charProps cp = font.getCharProps(c);
float lineHeight = font.getLineHeight() * fontScale;
float setWidth = cp.setWidth * fontScale;
//float height = cp.height;
//float topExtent = cp.topExtent;
//float width = cp.width;
//float leftExtent = cp.leftExtent;
int pixW = setWidth;
int pixH = lineHeight * 1.5;
// printf("\n%c\nwidth= %0.1f\nsetWidth= %0.1f\nheight= %0.1f\ntopExtent= %0.1f\nleftExtent%0.1f\n",
// c, w, fw, fh, te, le);
// ofFbo * fbo = new ofFbo();
{
fbo.allocate(pixW, pixH);
fbo.begin();
ofFill();
ofSetColor(0, 0, 0);
ofRect(0, 0, pixW, pixH);
ofSetColor(250, 0, 0);
ofScale(fontScale, fontScale);
font.drawStringAsShapes(ofToString(c), 0, lineHeight*1.2/fontScale);
fbo.end();
}
ofPixels pix;
ofTexture tex;
pix.allocate(pixW, pixH, OF_PIXELS_RGBA);
tex.allocate(pix);
fbo.readToPixels(pix);
tex.loadData(pix);
int count = 0;
for(int sy=res/2; sy<pixH; sy+=res){
for(int sx=res/2; sx<pixW; sx+=res){
ofColor col = pix.getColor(sx, sy);
if(col.r > 50) {
data.push_back(sx+ ofRandom(-rand, rand));
data.push_back(sy+ ofRandom(-rand, rand));
data.push_back(0);
count++;
// gpuPicto::totalPicto++;
}
}
}
// delete fbo;
numPicto = count;
}