本文整理汇总了C++中PSFont::GetLineHt方法的典型用法代码示例。如果您正苦于以下问题:C++ PSFont::GetLineHt方法的具体用法?C++ PSFont::GetLineHt怎么用?C++ PSFont::GetLineHt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSFont
的用法示例。
在下文中一共展示了PSFont::GetLineHt方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateManipulator
Manipulator* TextOvView::CreateManipulator (
Viewer* v, Event& e, Transformer* rel, Tool* tool
) {
Manipulator* m = nil;
Editor* ed = v->GetEditor();
int tabWidth = Math::round(.5*ivinch);
if (tool->IsA(GRAPHIC_COMP_TOOL)) {
FontVar* fontVar = (FontVar*) ed->GetState("FontVar");
ColorVar* colVar = (ColorVar*) ed->GetState("ColorVar");
PSFont* font = (fontVar == nil) ? psstdfont : fontVar->GetFont();
PSColor* fg = (colVar == nil) ? psblack : colVar->GetFgColor();
int lineHt = font->GetLineHt();
Painter* painter = new Painter;
painter->FillBg(false);
painter->SetFont(font);
painter->SetColors(fg, nil);
Orientation o = v->GetOrientation();
if (o!=Rotated)
painter->SetTransformer(rel);
else {
rel = new Transformer(rel);
rel->Rotate(90.0);
painter->SetTransformer(rel);
Unref(rel);
}
m = new TextManip(v, painter, lineHt, tabWidth, tool);
} else if (tool->IsA(RESHAPE_TOOL)) {
TextGraphic* textgr = (TextGraphic*) GetGraphic();
Painter* painter = new Painter;
int lineHt = textgr->GetLineHeight();
Coord xpos, ypos;
rel = new Transformer;
const char* text = textgr->GetOriginal();
int size = strlen(text);
textgr->TotalTransformation(*rel);
rel->Transform(0, 0, xpos, ypos);
painter->FillBg(false);
painter->SetFont(textgr->GetFont());
painter->SetColors(textgr->GetFgColor(), nil);
painter->SetTransformer(rel);
Unref(rel);
m = new TextManip(
v, text, size, xpos, ypos, painter, lineHt, tabWidth, tool
);
} else {
m = OverlayView::CreateManipulator(v, e, rel, tool);
}
return m;
}
示例2: Interpret
void TextOvComp::Interpret (Command* cmd) {
TextGraphic* gr = (TextGraphic*) GetGraphic();
if (cmd->IsA(BRUSH_CMD) || cmd->IsA(PATTERN_CMD)) {
// do nothing
} else if (cmd->IsA(FONT_CMD)) {
PSFont* font = ((FontCmd*) cmd)->GetFont();
cmd->Store(this, new VoidData(gr->GetFont()));
gr->SetFont(font);
gr->SetLineHeight(font->GetLineHt()); // hack; should be state var
Notify();
} else {
OverlayComp::Interpret(cmd);
}
}
示例3: OverlayComp
TextOvComp::TextOvComp(istream& in, OverlayComp* parent)
: OverlayComp(nil, parent) {
_valid = GetParamList()->read_args(in, this);
/* correct font vertical position */
PSFont* f = _gr->GetFont();
float sep = 1 - (f ? f->GetLineHt() : 0);
Transformer* t = _gr->GetTransformer();
float dx = 0., dy = sep;
if (t != nil) {
float x0, y0, x1, y1;
t->Transform(0., 0., x0, y0);
t->Transform(0., sep, x1, y1);
dx = x1 - x0;
dy = y1 - y0;
}
_gr->Translate(dx, dy);
}
示例4: Init
//.........这里部分代码省略.........
buffer = newbuffer;
}
if (_linewidth > -1) {
wordbuf = new char[len+nsub+1];
for (int i = 0; i < len; i++) {
c = inbuf[i];
++nc;
if (c == ' ' || c == '\t' || c == '\n') {
if (nc > _linewidth+1) {
strcpy(buffer+buflen, "\n");
++buflen;
if (c == '\n' && nc > 1 ) {
wordbuf[wordc] = ' ';
} else {
wordbuf[wordc] = c;
}
wordbuf[wordc+1] = '\0';
nc = strlen(wordbuf);
wordc = 0;
strcpy(buffer+buflen, wordbuf);
buflen += strlen(wordbuf);
} else {
if (c == '\n' && nc > 1 && i > 0) {
wordbuf[wordc] = ' ';
wordbuf[wordc+1] = '\0';
} else if (c == '\n' && i == 0) {
wordbuf[wordc] = c;
wordbuf[wordc+1] = c;
wordbuf[wordc+2] = '\0';
nc = 0;
} else {
wordbuf[wordc] = c;
wordbuf[wordc+1] = '\0';
}
wordc = 0;
if (buffer[buflen-1] != ' ' || wordbuf[0] != ' ') {
strcpy(buffer+buflen, wordbuf);
buflen += strlen(wordbuf);
} else {
strcpy(buffer+buflen, wordbuf+1);
buflen += strlen(wordbuf) - 1;
}
}
} else {
if (c=='\\') {
c = inbuf[++i];
if (isdigit(c)) {
char buf[4];
buf[0] = c;
buf[1] = buf[2] = buf[3] = '\0';
if (isdigit(inbuf[i+1])) {
buf[1] = inbuf[++i];
if (isdigit(inbuf[i+1])) {
buf[2] = inbuf[++i];
}
}
c = ParamList::octal(buf);
}
}
wordbuf[wordc] = c;
++wordc;
}
}
delete wordbuf;
} else {
strcpy(buffer+buflen, inbuf);
buflen += strlen(inbuf);
}
fgets( inbuf, BUFSIZ, fptr);
}
/* done looping until eof or endstr is found */
}
fclose(fptr);
/* setup the graphic */
((TextGraphic*)_gr)->SetOriginal(buffer);
delete buffer;
/* correct font vertical position */
PSFont* f = _gr->GetFont();
float sep = 1 - f->GetLineHt();
Transformer* t = _gr->GetTransformer();
float dx = 0., dy = sep;
if (t != nil) {
float x0, y0, x1, y1;
t->Transform(0., 0., x0, y0);
t->Transform(0., sep, x1, y1);
dx = x1 - x0;
dy = y1 - y0;
}
_gr->Translate(dx, dy);
}