bool ON_Font::CreateFontFromFaceName( const wchar_t* facename, bool bBold, bool bItalic ) { PurgeUserData(); Defaults(); if ( 0 == facename || 0 == facename[0] ) facename = L"Arial"; bool rc = SetFontFaceName(facename); HeightOfI(); m_font_name = facename; if ( bBold ) { SetBold(true); m_font_name += "L Bold"; } if ( bItalic ) { SetItalic(true); m_font_name += "L Italic"; } return rc; }
int TextWidget::Load(XmlSynthElem *elem) { SynthWidget::Load(elem); char *txt; if (elem->GetAttribute("lbl", &txt) == 0) { SetText(txt); delete txt; } if (elem->GetAttribute("fmt", &txt) == 0) { SetFormat(txt); delete txt; } short th; if (elem->GetAttribute("th", th) == 0) SetTextHeight(th); if (elem->GetAttribute("bold", th) == 0) SetBold(th); if (elem->GetAttribute("italic", th) == 0) SetItalic(th); if (elem->GetAttribute("filled", th) == 0) SetFilled(th); if (elem->GetAttribute("align", th) == 0) SetAlign(th); if (elem->GetAttribute("shadow", th) == 0) SetShadow(th); if (elem->GetAttribute("inset", th) == 0) SetInset(th); if (elem->GetAttribute("edit", th) == 0) editable = (int) th; return 0; }
void VSpanHandler::TraiteCSS(const VString& inAttribut, const VString& inValue) { if(inAttribut == MS_FONT_NAME) { SetFont(inValue); } else if(inAttribut == MS_FONT_SIZE) { SetFontSize(inValue); } else if(inAttribut == MS_COLOR) { SetColor(inValue); } else if(inAttribut == MS_ITALIC) { SetItalic(inValue); } else if(inAttribut == MS_BACKGROUND) { SetBackgroundColor(inValue); } else if(inAttribut == MS_BOLD) { SetBold(inValue); } else if(inAttribut == MS_UNDERLINE) { SetUnderLine(inValue); } else if(inAttribut == MS_JUSTIFICATION) { SetJustification(inValue); } }
/** * Init some default values */ void CScintillaBibWnd::Init() { CScintillaWnd::Init(); SetDisplayFolding(TRUE); SetDisplayLinenumbers(TRUE); SetDisplaySelection(FALSE); // BibTeX LoadLexerLib(LEXBIB_LIB); SetLexer(LEXBIB_NAME); SetWrap(SC_WRAP_WORD); // Setup some BibTeX styles SetForeground(SCE_L_COMMAND, RGB(0, 0, 160)); SetForeground(SCE_L_MATH, RGB(150, 150, 40)); SetForeground(SCE_L_COMMENT, RGB(0, 128, 0)); SetForeground(SCE_L_TAG, RGB(0, 0, 255)); SetItalic(SCE_L_COMMENT, TRUE); SetBold(SCE_BIB_ITEM, TRUE); SetBold(SCE_BIB_END, TRUE); SetForeground(SCE_BIB_END, RGB(255, 0, 0)); SetBold(SCE_BIB_START, TRUE); SetForeground(SCE_BIB_START, RGB(255, 0, 0)); SetForeground(SCE_BIB_FIELD, RGB(140, 0, 70)); SetForeground(SCE_BIB_KEY, RGB(140, 0, 0)); SetBold(SCE_BIB_KEY, TRUE); // We also need HTML SetBold(SCE_H_ATTRIBUTEUNKNOWN, FALSE); SetBold(SCE_H_ATTRIBUTE, FALSE); SetBold(SCE_H_SINGLESTRING, FALSE); SetBold(SCE_H_DOUBLESTRING, FALSE); SetBold(SCE_H_TAG, TRUE); SetBold(SCE_H_TAGUNKNOWN, TRUE); SetForeground(SCE_H_TAGUNKNOWN, RGB(255, 0, 0)); // SetItalic(SCE_H_COMMENT, TRUE); // Marker DefineMarker(SC_MARKNUM_FOLDEROPEN, SC_MARK_MINUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0xFF)); DefineMarker(SC_MARKNUM_FOLDER, SC_MARK_PLUS, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERSUB, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEREND, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDEROPENMID, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); DefineMarker(SC_MARKNUM_FOLDERMIDTAIL, SC_MARK_EMPTY, RGB(0xff, 0xff, 0xff), RGB(0, 0, 0)); }
void Console::ResetAttributes() { SetBold(false); SetBlink(false); SetReverseVideo(false); Background(BLACK); Foreground(WHITE); }
/////////////////////////////////////////////////////////////////////////////////// // class CDocStructRecordItem implementation /////////////////////////////////////////////////////////////////////////////////// CDocStructRecordItem::CDocStructRecordItem(CString csCaption, UINT nType, bool bEditOnDblClick) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); //bool bIsBold = true; //if(nType == CDocStructRecord::s_PAGE/*ASSISTANT::GenericContainer::PAGE*/) // bIsBold = false; SetTextColor(RGB(155, 173, 198)); SetBold(false); SetCaption(csCaption); m_csInitialCaption = csCaption; m_bEditOnDblClick = bEditOnDblClick; }
void FontAttributes::SetFromNode(DataNode *parentNode) { if(parentNode == 0) return; DataNode *searchNode = parentNode->GetNode("FontAttributes"); if(searchNode == 0) return; DataNode *node; if((node = searchNode->GetNode("font")) != 0) { // Allow enums to be int or string in the config file if(node->GetNodeType() == INT_NODE) { int ival = node->AsInt(); if(ival >= 0 && ival < 3) SetFont(FontName(ival)); } else if(node->GetNodeType() == STRING_NODE) { FontName value; if(FontName_FromString(node->AsString(), value)) SetFont(value); } } if((node = searchNode->GetNode("scale")) != 0) SetScale(node->AsDouble()); if((node = searchNode->GetNode("useForegroundColor")) != 0) SetUseForegroundColor(node->AsBool()); if((node = searchNode->GetNode("color")) != 0) color.SetFromNode(node); if((node = searchNode->GetNode("bold")) != 0) SetBold(node->AsBool()); if((node = searchNode->GetNode("italic")) != 0) SetItalic(node->AsBool()); }
///! Font Request class: nuiFontRequest::nuiFontRequest(nuiFontBase* pOriginalFont, bool ForcePanoseOnlyFonts) : mName(nglString::Null), mGenericName(nglString::Null), mStyle(nglString::Null), mFace(0), mItalic(false), mBold(false), mMonospace(false), mScalable(true), mMustHaveGlyphs(std::set<nglUChar>()), mMustHaveEncoding(std::set<nglTextEncoding>()), mMustHaveSizes(std::set<int32>()), mPanose(nuiPanose()) { if (SetObjectClass(_T("nuiFontRequest"))) InitAttributes(); if (nuiFontRequest::gGenericNamesForFonts.empty()) { // Standard generic font family names from CSS specification // http://www.w3.org/TR/2002/WD-css3-fonts-20020802/#generic-font-families // latin serif nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Times")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Times New Roman")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Bodoni")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Garamond")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Minion Web")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("ITC Stone Serif")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Georgia")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Bitstream Cyberbit")); // cyrillic serif nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Adobe Minion Cyrillic")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Excelcior Cyrillic Upright")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Monotype Albion 70")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("ER Bukinst")); // hebrew serif nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("New Peninim")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Raanana")); // japanese serif nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Ryumin Light-KL")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Kyokasho ICA")); nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Futo Min A101")); // cherokee serif nuiFontRequest::AddGenericNameForFont(_T("serif"), _T("Lo Cicero Cherokee")); // latin sans-serif nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Trebuchet")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("ITC Avant Garde Gothic")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Arial")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Verdana")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Univers")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Futura")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("ITC Stone Sans")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Gill Sans")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Akzidenz Grotesk")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Helvetica")); // greek sans-serif nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Attika")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Typiko New Era")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Tahoma")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Monotype Gill Sans 571")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Helvetica Greek")); // cyrillic sans-serif nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Helvetica Cyrillic")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("ER Univers")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Lucida Sans Unicode")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Bastion")); // hebrew sans-serif nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Arial Hebrew")); // japanese sans-serif nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Shin Go")); nuiFontRequest::AddGenericNameForFont(_T("sans-serif"), _T("Heisei Kaku Gothic W5")); // latin cursive nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Caflisch Script")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Comic Sans MS")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Adobe Poetica")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Sanvito")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Ex Ponto")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Snell Roundhand")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Apple Chancery")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Zapf-Chancery")); // cyrillic cursive nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("ER Architekt")); // hebrew cursive nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Corsiva")); // arabic cursive nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("DecoType Naskh")); nuiFontRequest::AddGenericNameForFont(_T("cursive"), _T("Monotype Urdu 507")); // latin fantasy nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Alpha Geometrique")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Critter")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Cottonwood")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("FB Reactor")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Studz")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Nina")); nuiFontRequest::AddGenericNameForFont(_T("fantasy"), _T("Papyrus")); // latin monospace nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("Courier")); nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("Courier New")); nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("Prestige")); nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("Everson Mono")); // cyrillic monospace nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("ER Kurier")); // japanese monospace nuiFontRequest::AddGenericNameForFont(_T("monospace"), _T("Osaka Monospaced")); // add default fonts for each system #ifdef _WIN32_FONTS_ nuiFontRequest::gDefaultFontsForGenericNames[_T("serif")] = _T("Times New Roman"); nuiFontRequest::gDefaultFontsForGenericNames[_T("sans-serif")] = _T("Arial"); nuiFontRequest::gDefaultFontsForGenericNames[_T("cursive")] = _T("Comic Sans MS"); nuiFontRequest::gDefaultFontsForGenericNames[_T("fantasy")] = _T("Nina"); nuiFontRequest::gDefaultFontsForGenericNames[_T("monospace")] = _T("Courier New"); #endif #ifdef _CARBON_FONTS_ nuiFontRequest::gDefaultFontsForGenericNames[_T("serif")] = _T("Times"); nuiFontRequest::gDefaultFontsForGenericNames[_T("sans-serif")] = _T("Helvetica"); nuiFontRequest::gDefaultFontsForGenericNames[_T("cursive")] = _T("Apple Chancery"); nuiFontRequest::gDefaultFontsForGenericNames[_T("fantasy")] = _T("Papyrus"); nuiFontRequest::gDefaultFontsForGenericNames[_T("monospace")] = _T("Courier"); #endif } /*mItalic.mScore = 0.05f; mBold.mScore = 0.05f; mMonospace.mScore = 0.05f;*/ mFace.mElement = 0; if (pOriginalFont) { if (pOriginalFont->HasPanoseInfo()) { MustBeSimilar(pOriginalFont->GetPanoseBytes(), 20.0f); if (mItalic.mScore > 0.0) mPanose.mElement.SetItalic(pOriginalFont->IsItalic()); if (mBold.mScore > 0.0) mPanose.mElement.SetBold(pOriginalFont->IsBold()); } if (!ForcePanoseOnlyFonts || !pOriginalFont->HasPanoseInfo()) { SetName(pOriginalFont->GetFamilyName(), 3.0f); SetStyle(pOriginalFont->GetStyleName(), 1.5f); SetItalic(pOriginalFont->IsItalic(), 1.0f); SetBold(pOriginalFont->IsBold(), 1.0f); if (pOriginalFont->IsScalable()) SetScalable(10.f, true); if (pOriginalFont->IsMonospace()) SetMonospace(1.0f); MustHaveSize(pOriginalFont->GetSize(), 1.0f); } } }
void nuiFontRequest::_SetBold(bool Bold) { SetBold(Bold, 1.0); }
bool CTerminal::PrintFormattedChar(int c) { if( FOut == NULL ) return(false); // levels // 12 // <c> // </c> // 134 if( c == '<' ) { if( CommandLevel == 1 ) { fprintf(FOut,"%c",(char)c); BlockCount++; Command.str(""); Command.clear(); CommandLevel = 0; return(true); } if( CommandLevel != 0 ) { fprintf(FOut,"%s","!formating error!"); Command.str(""); Command.clear(); CommandLevel = 0; return(false); } CommandLevel = 1; return(true); } if( c == '/' ) { if( CommandLevel == 0 ) { fprintf(FOut,"%c",(char)c); BlockCount++; return(true); } if( CommandLevel != 1 ) { fprintf(FOut,"%s","!formating error1!"); Command.str(""); Command.clear(); CommandLevel = 0; return(false); } CommandLevel = 3; return(true); } if( c == '>' ) { if( CommandLevel == 0 ) { fprintf(FOut,"%c",(char)c); BlockCount++; return(true); } if( (CommandLevel != 2) && (CommandLevel != 4) ) { fprintf(FOut,"%s","!formating error2!"); Command.str(""); Command.clear(); CommandLevel = 0; return(false); } std::string cmd = Command.str(); // apply command if( CommandLevel == 2 ) { if( cmd == "b" ) { SetBold(true); } else if ( cmd == "u" ) { SetUnderline(true); } else if ( cmd == "i" ) { SetItalic(true); } else if ( cmd == "black" ) { SetColors(EC_BLACK); } else if ( cmd == "red" ) { SetColors(EC_RED); } else if ( cmd == "green" ) { SetColors(EC_GREEN); } else if ( cmd == "yellow" ) { SetColors(EC_YELLOW); } else if ( cmd == "blue" ) { SetColors(EC_BLUE); } else if ( cmd == "purple" ) { SetColors(EC_PURPLE); } else if ( cmd == "cyan" ) { SetColors(EC_CYAN); } else if ( cmd == "white" ) { SetColors(EC_WHITE); } else if ( cmd.find("block") == 0 ) { BlockMode = true; std::string tmp; LeftOffset = 0; BlockCount = 0; Command >> tmp >> LeftOffset; for(int i=0; i < LeftOffset; i++ ) fprintf(FOut," "); } } // revers command if( CommandLevel == 4 ) { if( cmd == "b" ) { SetBold(false); } else if ( cmd == "u" ) { SetUnderline(false); } else if ( cmd == "i" ) { SetItalic(false); } else if ( cmd == "black" ) { SetDefault(); } else if ( cmd == "red" ) { SetDefault(); } else if ( cmd == "green" ) { SetDefault(); } else if ( cmd == "yellow" ) { SetDefault(); } else if ( cmd == "blue" ) { SetDefault(); } else if ( cmd == "purple" ) { SetDefault(); } else if ( cmd == "cyan" ) { SetDefault(); } else if ( cmd == "white" ) { SetDefault(); } else if ( cmd == "block" ) { BlockMode = false; LeftOffset = 0; } } Command.str(""); Command.clear(); CommandLevel = 0; return(true); }
void FitParamDlg::UnsetAllBold() { for(QLabel* pLab : {labelAmp, labelSig, labelHWHM, labelX0, labelOffs, labelSlope, labelFreq, labelPhase}) SetBold(pLab, 0); }
/// @todo Check boundaries bool Console::AnsiEscFilter(const char c) { if (_ansiBufferPos == 0 && c == (char)0x9B) { _ansiBufferPos = 2; return true; }else if (_ansiBufferPos == 0 && c == (char)0x1B) { _ansiBufferPos = 1; return true; }else if (_ansiBufferPos == 1) { if (c == '[') { _ansiBufferPos = 2; return true; } else { _ansiBufferPos = 0; return false; } }else if (_ansiBufferPos > 1) { if (isdigit(c) || c == ';') { _ansiBuffer[_ansiBufferPos++] = c; } else { _ansiBuffer[_ansiBufferPos] = '\0'; _ansiBufferPos = 0; long params[10] = {0}; const int parQty = AnsiEscParseParams(&_ansiBuffer[2], params); switch(c) { case 'c': // Reset Device ResetAttributes(); Erase(BOTH, false); break; case 'h': if (parQty == 1 && params[0] == 7) SetLineWrap(true); break; case 'l': if (parQty == 1 && params[0] == 7) SetLineWrap(false); break; case 'A': // [nA Cursor Up if (!parQty) params[0] = 1; // _cursor -= _canvas.Size().x*params[0]; UpdateCursor(); break; case 'B': // [nB Cursor Down if (!parQty) params[0] = 1; // _cursor += _canvas.Size().x*params[0]; UpdateCursor(); break; case 'C': // [nC Cursor Forward if (!parQty) params[0] = 1; // _cursor += params[0]; UpdateCursor(); break; case 'D': // [nD Cursor Backward if (!parQty) params[0] = 1; // _cursor -= params[0]; UpdateCursor(); break; case 'H': // [y;xH Cursor Home case 'f': // [y;xf Force Cursor Position if (parQty < 2) { params[0] = 0; // Y params[1] = 0; // X } // _cursor = _canvas.Buffer() + _canvas.Size().x*params[0] + params[1]; UpdateCursor(); break; case 's': // [s Save Cursor _ansiCursorStack.Push(_cursor); break; case 'u': // [u Unsave Cursor _cursor = _ansiCursorStack.Pop(); UpdateCursor(); break; case 'J': // [nJ if (parQty == 0) params[0] = 0; Erase(static_cast<EraseDirection>(params[0]), false); break; case 'K': // [nK if (parQty == 0) params[0] = 0; Erase(static_cast<EraseDirection>(params[0]), true); break; case 'm': // [p1;..;pNm if (!parQty) { ResetAttributes(); } else { for(int i=0; i<parQty; ++i) { switch(params[i]) { case 0: ResetAttributes(); break; case 1: SetBold(true); break; //case 2: SetFaint(true); break; //case 3: SetItalic(true); break; //case 4: SetUnderline(true); break; case 5: SetBlink(true); break; //case 6: SetRapidBlink(true); break; case 7: SetReverseVideo(true); break; //case 8: SetInvisible(true); break; //case 48: SetSubscript(true); break; //case 49: SetSuperscript(true); break; case 30: Foreground(BLACK); break; case 31: Foreground(RED); break; case 32: Foreground(GREEN); break; case 33: Foreground(BROWN); break; case 34: Foreground(BLUE); break; case 35: Foreground(MAGENTA);break; case 36: Foreground(CYAN); break; case 37: Foreground(WHITE); break; case 90: Foreground(GRAY); break; case 91: Foreground(RED_B); break; case 92: Foreground(LIME); break; case 93: Foreground(YELLOW); break; case 94: Foreground(BLUE_B); break; case 95: Foreground(MAGENTA_B);break; case 96: Foreground(CYAN_B); break; case 97: Foreground(WHITE_B);break; case 40: Background(BLACK); break; case 41: Background(RED); break; case 42: Background(GREEN); break; case 43: Background(BROWN); break; case 44: Background(BLUE); break; case 45: Background(MAGENTA);break; case 46: Background(CYAN); break; case 47: Background(WHITE); break; case 100: Background(GRAY); break; case 101: Background(RED_B); break; case 102: Background(LIME); break; case 103: Background(YELLOW); break; case 104: Background(BLUE_B); break; case 105: Background(MAGENTA_B);break; case 106: Background(CYAN_B); break; case 107: Background(WHITE_B);break; } } } break; default: //the command was not recognized char* p = _ansiBuffer; while(*p) PutChar(*p++); break; } } return true; } return false; }