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;
}
Example #2
0
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;
}
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);
	}
}
/// Updates the contents of the FontSetting object
/// @param faceName Face name of the font
/// @param pointSize Height of the font, in points
/// @param weight Weight of the font (see .h for values)
/// @param italic Make the font italic style
/// @param underline Make the font underline style
/// @param strikeOut Make the font strikeout style
/// @param color Color to draw the font with
/// @return success or failure
bool FontSetting::SetFontSetting(const wxChar* faceName, wxInt32 pointSize, wxInt32 weight, bool italic, bool underline, bool strikeOut, wxColor color)
{
    //------Last Checked------//
    // - Dec 6, 2004
    if (!SetFaceName(faceName))
        return (false);
    if (!SetPointSize(pointSize))
        return (false);
    if (!SetWeight(weight))
        return (false);
    SetItalic(italic);
    SetUnderline(underline);
    SetStrikeOut(strikeOut);
    SetColor(color);
    
    return (true);
}
Example #5
0
/**
 * 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
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());
}
Example #7
0
///! 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);
    }
  }
  
}
Example #8
0
void nuiFontRequest::_SetItalic(bool Italic)
{
  SetItalic(Italic, 1.0);
}
Example #9
0
void ON_Font::SetIsItalic( bool b)
{
  SetItalic( b);
}
Example #10
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);
    }