当前位置: 首页>>代码示例>>C++>>正文


C++ Painter::SetFont方法代码示例

本文整理汇总了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;
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:56,代码来源:ovtext.c

示例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();
}
开发者ID:jmzaleski,项目名称:ivtools-1.2,代码行数:11,代码来源:field.c

示例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();
}
开发者ID:barak,项目名称:ivtools-cvs,代码行数:20,代码来源:texteditor.c


注:本文中的Painter::SetFont方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。