/// Sets the label format void SetFormat(const PdfLabelFormat& format) { m_metric = format.metric; m_averyName = format.name; m_marginLeft = ConvertMetric(format.marginLeft, m_metric, m_metricDoc); m_marginTop = ConvertMetric(format.marginTop, m_metric, m_metricDoc); m_xSpace = ConvertMetric(format.xSpace, m_metric, m_metricDoc); m_ySpace = ConvertMetric(format.ySpace, m_metric, m_metricDoc); m_xNumber = format.nx; m_yNumber = format.ny; m_width = ConvertMetric(format.width, m_metric, m_metricDoc); m_height = ConvertMetric(format.height, m_metric, m_metricDoc); SetFontSize(format.fontSize); }
void TextObj::CalcBySize(const Point& sz) { double t_hgt; double fnt_sz = CalcFontSizeFromWidth(text, sz.x, t_hgt, FontDesc()); hgtMult = sz.y/t_hgt; // :TODO: при сохранении (на диск) надо использовать абсолютные размеры шрифта LOG_INF << "TextObj::CalcBySize: sz " << sz << "; hgtMult " << hgtMult << "; text " << text << "; fnt_sz " << fnt_sz << "; t_hgt " << t_hgt << "; font " << FontDesc().to_string() << io::endl; SetFontSize(fnt_sz); }
BLOCO_API HumanView::Console::Console() : CILKeyboardState("console keyboard handler"), m_bActive( false ), m_bExecuteStringOnUpdate( false ) { m_CurrentInputString = std::string(""); SetFontColor(Col( 1.0f, 1.0f, 1.0f, 1.0f )); SetFontSize(20.0f); m_CursorBlinkTimer = kCursorBlinkTimeMS; m_bCursorOn = true; m_helperPos = 0; g_pInput->AddListener((ICILKeyboardHandler*)this); }
void SAboutView::Draw (BRect updateRect) { if (updateRect != BRect (85, 170, 250, 195)) { if (fBecasso) DrawBitmap (fBecasso, BPoint (25, 10)); if (fSum) DrawBitmap (fSum, BPoint (10, 115)); SetLowColor (Grey28); SetHighColor (Grey8); char verstring[80]; extern const char *Version; extern int gGlobalAlpha; extern char gAlphaMask[128]; SetFontSize (13); sprintf (verstring, lstring (3, "Version %s, built %s"), Version, __DATE__); // sprintf (verstring, "MacWorld Demo Version"); DrawString (verstring, BPoint (85, 124)); SetFontSize (11); DrawString ("© 1997-2001 ∑ Sum Software", BPoint (85, 138)); if (!gGlobalAlpha) { SetHighColor (Red); SetFontSize (13); DrawString (lstring (4, "Unregistered Version"), BPoint (85, 155)); } else { SetHighColor (Grey8); #if defined(__HAIKU__) DrawString ("Released under the MIT license", BPoint (85, 152)); #else DrawString (lstring (7, "Registered to"), BPoint (85, 152)); SetHighColor (Black); SetFontSize (12); DrawString (gAlphaMask, BPoint (85, 168)); #endif } // DrawString ("Add-On developers beta version", BPoint (85, 158)); // DrawString ("This is a ", BPoint (85, 158)); // SetHighColor (Red); // DrawString ("time limited"); // SetHighColor (Grey8); // DrawString (" demo that will"); // DrawString ("stop working on January 1st, 1998", BPoint (85, 172)); } if (fStartup) { SetLowColor (Grey28); SetHighColor (Grey8); SetFontSize (12); DrawString (lstring (5, "Initializing Add-Ons:"), BPoint (85, 182)); SetFontSize (11); DrawString (fAddOnString, BPoint (85, 194)); } }
BOOL CScanMgrDlg::OnInitDialog() { CDialog::OnInitDialog(); InitUI(); InitScanner(); InitExamData(); InitChildDlg(); InitCtrlPosition(); m_scanThread.CreateThread(); SetFontSize(m_nStatusSize); m_comboSubject.AdjustDroppedWidth(); return TRUE; }
Text::Text(FontCache* fc) { cache = fc; buffer = NULL; bufferAlpha = NULL; bufferW = bufferH = 0; statesL = 0; PushState(); SetFont(fc->GetDefaultFont()); SetFontSize(DEFAULT_FONT_SIZE); penX = marginLeft; penY = marginTop + GetLineHeight(); }
void UnitBase::DrawUnit( bool is_walk , bool is_attack) { DrawGraphInCamera( Vector2( ( GetPos().x - mImageSize.x / 2 ), ( GetPos().y - GetHeight() - mImageSize.y ) ), mImageSize, mAnimIndex + (is_walk ? 2 : 0) + (is_attack ? 4 : 0), mImageType, TRUE, ( mDir.x < 0.0f ) ); //HP DrawBox( static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25), static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y ), static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x + 25 ), static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + 4 ), GetColor(255,0,0) , TRUE); DrawBox( static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25), static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y ), static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x - 25 + (50 * mHP / mHPMax) ), static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + 4 ), GetColor(0,255,0) , TRUE); if( IsVisibleCollision() ){ // コリジョン DrawBox( static_cast<int>( GetPos().x - GetSize().x / 2 + gCamera2D().GetDrawOffset().x ), static_cast<int>( GetPos().y - GetSize().y / 2 + gCamera2D().GetDrawOffset().y ), static_cast<int>( GetPos().x + GetSize().x / 2 + gCamera2D().GetDrawOffset().x ), static_cast<int>( GetPos().y + GetSize().y / 2 + gCamera2D().GetDrawOffset().y ), ColorOf(255,0,0), FALSE ); } if( IsDamaged() ){ SetFontSize(32); DrawFormatString( static_cast<int>( mPos.x + gCamera2D().GetDrawOffset().x + 32), static_cast<int>( mPos.y + gCamera2D().GetDrawOffset().y + ( - 150 + mDamageFrame ) / 2 ), GetColor(255,255,0) , "%d", mDamage ); } }
LRESULT LyricForm::HandleMessage(UINT message, WPARAM wParam, LPARAM lParam) { LRESULT lRes = 0L; switch (message) { case WM_CREATE: lRes = OnCreate(message, wParam, lParam); break; case WM_PAINT: PaintLyric(); break; case WM_DESTROY: _writeText->Release(); PostQuitMessage(0); break; case WM_NCPAINT: break; case WM_NCCALCSIZE: break; case WM_NCACTIVATE: lRes = wParam == NULL ? TRUE : FALSE; break; case WM_NCHITTEST: lRes = OnNCHitTest(message, wParam, lParam); case WM_SIZE: _writeText->OnFormChange(); break; case WM_TIMER: break; case CM_LYRIC: SetLyric(std::wstring((wchar_t*)wParam)); PaintLyric(); break; case CM_FONTCOLOR: SetFontColor(MakeColor((DWORD)wParam, (DWORD)lParam)); break; case CM_FONTSIZE: SetFontSize((float)wParam); break; case CM_CLOSE: PostQuitMessage(0); break; default: return DefWindowProc(m_hWnd, message, wParam, lParam); } return lRes; }
// // Initializing text display values. // void CTextDisplay::SetAll(CString * show_text, char *font_name, LONG font_size, TextAlignment alignment, BOOL bold, BOOL italic, BOOL underline, COLORREF color) { // Update all settings for the displayed text, but do not update the // window until everything has been updated. SetText(show_text, FALSE); SetFontType(font_name, FALSE); SetFontSize(font_size, FALSE); SetTextAlignment(alignment, FALSE); Bold(bold, FALSE); Italic(italic, FALSE); Underline(underline, FALSE); SetTextColor(color, FALSE); // Update the display. RedrawWindow(); }
SelectionView::SelectionView(BRect frame, const char *name) : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW), fMouseDown(false) { SetFontSize(20); float stringWidth = StringWidth(kInfo); font_height height; GetFontHeight(&height); float stringHeight = height.ascent + height.descent + height.leading; fStringRect.left = (Bounds().Width() - stringWidth) / 2; fStringRect.top = (Bounds().Height() - stringHeight) / 2; fStringRect.right = fStringRect.left + stringWidth; fStringRect.bottom = fStringRect.top + stringHeight; }
void ButtonComponent::CreateTextObject() { auto textObj = Object::Create(); auto textComp = textObj->AddComponent<TextComponent>(); textComp->SetFont(m_font); textComp->SetFontSize(m_fontSize); textComp->SetColor(sf::Color(m_textColor.x, m_textColor.y, m_textColor.z)); textComp->SetText(m_text); auto offset = Vector2f((m_size.x - textComp->GetSize().x) / 2.f, (m_size.y - textComp->GetSize().y) / 2.f); textObj->SetPos(offset); m_textHolder = textObj.get(); m_object->AddChild(std::move(textObj)); }
void kGUIText::SetRichFontSize(unsigned int si,unsigned int ei,unsigned int fontsize) { unsigned int i; unsigned int l=GetLen(); RICHINFO_DEF *ri; for(i=si;i<ei;++i) { if(i==l) SetFontSize(fontsize); else { ri=GetRichInfoPtr(i); ri->fontsize=fontsize; } } StringChanged(); }
void Stringview1::Draw(BRect updateRect) { rgb_color lc=LowColor(); rgb_color hc=HighColor(); // if (hasIcon) DrawBitmap(bmp,BRect(600,0,615,15)); SetHighColor(0,0,0,255); SetLowColor(255,255,255,255); SetFontSize(10.0); DrawString(text->String(), BPoint(3,12)); DrawString(typetext->String(), BPoint(Bounds().Width()-20-StringWidth(typetext->String()),12)); SetLowColor(lc); SetHighColor(hc); // BView::Draw(updateRect); // be_app->PostMessage('HL01'); }
ToolBar::ToolBar(void) : BView(BRect(), "toolbar", B_FOLLOW_NONE, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), fSpacing(0), fIconSpace(2), fButtonHighlight(-1), fButtonPressed(false), fFontSize(14) { fTargetHandler = NULL; fTargetLooper = NULL; SetViewColor(B_TRANSPARENT_32_BIT); SetDrawingMode(B_OP_ALPHA); SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); SetFontSize(fFontSize); }
QuaSymbolBridge::QuaSymbolBridge(StabEnt *S, BRect r, BBitmap *siconData, BBitmap *biconData, ObjectViewContainer *a, rgb_color dflt_col): ObjectView(r, S->UniqueName(), a, "QuaSymbolBridge", nullptr, B_WILL_DRAW|B_FRAME_EVENTS) { SetFontSize(10); if (siconData) { sicon = new BBitmap( siconData->Bounds(), siconData->ColorSpace()); uchar *p = (uchar *)sicon->Bits(), *q = (uchar *)siconData->Bits(); for (int i=0; i<siconData->BitsLength(); i++) { p[i] = q[i]; } } else { sicon = nullptr; } if (biconData) { bicon = new BBitmap( biconData->Bounds(), biconData->ColorSpace()); uchar *p = (uchar *)bicon->Bits(), *q = (uchar *)biconData->Bits(); for (int i=0; i<biconData->BitsLength(); i++) { p[i] = q[i]; } } else { bicon = nullptr; } sym = S; if (Window()) Window()->Lock(); SetColor(dflt_col); if (Window()) Window()->Unlock(); if (bicon) SetDisplayMode(OBJECT_DISPLAY_BIG); else if (sicon) SetDisplayMode(OBJECT_DISPLAY_SMALL); else SetDisplayMode(OBJECT_DISPLAY_NIKON); }
//********************************************************* // ゲームメイン処理 //********************************************************* void GameMain(void) { ClsDrawScreen(); // 背景 DrawBox(0, 0, WIN_W, WIN_H, WHITE, TRUE); //文字(会話)設定----------------------------- // 描画する文字列の文字セットを変更 ChangeFont("07やさしさゴシック"); //文字サイズ SetFontSize(20); //-------------------------------------------- //コミットテスト用の表示 DrawFormatString(100, 100, BLACK, "やさしさゴシックフォントで表示TEST"); ScreenFlip(); }
CSelectBox::CSelectBox(const int x_, const int y_, const int w_, const int h_, const int maxItemN, int r1_, int g1_, int b1_, int r2_, int g2_, int b2_, const FontSize &fontSize_, const bool visible_) { m_x = x_, m_y = y_, m_w = w_, m_h = h_; m_r1 = r1_, m_g1 = g1_, m_b1 = b1_; m_r2 = r2_, m_g2 = g2_, m_b2 = b2_; SetFontSize(fontSize_); m_visible = visible_; m_maxItemN = maxItemN; m_currentItemStart = 0; m_selectedItemIndex = -1; m_itemSizeY = m_h / m_maxItemN; m_itemStartY = m_itemSizeY/4; m_type = WidgetType::selectBox; }
FontDemoView::FontDemoView(BRect rect) : BView(rect, "FontDemoView", B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS), fBitmap(NULL), fBufferView(NULL), fString(NULL), fFontSize(50.0), fSpacing(0.0), fOutLineLevel(0), fDrawingMode(B_OP_COPY), fBoundingBoxes(false), fDrawShapes(false), fShapes(NULL) { SetViewColor(B_TRANSPARENT_COLOR); SetString("Haiku, Inc."); SetFontSize(fFontSize); SetAntialiasing(true); _NewBitmap(Bounds()); }
Font::Font(const std::string& path) : _isReady(false) { if (FT_Init_FreeType(&_freeType)) { ax::Error("Could not init freetype library."); FT_Done_FreeType(_freeType); } else { bool err = LoadFont(path, _face); if (err) { ax::Error("Could not open font", path); FT_Done_FreeType(_freeType); } else { _isReady = true; SetFontSize(12); } } }
void SeqMeasureControl::AttachedToWindow() { inherited::AttachedToWindow(); SongRef().AddObserver( this, AmSong::END_TIME_CHANGE_OBS ); SongRef().AddRangeObserver( this, AmNotifier::SIGNATURE_OBS, AmRange() ); SetViewColor( B_TRANSPARENT_COLOR ); mViewColor = Prefs().Color( AM_MEASURE_TOP_BG_C ); BRect b = Bounds(); if (mLeftIndent > 0) { delete mLeftBg; ConstructLeftBg(BRect(0, 0, mLeftIndent - 1, b.Height() - 1)); } if (mRightIndent > 0) { delete mRightBg; ConstructRightBg(BRect(0, 0, mRightIndent, b.Height() - 1)); } SetFontSize(10); }
/** * Draw * * @param BRect, the draw bounds * @return void */ void MarginView::Draw(BRect rect) { BBox::Draw(rect); float y_offset = (float)kOffsetY; float x_offset = (float)kOffsetX; BRect r; // Calculate offsets depending on orientation if (fPageWidth < fPageHeight) { // Portrait x_offset = (fMaxPageWidth/2 + kOffsetX) - fViewWidth/2; } else { // landscape y_offset = (fMaxPageHeight/2 + kOffsetY) - fViewHeight/2; } // draw the page SetHighColor(kWhite); r = BRect(0, 0, fViewWidth, fViewHeight); r.OffsetBy(x_offset, y_offset); FillRect(r); SetHighColor(kBlack); StrokeRect(r); // draw margin SetHighColor(kRed); SetLowColor(kWhite); r.top += fMargins.top; r.right -= fMargins.right; r.bottom -= fMargins.bottom; r.left += fMargins.left; StrokeRect(r, kDots); // draw the page size label SetHighColor(kBlack); SetLowColor(kGray); char str[kStringSize]; sprintf(str, "%2.1f x %2.1f", fPageWidth/fUnitValue, fPageHeight/fUnitValue); SetFontSize(10); DrawString((const char *)str, BPoint(x_offset, fMaxPageHeight + 40)); }
void mglCanvas::DefaultPlotParam() { /* NOTE: following variables and mutex will not be changed by DefaultPlotParam() long InUse; ///< Smart pointer (number of users) mglFont *fnt; ///< Class for printing vector text int Quality; ///< Quality of plot (0x0-pure, 0x1-fast; 0x2-fine; 0x4 - low memory) int Width; ///< Width of the image int Height; ///< Height of the image int Depth; ///< Depth of the image int CurFrameId; ///< Number of automaticle created frames GifFileType *gif;*/ SetDrawReg(1,1,0); Perspective(0); memcpy(mgl_mask_val, mgl_mask_def, 16*sizeof(uint64_t)); // should be > 16*8 ax.Clear(); ay.Clear(); az.Clear(); ac.Clear(); mgl_clear_fft(); DefMaskAn=0; ResetMask(); SetTickRotate(true); SetTickSkip(true); SetWarn(mglWarnNone,""); mglGlobalMess = ""; ObjId = -1; HighId = INT_MIN; SetFunc(0,0); CutOff(0); Ternary(0); Stop=false; event_cb = NULL; event_par=NULL; SetRanges(mglPoint(-1,-1,-1,-1), mglPoint(1,1,1,1)); SetOrigin(NAN,NAN,NAN,NAN); SetBarWidth(0.7); SetMarkSize(1); SetArrowSize(1); SetAlphaDef(0.5); FontDef[0]=0; SetTranspType(0); SetMeshNum(0); // NOTE: default MeshNum=0 SetRotatedText(true); CurrPal = 0; SetLegendMarks(); SetFontSize(4); SetTuneTicks(3); SetAmbient(); SetDiffuse(); clr(MGL_DISABLE_SCALE); clr(MGL_USE_GMTIME); clr(MGL_NOSUBTICKS); SetDifLight(false); SetReduceAcc(false); SetDefScheme(MGL_DEF_SCH); SetPalette(MGL_DEF_PAL); SetPenPal("k-1"); Alpha(false); stack.clear(); Restore(); DefColor('k'); SetPlotFactor(0); InPlot(0,1,0,1,false); SetTickLen(0); SetCut(true); AdjustTicks("xyzc",true); Clf('w'); for(int i=0;i<10;i++) { AddLight(i, mglPoint(0,0,1)); Light(i,false); } Light(0,true); Light(false); SetDifLight(true); }
void GameRoad::init(GameResult * result) { rd_g_res = result; cond = RO_INI; move_time = 0; time = 0; miss = 0; for(int i=0; i<3; i++) { get_rgb[i] = 0; } all_road = 0; head_x = RO_X_CNT; now_level = 0; del_block.ok = 0; del_block.type = 0; del_block.col = 0; block.ok = 0; block.type = 0; block.col = rand() % 3; once_btn = 0; ch_movetime = 4; ch_time = 4; ch_mode = 0; ch_walk = 0; alpha = 255; SetDrawBright( alpha , alpha , alpha ); SetFontSize(16); if(result == NULL) { s_col = 0; stage = 0; } else { s_col = result->stage_color(); stage = result->stage_level(); } efe_ok = 0; }
void StatusView::AttachedToWindow() { SetFont(be_plain_font); SetFontSize(10.); BRect rect = Parent()->Bounds(); GetFontHeight(&_fh); float height = _fh.ascent + _fh.descent + 1.0; if (height < B_V_SCROLL_BAR_WIDTH) height = B_V_SCROLL_BAR_WIDTH; _height = height - _fh.descent - 1.0; ResizeTo(rect.Width(), height); MoveTo(0.0, rect.bottom - height + 1 ); }
void Text::PopState(u8 amount) { if (amount >= statesL) { statesL = 0; } else { statesL -= amount; } //Restore state from slot TextState* s = &states[statesL]; penX = s->penX; penY = s->penY; color = s->color; marginLeft = s->marginLeft; marginRight = s->marginRight; marginTop = s->marginTop; marginBottom = s->marginBottom; if (s->font && font != s->font) { SetFont(s->font->filePath); } if (fontsize != s->fontsize) { SetFontSize(s->fontsize); } }
void PickUserView::Draw(BRect rect) { BRect r = Bounds(); rgb_color black = { 0, 0, 0, 255 }; rgb_color gray = ui_color(B_PANEL_BACKGROUND_COLOR); SetViewColor(gray); SetLowColor(gray); FillRect(r, B_SOLID_LOW); SetHighColor(black); SetFont(be_plain_font); SetFontSize(10); MovePenTo(10, 12); DrawString("Select a user from the list below, then click the OK button."); MovePenTo(10, 24); DrawString("Click the Cancel button to abort the selection."); MovePenTo(13, 43); DrawString("Users:"); }
void VSpanHandler::SetHTMLAttribute(const VString& inName, const VString& inValue) { //here we need to parse only mandatory font attributes if (inName.EqualToString("face")) SetFont(inValue); else if (inName.EqualToString("color")) SetColor( inValue); else if (inName.EqualToString("bgcolor")) SetBackgroundColor( inValue); else if (inName.EqualToString("size")) { //HTML font size is a number from 1 to 7; default is 3 sLONG size = inValue.GetLong(); if (size >= 1 && size <= 7) { size = size*12/3; //convert to point VString fontSize; fontSize.FromLong(size); SetFontSize( fontSize, 72.0f); } } }
void TextComponent::OnCreate() { // overlay QString oname = GetNode()->GetName() + "-" + mName; mOverlay = Ogre::OverlayManager::getSingleton().create(Utils::ToStdString(oname) + "-overlay"); mPanel = static_cast<Ogre::OverlayContainer*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", Utils::ToStdString(oname) + "-panel")); mPanel->setDimensions(0.0, 0.0); mLabel = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("TextArea", Utils::ToStdString(oname) + "-label")); mLabel->setMetricsMode(Ogre::GMM_PIXELS); mLabel->setPosition(0, 0); SetColor(mColor); SetFontSize(mFontSize); SetFont(mFont); SetBackgroundMaterial(mBackgroundMaterial); SetText(mText); mRefresh = true; mOverlay->add2D(mPanel); mPanel->addChild(mLabel); mOverlay->show(); }
bool QuaSymbolBridge::SetDisplayMode(short dm) { displayMode = dm; SetFontSize(10); if (displayMode == OBJECT_DISPLAY_BIG) { float w = Max(45,StringWidth(label)+2*2); ResizeTo(w, 45); labelPoint.Set(3, 43); iconPoint.Set((w-32)/2,2); } else if (displayMode == OBJECT_DISPLAY_SMALL) { float w = Max(18,StringWidth(label)+2*2+18); ResizeTo(w, 19); labelPoint.Set(19, 14); iconPoint.Set(1,2); } else if (displayMode == OBJECT_DISPLAY_NIKON) { float w = Max(45,StringWidth(label)+2*2); ResizeTo(w, 45); labelPoint.Set(3, 43); iconPoint.Set((w-32)/2,2); } return true; }
wxTextPrintout::wxTextPrintout(char *title, char *text, float border, int pointsize, int family, int style, int weight, float tab, float header,float headerrule, float footer,float footerrule ) :wxPrintout(title),TextToPrint(text), FontSize(10),FontFamily(family), FontStyle(style),FontWeight(weight), BorderSize(50.f), TabSize(80.f) { // set the Default number of pages Pages=32000; // if a NULL-pointer, give it an empty one... if (!TextToPrint) { TextToPrint="(NULL)\n"; } // set the defaults SetFontSize(pointsize); SetHeaderSize(0.f); SetHeaderRuleOff(0.f); // acomedate for footer-message by default... SetFooterSize((float)GetFontSize()); SetFooterRuleOff((float)GetFontSize()); // Now set the other stuff SetBorderSize(border); SetHeaderSize(header); SetHeaderRuleOff(headerrule); SetFooterSize(footer); SetFooterRuleOff(footerrule); SetTabSize(tab); }