本文整理汇总了C++中Painter::SetFont方法的典型用法代码示例。如果您正苦于以下问题:C++ Painter::SetFont方法的具体用法?C++ Painter::SetFont怎么用?C++ Painter::SetFont使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Painter
的用法示例。
在下文中一共展示了Painter::SetFont方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Reconfig
void FieldStringEditor::Reconfig() {
kit_->push_style();
kit_->style(style_);
Painter* p = new Painter(output_);
p->SetColors(kit_->foreground(), kit_->background());
p->SetFont(kit_->font());
Resource::unref(output_);
output_ = p;
StringEditor::Reconfig();
kit_->pop_style();
}
示例3: Reconfig
void TE_Editor::Reconfig()
{
// set text edit attributes (colors and font)
WidgetKit& kit = *WidgetKit::instance();
kit.push_style();
kit.style(style_);
Painter* p = new Painter(output);
// p->SetColors(kit.foreground(), kit.background());
Display* d = Session::instance()->default_display();
const Color* bg = Color::lookup(d, "#aaaaaa");
if (bg == nil)
bg = new Color(0.7,0.7,0.7,1.0);
p->SetColors(kit.foreground(), bg);
if (font_ != nil)
p->SetFont(font_);
Resource::unref(output);
output = p;
TextEditor::Reconfig();
kit.pop_style();
}