void JXTabGroup::SetFontStyle ( const JFontStyle& style ) { if (style != itsFontStyle) { itsFontStyle = style; UpdateAppearance(); } }
void JXTabGroup::SetFontSize ( const JSize size ) { if (size != itsFontSize) { itsFontSize = size; UpdateAppearance(); } }
void JXTabGroup::SetFontName ( const JCharacter* name ) { if (name != itsFontName) { itsFontName = name; UpdateAppearance(); } }
void JXTabGroup::SetFont ( const JCharacter* name, const JSize size, const JFontStyle& style ) { itsFontName = name; itsFontSize = size; itsFontStyle = style; UpdateAppearance(); }
void MadEdit::SetHexFont(const wxString &name, int size, bool forceReset) { if(size < 1) size = 1; if(forceReset || size!=m_HexFont->GetPointSize() || name!=m_HexFont->GetFaceName()) { m_HexFont=wxTheFontList->FindOrCreateFont(size, //font.GetFamily(), font.GetStyle(), font.GetWeight(), font.GetUnderlined(), name); wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, name); memset(m_HexFontWidths, 0, sizeof(m_HexFontWidths)); m_HexFontWidths[0]=FontWidthManager::GetFontWidths(0, name, size, this); m_cfg_writer->Record(wxString(wxT("/wxMEdit/HexFontName")), name); m_cfg_writer->Record(wxT("/wxMEdit/HexFontSize"), size); if(m_HexDigitBitmap) { delete m_HexDigitBitmap; m_HexDigitBitmap=nullptr; } if(m_EditMode==emHexMode) { MadEditSuperClass::SetFont(*m_HexFont); m_HexFontHeight=GetCharHeight(); GetHexUCharWidth(0x20); int w; m_HexFontMaxDigitWidth=GetHexUCharWidth('0'); for(wxChar wc=wxT('1');wc<=wxT('9');wc++) { w=GetHexUCharWidth(wc); if(w>m_HexFontMaxDigitWidth) m_HexFontMaxDigitWidth=w; } for(wxChar wc=wxT('A');wc<=wxT('F');wc++) { w=GetHexUCharWidth(wc); if(w>m_HexFontMaxDigitWidth) m_HexFontMaxDigitWidth=w; } UpdateAppearance(); m_RepaintAll=true; SetCaretType(ctBlock); if(!m_LoadingFile) { UpdateScrollBarPos(); if(!m_CaretAtHexArea) { int crow = int(m_CaretPos.pos >> 4); if(crow >= m_TopRow && crow < m_TopRow + m_HexRowCount) { UpdateTextAreaXPos(); m_LastTextAreaXPos = m_TextAreaXPos; } }
void MadEdit::SetTextFont(const wxString &name, int size, bool forceReset) { if(size < 1) size = 1; if(forceReset || size!=m_TextFont->GetPointSize() || name!=m_TextFont->GetFaceName()) { m_TextFont=wxTheFontList->FindOrCreateFont(size, //font.GetFamily(), font.GetStyle(), font.GetWeight(), font.GetUnderlined(), name); wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, name); memset(m_TextFontWidths, 0, sizeof(m_TextFontWidths)); m_TextFontWidths[0] = FontWidthManager::GetFontWidths(0, name, size, this); m_cfg_writer->Record(wxString(wxT("/Fonts/"))+m_Encoding->GetName(), name); m_cfg_writer->Record(wxT("/wxMEdit/TextFontSize"), size); if(m_EditMode==emHexMode) { m_DoRecountLineWidth=true; } else { MadEditSuperClass::SetFont(*m_TextFont); m_TextFontHeight = GetCharHeight(); bool ofwm = m_FixedWidthMode; m_FixedWidthMode = false; // avoid effecting on GetUCharWidth(); m_TextFontSpaceCharWidth=GetUCharWidth(0x20); // DO NOT use GetCharWidth(), for it takes '0' under Windows indeed, 'g' under other OSes m_TextFontAveCharWidth = std::max(GetUCharWidth('g'), m_TextFontSpaceCharWidth); m_TextFontMaxDigitWidth = GetUCharWidth('0'); for (wxChar wc=wxT('1'); wc<=wxT('9'); ++wc) m_TextFontMaxDigitWidth = std::max(m_TextFontMaxDigitWidth, GetUCharWidth(wc)); m_TextFontAveCharWidth = std::max(m_TextFontAveCharWidth, m_TextFontMaxDigitWidth); if (ofwm) //(m_FixedWidthMode) { if (!HexPrinting()) { m_TextFontAveCharWidth = std::max(m_TextFontAveCharWidth, GetUCharWidth('W')); } else { for (wxChar wc=wxT('A'); wc<=wxT('F'); ++wc) m_TextFontAveCharWidth = std::max(m_TextFontAveCharWidth, GetUCharWidth(wc)); } m_TextFontMaxDigitWidth = m_TextFontAveCharWidth; m_TextFontSpaceCharWidth = m_TextFontAveCharWidth; } m_FixedWidthMode = ofwm; m_LeftMarginWidth = std::max(1, (m_TextFontAveCharWidth / 2) - 1); m_RightMarginWidth = m_TextFontAveCharWidth * 2; m_Syntax->InitNextWord1(m_Lines, m_WordBuffer, m_WidthBuffer, name, size, m_TextFont->GetFamily()); const wxSize charsz(m_TextFontAveCharWidth, m_TextFontHeight); const wxSize spacesz(m_TextFontSpaceCharWidth, m_TextFontHeight); CalcSpaceMarkPoints(spacesz); CalcEOFMarkPoints(charsz); CalcEOLMarkPoints(m_cr_points, CR_Points, charsz); CalcEOLMarkPoints(m_lf_points, LF_Points, charsz); CalcEOLMarkPoints(m_crlf_points, CRLF_Points, charsz); UpdateAppearance(); m_RepaintAll=true; SetCaretType(m_CaretType); if(!m_LoadingFile) { RecountLineWidth(true); UpdateScrollBarPos(); Refresh(false); DoStatusChanged(); } else { m_DoRecountLineWidth=true; } } } }